diff options
author | Alex Auvolat <alex@adnab.me> | 2023-10-20 13:55:34 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-10-20 13:56:35 +0200 |
commit | c82d91c6bccf307186332b6c5c6fc0b128b1b2b1 (patch) | |
tree | 5059701470a55c785d12306574b8041f90d9b59b /src/api/s3/put.rs | |
parent | 8686cfd0b10a49048021102a08d637b0d4fe6a91 (diff) | |
download | garage-c82d91c6bccf307186332b6c5c6fc0b128b1b2b1.tar.gz garage-c82d91c6bccf307186332b6c5c6fc0b128b1b2b1.zip |
DeleteObject: always insert a deletion marker with a bigger timestamp than everything beforeincreasing-timestamps
Diffstat (limited to 'src/api/s3/put.rs')
-rw-r--r-- | src/api/s3/put.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/s3/put.rs b/src/api/s3/put.rs index c4df7561..606facc4 100644 --- a/src/api/s3/put.rs +++ b/src/api/s3/put.rs @@ -86,7 +86,7 @@ pub(crate) async fn save_stream<S: Stream<Item = Result<Bytes, Error>> + Unpin>( // Generate identity of new version let version_uuid = gen_uuid(); - let version_timestamp = next_timestamp(&existing_object); + let version_timestamp = next_timestamp(existing_object.as_ref()); // If body is small enough, store it directly in the object table // as "inline data". We can then return immediately. @@ -529,7 +529,7 @@ pub(crate) fn get_headers(headers: &HeaderMap<HeaderValue>) -> Result<ObjectVers }) } -pub(crate) fn next_timestamp(existing_object: &Option<Object>) -> u64 { +pub(crate) fn next_timestamp(existing_object: Option<&Object>) -> u64 { existing_object .as_ref() .and_then(|obj| obj.versions().iter().map(|v| v.timestamp).max()) |