DEFAULT_BUDGET
DEFAULT_BUDGET = 1000
Fine segments read into one coarse window by default.
A bound on memory: a rollup holds every operation of the window it is folding, and a day of fifteen-second segments is 5,760 of them.
Folds the segments of one retention level into the coarser level above it.
The retention ladder keeps fifteen-second windows for an hour, minutes for a day, hours for a week and days for three months. Rolling up is what moves history between those: two hundred and forty fifteen-second segments become one hour-long segment, and a subject written in several of them survives once.
What this actually saves is smaller than it looks, and the number is worth stating. Collapse is writes per distinct subject inside the window, and on a site with hundreds of thousands of subjects that is 1.00 at every level below a day: a subject is almost never written twice in the same minute. It becomes meaningful only at monthly rollups. So the saving at fine levels is the object count - two hundred and forty segment manifests become one - rather than the operations inside them, and the real byte saving at those levels comes from recompression instead.
Nothing is deleted here. A rollup writes the coarse segment and leaves the fine ones in place; removing them is a prune, which needs a reachability walk and a receipt. Writing first and removing separately means a rollup that dies halfway has duplicated history rather than lost it.
$reader : \Drupal\strata\Segment\SegmentReader
$writer : \Drupal\strata\Segment\SegmentWriter
$levels : \Drupal\strata\Compaction\LevelPolicy
$index : \Drupal\strata\Cas\FrameIndexInterface
__construct(\Drupal\strata\Segment\SegmentReader $reader, \Drupal\strata\Segment\SegmentWriter $writer, \Drupal\strata\Compaction\LevelPolicy $levels, \Drupal\strata\Cas\FrameIndexInterface $index, \Psr\Log\LoggerInterface $logger) : mixed
Constructs a rollup pass.
| \Drupal\strata\Segment\SegmentReader | $reader | Reads the fine segments. |
| \Drupal\strata\Segment\SegmentWriter | $writer | Writes the coarse one. |
| \Drupal\strata\Compaction\LevelPolicy | $levels | The ladder, which decides which windows are due and what they roll into. |
| \Drupal\strata\Cas\FrameIndexInterface | $index | Referenced for each frame the coarse segment carries forward, so a prune of the fine segments cannot collect a frame the coarse one still names. |
| \Psr\Log\LoggerInterface | $logger | Records what a pass did. |
run(int $now, int $budget = 0) : array{windows: int, segments: int, operations: int, collapsed: int, written: list<string>, problems: list<string>}
Rolls up every window that is due, coarsest level last.
| int | $now | Unix seconds to judge retention against. |
| int | $budget | Most fine segments to read in one pass, or zero for the default. |
How many windows were folded, how many fine segments they covered, how many operations came out, how many were collapsed away, the coarse segment keys written, and anything that failed.
fold(int $level, int $start, list$keys) : array{key: string, operations: int, collapsed: int}|null
Folds the segments of one window into a single coarser one.
| int | $level | The level being rolled up. |
| int | $start | The coarse window's start second, which the new segment is filed under. |
| list |
$keys | The fine segment keys. |
What was written, or NULL when the window held nothing to write.
boundary(list<\Drupal\strata\Journal\JournalOp> $operations, bool $lowest) : int
The lowest or highest sequence in a set of operations.
A rolled-up window spans several segments, so its sequence range is the range of what survived rather than the range of any one segment it came from.
| list<\Drupal\strata\Journal\JournalOp> | $operations | The operations. |
| bool | $lowest | TRUE for the first sequence, FALSE for the last. |
The sequence.