MAGIC
MAGIC = 'STRATA-FRM-1'
Magic bytes and format version leading every standalone frame object.
The plaintext header a standalone frame object carries.
A frame's object key is the digest of its DECODED bytes, not of the object, so nothing about the key says which codec compressed it, which cipher sealed it or which dictionary it needs. Without that, an object in the bucket cannot be decoded by anything but the database row that happens to describe it - and a reindex exists for exactly the case where that row is gone.
The header is the same shape a segment carries, for the same reason: a reader has to know which codec and cipher to reach for before it can open anything, so those fields cannot themselves be compressed or sealed. Nothing here is secret; the codec id, the cipher id and the decoded length of one frame reveal nothing the object's own size does not.
Packed frames carry the same fields in their pack's trailer instead, because a ranged read of one frame inside a pack must not have to skip a per-frame header of unknown width.
wrap(string $codec, string $cipher, string|null $dictionary, int $rawSize, string|null $parent, int $depth, string $body) : string
Builds the object bytes for a standalone frame.
| string | $codec | Codec id the body was compressed with. |
| string | $cipher | Cipher id the body was sealed with. |
| string|null | $dictionary | Dictionary id the codec needs, or NULL. |
| int | $rawSize | Decoded size in bytes, so a short decode is caught without consulting the index. |
| string|null | $parent | Content address this frame is a delta against, or NULL when it stands alone. |
| int | $depth | Position in the delta chain; zero for an anchor. |
| string | $body | The compressed, sealed frame. |
The object bytes.
parse(string $key, string $stored) : array{codec: string, cipher: string, dictionary: string|null, raw: int, parent: string|null, depth: int, body: string}
Splits a stored frame into its header fields and sealed body.
| string | $key | The object key, for error messages. |
| string | $stored | The stored bytes. |
When the header is absent, truncated, or names a format this release cannot read.
The header fields and the sealed body.