DEFAULT_INTERVAL
DEFAULT_INTERVAL = 14400
Seconds between anchors.
Four hours, chosen against the replay-depth column rather than a storage one.
Decides when an anchor is due, and when it has to be a full one.
Two intervals, and they trade against different things.
The anchor interval bounds replay depth: a restore walks the segments between the target and the anchor before it, so a four-hour interval on fifteen-second flushes means at most 960 segments. It is a weak lever on stored bytes, and the reason is worth being exact about: a longer interval means fewer anchors, but each one then covers a longer window and records proportionally more changed subjects, so the two effects largely cancel. An operator tuning this is tuning restore latency, not the bill.
The full-anchor interval bounds resolve cost: reading an anchor means reading the chain back to the last full one, so writing a full anchor every so often keeps that bounded. A full anchor costs one entry per subject on the site rather than one per subject that changed, so it is the expensive kind and it is written rarely.
__construct(int $interval = \self::DEFAULT_INTERVAL, int $fullEvery = \self::DEFAULT_FULL_EVERY) : mixed
Constructs a policy.
| int | $interval | Seconds between anchors. Zero means an anchor is written on every flush, which is what a test and an export want. |
| int | $fullEvery | Delta anchors before a full one. One means every anchor is full. |
When the interval is negative or the full count is below one.
isDue(int|null $lastAnchor, int $now) : bool
Whether an anchor is due.
| int|null | $lastAnchor | Unix microseconds of the newest anchor, or NULL when there is none, in which case one is always due: without an anchor a replay walks to the root of history. |
| int | $now | Unix microseconds to compare against. |
TRUE when the next flush should write one.
needsFull(int $chainLength) : bool
Whether the anchor now due has to be a full one.
| int | $chainLength | How many anchors stand between the newest one and the full anchor behind it, counting the full one. Zero when there is no anchor at all. |
TRUE when the next anchor must list every subject.
reason(int|null $lastAnchor, int $now, int $chainLength) : string|null
Which bound made an anchor due, for the log line.
| int|null | $lastAnchor | Unix microseconds of the newest anchor, or NULL when there is none. |
| int | $now | Unix microseconds. |
| int | $chainLength | The current chain length. |
The reason, or NULL when no anchor is due.
fromSettings(int|null $interval, int|null $fullEvery = null) : \Drupal\strata\Tree\BasePolicy
A policy from the module's settings.
| int|null | $interval | The configured interval, or NULL for the default. |
| int|null | $fullEvery | The configured full-anchor count, or NULL for the default. |
The policy.