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 travels through the entire system: clients set it via HTTP headers, the server parses and validates it, the service passes it to backends, and backends persist it alongside the stored object.

The module also defines further types used in metadata.

§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.
  • JSON — used internally by backends for storage. JSON serialization includes additional internal fields 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_FILENAME
The custom HTTP header that contains the filename of the object.
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_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.