diff options
author | Alex Auvolat <alex@adnab.me> | 2023-05-03 12:02:59 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-06-09 16:23:37 +0200 |
commit | 82e75c0e296c74c374f3d40feeb1aadcb58398f0 (patch) | |
tree | 5449f6cd219e9b6628cb10d70f86a952d5b35382 /src/model/s3/version_table.rs | |
parent | 38d6ac429506f9f488ac522581b12fa530442a59 (diff) | |
download | garage-82e75c0e296c74c374f3d40feeb1aadcb58398f0.tar.gz garage-82e75c0e296c74c374f3d40feeb1aadcb58398f0.zip |
Adapt S3 API code to use new multipart upload models
- Create and PutPart
- completemultipartupload
- upload part copy
- list_parts
Diffstat (limited to 'src/model/s3/version_table.rs')
-rw-r--r-- | src/model/s3/version_table.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/model/s3/version_table.rs b/src/model/s3/version_table.rs index 6cf1cc75..dcf4110a 100644 --- a/src/model/s3/version_table.rs +++ b/src/model/s3/version_table.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use garage_db as db; use garage_util::data::*; +use garage_util::error::*; use garage_table::crdt::*; use garage_table::replication::TableShardedReplication; @@ -188,6 +189,16 @@ impl Version { .binary_search_by(|(k, _)| k.part_number.cmp(&part_number)) .is_ok() } + + pub fn n_parts(&self) -> Result<u64, Error> { + Ok(self + .blocks + .items() + .last() + .ok_or_message("version has no parts")? + .0 + .part_number) + } } impl Ord for VersionBlockKey { |