diff options
author | Alex Auvolat <alex@adnab.me> | 2020-07-08 17:33:24 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-07-08 17:33:24 +0200 |
commit | 64a6eda0d2bb6aae6a6eef60032ab24ae3c37a88 (patch) | |
tree | 9e3501aba850af7b2e3453e3bba4b3afce007852 /src/api/s3_list.rs | |
parent | 84bbbfaa7b670d6dd1501aeecc6c44251819d4ae (diff) | |
download | garage-64a6eda0d2bb6aae6a6eef60032ab24ae3c37a88.tar.gz garage-64a6eda0d2bb6aae6a6eef60032ab24ae3c37a88.zip |
Migrate S3 api to use new model
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r-- | src/api/s3_list.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs index 1f0eccf5..3fca1348 100644 --- a/src/api/s3_list.rs +++ b/src/api/s3_list.rs @@ -8,6 +8,7 @@ use hyper::{Body, Response}; use garage_util::error::Error; use garage_model::garage::Garage; +use garage_model::object_table::*; use crate::encoding::*; @@ -73,10 +74,15 @@ pub async fn handle_list( if let Some(pfx) = common_prefix { result_common_prefixes.insert(pfx.to_string()); } else { + let size = match &version.state { + ObjectVersionState::Complete(ObjectVersionData::Inline(meta, _)) => meta.size, + ObjectVersionState::Complete(ObjectVersionData::FirstBlock(meta, _)) => meta.size, + _ => unreachable!(), + }; let info = match result_keys.get(&object.key) { None => ListResultInfo { last_modified: version.timestamp, - size: version.size, + size, }, Some(_lri) => { return Err(Error::Message(format!("Duplicate key?? {}", object.key))) |