DEFAULT_MAX_DEPTH
DEFAULT_MAX_DEPTH = 32
Chain depth Strata ships with.
Decides when a delta chain must be broken by a self-contained frame.
Delta coding is what makes a rewritten value cheap: measured on 5,967-byte user notification blobs with one flag flipped and one entry appended, compressing against the previous version reached 63.70x where standalone compression reached 4.49x - 94 bytes against 1,330.
The cost is a dependency. Frame N decodes only if frame N-1 is present and intact, so an
unbounded chain turns one lost frame into an unbounded loss and makes restore latency grow
without limit. Git solves the same problem in its packfiles with pack.depth, default 50.
Strata's default is 32, chosen lower because a restore here walks the chain synchronously while
a user waits, and because the marginal ratio past ~30 links is small against the marginal risk.
A chain break is called an anchor: a frame encoded standalone, which any later frame can be rebuilt from without reaching further back.
__construct(int $maxDepth = \self::DEFAULT_MAX_DEPTH) : mixed
Constructs a policy.
| int | $maxDepth | Maximum chain depth, between 0 and ChainDepthPolicy::HARD_MAX_DEPTH. Zero means every frame is an anchor, which is the correct setting for a store that values restore latency over size. |
When $maxDepth is negative or above the hard maximum.
mustAnchor(int $parentDepth) : bool
Whether a frame at this parent depth must be written standalone.
| int | $parentDepth | The depth of the frame this one would be encoded against. |
When $parentDepth is negative.
TRUE when the new frame must be an anchor.
nextDepth(int $parentDepth) : int
The depth a new frame would have.
| int | $parentDepth | The depth of the frame this one is encoded against. |
When $parentDepth is negative.
Zero when the frame must anchor, otherwise one past the parent.
remaining(int $depth) : int
How many more links a chain at this depth can take.
Surfaced so the UI can show headroom rather than only reporting the break after it happens.
| int | $depth | Current chain depth. |
When $depth is negative.
Remaining links before the next anchor, never negative.