\Drupal\strata\Tree BaseWriter

Writes the anchors a replay starts from.

One object per anchor, content-addressed, chained to the anchor before it. A delta anchor names only the subjects that changed since its parent; a full one names every subject and ends the chain so a resolve is bounded.

Summary

Methods
Properties
Constants
__construct
write
delta
full
key
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
withoutDeletions
provider
No private constants found

Properties

Methods

__construct()

__construct(\Drupal\strata\Storage\StorageProviderInterface  $provider) : mixed

Constructs a writer.

Parameters

\Drupal\strata\Storage\StorageProviderInterface $provider

Where anchors are stored.

Returns

mixed —

write()

write(\Drupal\strata\Tree\BaseManifest  $manifest) : string

Writes one anchor.

Parameters

\Drupal\strata\Tree\BaseManifest $manifest

The anchor.

Throws

\RuntimeException

When the anchor cannot be written.

Returns

string —

Its content address.

delta()

delta(array, size: int}|null>  $changed, string|null  $parent, int  $microtime) : string

Writes a delta anchor over an existing one.

Parameters

array, size: int}|null> $changed

Subject path keyed to its new frame map, or NULL for a subject that was deleted.

string|null $parent

Address of the previous anchor, or NULL when this is the first one, in which case it is written as a full anchor because there is nothing behind it to change.

int $microtime

Unix microseconds.

Throws

\RuntimeException

When the anchor cannot be written.

Returns

string —

The new anchor's address.

full()

full(array, size: int}>  $index, int  $microtime) : string

Writes a full anchor, which ends the chain.

Parameters

array, size: int}> $index

Every subject the site holds.

int $microtime

Unix microseconds.

Throws

\RuntimeException

When the anchor cannot be written.

Returns

string —

The new anchor's address.

key()

key(string  $address) : string

The object key an anchor lives at.

Parameters

string $address

The anchor's content address.

Returns

string —

The key.

withoutDeletions()

withoutDeletions(array, size: int}|null>  $changed) : array<string,array{frames: list<string>, size: int}>

Drops the deletions from a change set.

A full anchor lists what exists. A subject recorded as deleted exists in a delta only to cancel its parent's entry, and a full anchor has no parent to cancel.

Parameters

array, size: int}|null> $changed

The change set.

Returns

array, size: int}> —

The surviving subjects.