aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-10 17:01:05 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-10 17:01:05 +0100
commitaf7600f989d79d07253405647973828435f9d16c (patch)
tree75ae9d5d352e5debfd244a7fe0deb54d59bdd6dd /src/model
parent445912dc6a3b65d0726b9378b3542b4061272cf4 (diff)
downloadgarage-af7600f989d79d07253405647973828435f9d16c.tar.gz
garage-af7600f989d79d07253405647973828435f9d16c.zip
Correctly implement CompleteMultipartUpload with etag check of parts
Diffstat (limited to 'src/model')
-rw-r--r--src/model/version_table.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/model/version_table.rs b/src/model/version_table.rs
index 26abb64e..7ccc6a33 100644
--- a/src/model/version_table.rs
+++ b/src/model/version_table.rs
@@ -16,8 +16,11 @@ pub struct Version {
pub uuid: UUID,
// Actual data: the blocks for this version
+ // In the case of a multipart upload, also store the etags
+ // of individual parts and check them when doing CompleteMultipartUpload
pub deleted: crdt::Bool,
pub blocks: crdt::Map<VersionBlockKey, VersionBlock>,
+ pub parts_etags: crdt::Map<u64, String>,
// Back link to bucket+key so that we can figure if
// this was deleted later on
@@ -31,6 +34,7 @@ impl Version {
uuid,
deleted: deleted.into(),
blocks: crdt::Map::new(),
+ parts_etags: crdt::Map::new(),
bucket,
key,
}
@@ -82,8 +86,10 @@ impl CRDT for Version {
if self.deleted.get() {
self.blocks.clear();
+ self.parts_etags.clear();
} else {
self.blocks.merge(&other.blocks);
+ self.parts_etags.merge(&other.parts_etags);
}
}
}