pub struct CycleGuard { /* private fields */ }Expand description
A termination proof for a chain walk, paid for only by the chains that need one.
Under MAX_DELTA_LINKS links it is two integer operations and no
allocation — the shape every ordinary read has always had. Past that depth
it starts recording the archive offsets it has stood on, and a repeat is a
cycle by definition rather than by a guess about how deep is too deep.
The set is only ever entered on chains a corrupt pack or a long push history
produced, so the hot path is unchanged; a legitimate chain of d links
costs d - MAX_DELTA_LINKS u64 slots and nothing else.
It is one guard for both walkers (LAW 5): materialize_at here and
GitStore::resolved_type_at in crate::serve, which followed the same
links under a hand-written copy of the same ceiling.