pub struct Metadata {
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 origin: Option<String>,
pub size: Option<usize>,
pub custom: BTreeMap<String, String>,
}Expand description
Per-object metadata.
Includes first-class fields (expiration, compression, timestamps, etc.) and arbitrary user-provided key-value metadata. See the module-level documentation for the HTTP header mapping conventions.
Fields§
§expiration_policy: ExpirationPolicyThe expiration policy of the object (header: x-sn-expiration).
Skipped during serialization when set to ExpirationPolicy::Manual.
time_created: Option<SystemTime>The creation/last replacement time of the object (header: x-sn-time-created).
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 resolved expiration timestamp (header: x-sn-time-expires).
Derived from the expiration_policy. When using
a time-to-idle policy, this reflects the expiration timestamp present
prior to the current access to the object.
content_type: Cow<'static, str>IANA media type of the object (header: Content-Type).
Defaults to DEFAULT_CONTENT_TYPE (application/octet-stream).
compression: Option<Compression>The compression algorithm used for this object (header: Content-Encoding).
origin: Option<String>The origin of the object (header: x-sn-origin).
Typically the IP address of the original source. This is an optional but encouraged field that tracks where the payload was originally obtained from (e.g. the IP of a Sentry SDK or CLI).
size: Option<usize>Size of the data in bytes, if known.
Not transmitted via HTTP headers; set by backends when the object is stored or retrieved.
custom: BTreeMap<String, String>Arbitrary user-provided key-value metadata (header prefix: x-snme-).
Each entry is transmitted as x-snme-{key}: {value}.
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 public API 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) -> Result<HeaderMap, Error>
pub fn to_headers(&self, prefix: &str) -> Result<HeaderMap, Error>
Turns the metadata into a [HeaderMap] for the public API.
It will prefix any non-standard headers with the given prefix. GCS-specific headers are
not emitted; backends handle those separately.