\Drupal\strata\Cas FrameRecord

What the index knows about one stored frame.

Enough to fetch and decode the frame without reading anything else: which object holds it, where inside that object it starts, which codec and cipher wrote it, and which dictionary it needs. A frame whose dictionary is unknown cannot be decoded at all, so the reference is part of the record rather than something inferred from the store's current settings, which may have changed since the frame was written.

Summary

Methods
Properties
Constants
__construct
isDelta
isPacked
isOrphan
ratio
withReferences
jsonSerialize
fromArray
hash
rawSize
storedSize
codec
cipher
dictionary
pack
offset
references
created
deltaParent
deltaDepth
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$hash

$hash : string

Type

string

$rawSize

$rawSize : int

Type

int

$storedSize

$storedSize : int

Type

int

$codec

$codec : string

Type

string

$cipher

$cipher : string

Type

string

$dictionary

$dictionary : ?string

Type

string|null

$pack

$pack : ?string

Type

string|null

$offset

$offset : int

Type

int

$references

$references : int

Type

int

$created

$created : int

Type

int

$deltaParent

$deltaParent : ?string

Type

string|null

$deltaDepth

$deltaDepth : int

Type

int

Methods

__construct()

__construct(string  $hash, int  $rawSize, int  $storedSize, string  $codec, string  $cipher, string|null  $dictionary = null, string|null  $pack = null, int  $offset = 0, int  $references = 1, int  $created = 0, string|null  $deltaParent = null, int  $deltaDepth = 0) : mixed

Constructs a record.

Parameters

string $hash

Content address of the decoded frame.

int $rawSize

Decoded size in bytes.

int $storedSize

Encoded size in bytes, after compression and sealing.

string $codec

Codec id the frame was compressed with.

string $cipher

Cipher id the frame was sealed with.

string|null $dictionary

Dictionary id the codec needs, or NULL when none was used.

string|null $pack

Pack object id the frame lives inside, or NULL when it is its own object.

int $offset

Byte offset within the pack; zero for a standalone frame.

int $references

How many segments, trees or file maps point at this frame. A frame at zero is collectable.

int $created

Unix timestamp the frame was first stored.

string|null $deltaParent

Content address of the frame this one is a delta against, or NULL when it stands alone. A prune must keep the whole chain: a frame whose parent has been collected decodes to nothing, so this is the third thing reachability protects, alongside commits and dictionaries.

int $deltaDepth

Position in the delta chain; zero for an anchor.

Throws

\InvalidArgumentException

When the hash is not a valid digest, a size or offset is negative, the reference count is negative, an offset is given without a pack, or a delta depth is given without a parent.

Returns

mixed —

isDelta()

isDelta() : bool

Whether this frame needs another frame to decode.

Returns

bool —

TRUE when it is a delta against a parent.

isPacked()

isPacked() : bool

Whether this frame shares an object with others.

Returns

bool —

TRUE when it lives inside a pack.

isOrphan()

isOrphan() : bool

Whether anything still points at this frame.

Returns

bool —

TRUE when the reference count has reached zero.

ratio()

ratio() : float

How much smaller the stored form is than the frame.

Returns

float —

Raw size divided by stored size; 1.0 when either is zero.

withReferences()

withReferences(int  $references) : self

The same record with a different reference count.

Parameters

int $references

The new count.

Throws

\InvalidArgumentException

When the count is negative.

Returns

self —

A new record.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The record as a plain array.

fromArray()

fromArray(array  $data) : self

Rebuilds a record from its serialized form.

Parameters

array $data

The array produced by FrameRecord::jsonSerialize().

Throws

\InvalidArgumentException

When a required key is missing or a value is out of range.

Returns

self —

The record.