aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/copy.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-01 12:58:20 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-01 12:58:20 +0200
commitbc977f9a7a7a5bd87ccf5fe96d64b397591f8ba0 (patch)
tree0f30a5d7b2d37b9b14ce330930e75395459f4b8a /src/api/s3/copy.rs
parent4b726b09410b3b5ea9cde80d2a445d7914432e3c (diff)
downloadgarage-bc977f9a7a7a5bd87ccf5fe96d64b397591f8ba0.tar.gz
garage-bc977f9a7a7a5bd87ccf5fe96d64b397591f8ba0.zip
Update to Netapp with OrderTag support and exploit OrderTags
Diffstat (limited to 'src/api/s3/copy.rs')
-rw-r--r--src/api/s3/copy.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/api/s3/copy.rs b/src/api/s3/copy.rs
index b54cbd23..10cf5935 100644
--- a/src/api/s3/copy.rs
+++ b/src/api/s3/copy.rs
@@ -9,6 +9,7 @@ use bytes::Bytes;
use hyper::{Body, Request, Response};
use serde::Serialize;
+use garage_rpc::rpc_helper::OrderTag;
use garage_table::*;
use garage_util::data::*;
use garage_util::time::*;
@@ -306,11 +307,16 @@ pub async fn handle_upload_part_copy(
// if and only if the block returned is a block that already existed
// in the Garage data store (thus we don't need to save it again).
let garage2 = garage.clone();
+ let order_stream = OrderTag::stream();
let source_blocks = stream::iter(blocks_to_copy)
- .flat_map(|(block_hash, range_to_copy)| {
+ .enumerate()
+ .flat_map(|(i, (block_hash, range_to_copy))| {
let garage3 = garage2.clone();
stream::once(async move {
- let data = garage3.block_manager.rpc_get_block(&block_hash).await?;
+ let data = garage3
+ .block_manager
+ .rpc_get_block(&block_hash, Some(order_stream.order(i as u64)))
+ .await?;
match range_to_copy {
Some(r) => Ok((data.slice(r), None)),
None => Ok((data, Some(block_hash))),