$journal
$journal : \Drupal\strata\Journal\JournalInterface
Seals a window of captured operations into a segment and a commit.
The step that turns capture into a backup. Everything before it is local and cheap; this is where bytes leave the site.
Four objects, whatever the site's size. A pack of frames, a segment manifest, a commit and the ref that names it. The index of every subject is not one of them: writing one per flush was measured at 3,989,289 bytes to record a 201-byte change across 50,000 subjects, because its cost scaled with how many subjects the site had rather than with how many changed. So the index belongs to a base anchor on its own interval, the commits in between inherit its address, and what changed in the meantime accumulates in a local table that costs no requests at all.
The order is fixed by what a crash between two steps would leave behind. Payloads are stored first, because a frame nothing references is collectable garbage while a manifest naming a frame that was never written is a corrupt segment. The segment is written before the anchor, the anchor before the commit, and the commit before the ref moves, so at every point the objects already written are either referenced or collectable, and never dangling.
The journal is trimmed last, after the ref has moved. A flush that dies before the trim leaves the window in place and repeats itself on the next run, producing an identical segment - every object is content-addressed, so a repeat costs a few lookups and writes nothing new. A flush that trimmed first and then died would lose the window outright.
$journal : \Drupal\strata\Journal\JournalInterface
$policy : \Drupal\strata\Journal\FlushPolicy
$store : \Drupal\strata\Cas\ObjectStore
$segments : \Drupal\strata\Segment\SegmentWriter
$bases : \Drupal\strata\Tree\BaseWriter
$reader : \Drupal\strata\Tree\BaseReader
$basePolicy : \Drupal\strata\Tree\BasePolicy
$subjects : \Drupal\strata\Tree\SubjectIndex
$commits : \Drupal\strata\Tree\CommitLog
$lease : \Drupal\strata\Flush\Lease
$index : ?\Drupal\strata\Tree\CommitIndex
$notifier : ?\Drupal\strata\Event\Notifier
__construct(\Drupal\strata\Journal\JournalInterface $journal, \Drupal\strata\Journal\FlushPolicy $policy, \Drupal\strata\Cas\ObjectStore $store, \Drupal\strata\Segment\SegmentWriter $segments, \Drupal\strata\Tree\BaseWriter $bases, \Drupal\strata\Tree\BaseReader $reader, \Drupal\strata\Tree\BasePolicy $basePolicy, \Drupal\strata\Tree\SubjectIndex $subjects, \Drupal\strata\Tree\CommitLog $commits, \Drupal\strata\Flush\Lease $lease, \Psr\Log\LoggerInterface $logger, \Drupal\strata\Tree\CommitIndex|null $index = null, \Drupal\strata\Event\Notifier|null $notifier = null, string $site = '') : mixed
Constructs a flusher.
| \Drupal\strata\Journal\JournalInterface | $journal | The journal to drain. |
| \Drupal\strata\Journal\FlushPolicy | $policy | Decides whether a window is due. |
| \Drupal\strata\Cas\ObjectStore | $store | Stores payloads. |
| \Drupal\strata\Segment\SegmentWriter | $segments | Writes the segment manifest. |
| \Drupal\strata\Tree\BaseWriter | $bases | Writes the base anchor when one is due. |
| \Drupal\strata\Tree\BaseReader | $reader | Resolves the anchor chain when a full anchor is due. |
| \Drupal\strata\Tree\BasePolicy | $basePolicy | Decides when an anchor is due and when it has to list every subject. |
| \Drupal\strata\Tree\SubjectIndex | $subjects | Records where every subject was last stored, which is both what the next anchor names and what the next rewrite of a subject is delta coded against. |
| \Drupal\strata\Tree\CommitLog | $commits | Appends the commit and advances the ref. |
| \Drupal\strata\Flush\Lease | $lease | Keeps two flushes from overlapping. |
| \Psr\Log\LoggerInterface | $logger | Records what a flush did, and what it could not do. |
| \Drupal\strata\Tree\CommitIndex|null | $index | Mirrors the commit into the local index, or NULL to write only to the store. The index is a cache over what the bucket already holds, so a flush that cannot reach it has still produced a complete backup and says so. |
| \Drupal\strata\Event\Notifier|null | $notifier | Announces a sealed window, or NULL to announce nothing. Optional because a flush is correct without one and this class is constructed directly by several tests. |
| string | $site | The site identifier a subscriber needs to tell two sites in one bucket apart. |
flush(bool $force = false, string $ref = \Drupal\strata\Tree\RefStore::MAIN) : \Drupal\strata\Flush\FlushResult
Seals a window if one is due.
| bool | $force | TRUE to seal whatever is pending regardless of the policy. Used by a shutdown, an export and
the |
| string | $ref | Ref to advance. |
What happened.
anchor(\Drupal\strata\Tree\Commit|null $head, int $microtime) : array{index: string, wrote: bool, chain: int, at: int, why: string}
Writes the base anchor if one is due, or names the one already in force.
Which subjects the anchor names is decided by when they last changed rather than by emptying a queue. The rows stay, because they are what the next rewrite of each subject is delta coded against, and a failed anchor therefore costs nothing: the next attempt selects the same set.
| \Drupal\strata\Tree\Commit|null | $head | The commit this one follows, or NULL for the root of history, which always writes one. |
| int | $microtime | Unix microseconds the window was sealed at. |
The anchor address to record, whether this flush wrote it, its chain length, the time it was written and why, which is an empty string when nothing was written.
resolveFull(\Drupal\strata\Tree\Commit|null $head, array, size: int}|null> $changed) : array<string,array{frames: list<string>, size: int}>
The complete index a full anchor lists.
The previous anchor resolved, with this window's changes applied over it. Reading the previous chain is what a full anchor costs and why it is written rarely.
| \Drupal\strata\Tree\Commit|null | $head | The commit this one follows, or NULL when there is no history to carry forward. |
| array |
$changed | What has changed since the last anchor. |
Every subject the site holds.
actorOf(list<\Drupal\strata\Journal\JournalOp> $operations) : int|null
The user a commit is attributed to.
A window covering one person's work is attributed to them; one covering several, or covering unattended work, is attributed to nobody rather than to whoever happened to be last.
| list<\Drupal\strata\Journal\JournalOp> | $operations | The operations the commit covers. |
A Drupal user id, or NULL.