From 942c1f1bfe138cbc4e49540cede852e4d462590e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 13 Jun 2023 10:48:22 +0200 Subject: multipart uploads: save timestamp --- src/model/s3/mpu_table.rs | 11 ++++++++++- src/model/s3/object_table.rs | 9 +++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/model') diff --git a/src/model/s3/mpu_table.rs b/src/model/s3/mpu_table.rs index 63a4f1af..238cbf11 100644 --- a/src/model/s3/mpu_table.rs +++ b/src/model/s3/mpu_table.rs @@ -27,6 +27,8 @@ mod v09 { /// Partition key = Upload id = UUID of the object version pub upload_id: Uuid, + /// The timestamp at which the multipart upload was created + pub timestamp: u64, /// Is this multipart upload deleted /// The MultipartUpload is marked as deleted as soon as the /// multipart upload is either completed or aborted @@ -85,9 +87,16 @@ impl PartialOrd for MpuPartKey { } impl MultipartUpload { - pub fn new(upload_id: Uuid, bucket_id: Uuid, key: String, deleted: bool) -> Self { + pub fn new( + upload_id: Uuid, + timestamp: u64, + bucket_id: Uuid, + key: String, + deleted: bool, + ) -> Self { Self { upload_id, + timestamp, deleted: crdt::Bool::new(deleted), parts: crdt::Map::new(), bucket_id, diff --git a/src/model/s3/object_table.rs b/src/model/s3/object_table.rs index db5ccf96..ebea04bd 100644 --- a/src/model/s3/object_table.rs +++ b/src/model/s3/object_table.rs @@ -444,8 +444,13 @@ impl TableSchema for ObjectTable { ), }; if delete_mpu { - let deleted_mpu = - MultipartUpload::new(v.uuid, old_v.bucket_id, old_v.key.clone(), true); + let deleted_mpu = MultipartUpload::new( + v.uuid, + v.timestamp, + old_v.bucket_id, + old_v.key.clone(), + true, + ); let res = self.mpu_table.queue_insert(tx, &deleted_mpu); if let Err(e) = db::unabort(res)? { error!( -- cgit v1.2.3