Expand description
Per-object metadata types and HTTP header serialization.
This module defines Metadata, the per-object metadata structure that
accompanies every stored object, along with ExpirationPolicy and
Compression.
§Serialization
Metadata has two serialization formats:
- HTTP headers — used by the public API.
Metadata::from_headersandMetadata::to_headershandle this conversion for public fields only. Internal fields likeMetadata::is_redirect_tombstoneare handled by backends directly. - JSON — used internally by backends for storage. JSON serialization
includes additional internal fields (e.g.
is_redirect_tombstone) that are skipped in the header representation.
§HTTP header prefixes
Headers use three prefix conventions:
- Standard HTTP headers where applicable (
Content-Type,Content-Encoding) x-sn-*for objectstore-specific fields (e.g.x-sn-expiration)x-snme-for custom user metadata (e.g.x-snme-build_id)
Backends that store metadata as object metadata (like GCS) layer their own
prefix on top, so x-sn-expiration becomes x-goog-meta-x-sn-expiration.
The Metadata::from_headers and Metadata::to_headers methods accept
a prefix parameter for this purpose.
Structs§
- Metadata
- Per-object metadata.
Enums§
- Compression
- The compression algorithm applied to an object’s payload.
- Error
- Errors that can happen dealing with metadata
- Expiration
Policy - The per-object expiration policy.
Constants§
- DEFAULT_
CONTENT_ TYPE - The default content type for objects without a known content type.
- HEADER_
EXPIRATION - The custom HTTP header that contains the serialized
ExpirationPolicy. - HEADER_
META_ PREFIX - The prefix for custom HTTP headers containing custom per-object metadata.
- HEADER_
ORIGIN - The custom HTTP header that contains the origin of the object.
- HEADER_
REDIRECT_ TOMBSTONE - The custom HTTP header that contains the serialized redirect tombstone.
- HEADER_
TIME_ CREATED - The custom HTTP header that contains the object creation time.
- HEADER_
TIME_ EXPIRES - The custom HTTP header that contains the object expiration time.