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_headersandMetadata::to_headershandle 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
- 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_
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.