pub struct Metadata {
pub is_redirect_tombstone: Option<bool>,
pub expiration_policy: ExpirationPolicy,
pub time_created: Option<SystemTime>,
pub time_expires: Option<SystemTime>,
pub content_type: Cow<'static, str>,
pub compression: Option<Compression>,
pub size: Option<usize>,
pub custom: BTreeMap<String, String>,
}Expand description
Per-object Metadata.
This includes special metadata like the expiration policy and compression used, as well as arbitrary user-provided metadata.
Fields§
§is_redirect_tombstone: Option<bool>The object/metadata denotes a “redirect key”.
This means that this particular object is just a tombstone, and the real thing is rather found on the other backend. In practice this means that the tombstone is stored on the “HighVolume” backend, to avoid unnecessarily slow “not found” requests on the “LongTerm” backend.
expiration_policy: ExpirationPolicyThe expiration policy of the object.
time_created: Option<SystemTime>The creation/last replacement time of the object, if known.
This is set by the server every time an object is put, i.e. when objects are first created and when existing objects are overwritten.
time_expires: Option<SystemTime>The expiration time of the object, if any, in accordance with its expiration policy.
When using a Time To Idle expiration policy, this value will reflect the expiration timestamp present prior to the current access to the object.
content_type: Cow<'static, str>The content type of the object, if known.
compression: Option<Compression>The compression algorithm used for this object, if any.
size: Option<usize>Size of the data in bytes, if known.
custom: BTreeMap<String, String>Some arbitrary user-provided metadata.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn from_headers(headers: &HeaderMap, prefix: &str) -> Result<Self, Error>
pub fn from_headers(headers: &HeaderMap, prefix: &str) -> Result<Self, Error>
Extracts metadata from the given [HeaderMap].
A prefix can be also be provided which is being stripped from custom non-standard headers.
Sourcepub fn to_headers(
&self,
prefix: &str,
with_expiration: bool,
) -> Result<HeaderMap, Error>
pub fn to_headers( &self, prefix: &str, with_expiration: bool, ) -> Result<HeaderMap, Error>
Turns the metadata into a [HeaderMap].
It will prefix any non-standard headers with the given prefix.
If the with_expiration parameter is set, it will additionally resolve the expiration policy
into a specific RFC3339 datetime, and set that as the Custom-Time header.