Skip to main content

Module metadata

Module metadata 

Source
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_headers and Metadata::to_headers handle this conversion for public fields only. Internal fields like Metadata::is_redirect_tombstone are 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
ExpirationPolicy
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.