\Drupal\strata\Cas FrameEnvelope

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.

Summary

Methods
Properties
Constants
wrap
parse
No public properties found
MAGIC
ABSENT
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
FIELDS

Constant

MAGIC

MAGIC = 'STRATA-FRM-1'

Magic bytes and format version leading every standalone frame object.

ABSENT

ABSENT = '-'

Written in place of a dictionary or delta parent the frame does not have.

FIELDS

FIELDS = 6

How many newline-delimited fields the header carries.

Methods

wrap()

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.

Parameters

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.

Returns

string —

The object bytes.

parse()

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.

Parameters

string $key

The object key, for error messages.

string $stored

The stored bytes.

Throws

\RuntimeException

When the header is absent, truncated, or names a format this release cannot read.

Returns

array{codec: string, cipher: string, dictionary: string|null, raw: int, parent: string|null, depth: int, body: string} —

The header fields and the sealed body.