Skip to content

Commit

Permalink
S3object meta (#669)
Browse files Browse the repository at this point in the history
capture more of the object's metadata into S3Object, specifically:

storage_class
size
last_modified

---------

Co-authored-by: kdesjard <kristian.desjardins@nrcan-rncan.gc.ca>
Co-authored-by: Patrick Crumley <patrick.crumley@gmail.com>
  • Loading branch information
3 people authored Mar 27, 2024
1 parent 59792e3 commit acffe86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/esthri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,13 @@ async fn list_objects_request(
for object in contents {
match (object.key, object.e_tag) {
(Some(key), Some(e_tag)) => {
listing.contents.push(S3Object { key, e_tag });
listing.contents.push(S3Object {
key,
e_tag,
storage_class: object.storage_class,
size: object.size,
last_modified: object.last_modified,
});
}
(key, etag) => {
if key.is_none() {
Expand Down
6 changes: 6 additions & 0 deletions crates/esthri/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use std::{
result::Result as StdResult,
};

use aws_sdk_s3::primitives::DateTime;
use aws_sdk_s3::types::ObjectStorageClass;
use regex::Regex;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

Expand Down Expand Up @@ -149,9 +151,13 @@ impl S3Listing {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct S3Object {
pub key: String,
pub e_tag: String,
pub storage_class: Option<ObjectStorageClass>,
pub size: Option<i64>,
pub last_modified: Option<DateTime>,
}

/// For syncing from remote to local, or local to remote, "metadata" is attached to the listing in
Expand Down

0 comments on commit acffe86

Please sign in to comment.