compact

fun compact(stableCut: VersionVector, frontierMax: VersionVector, delivered: VersionVector): Pair<Fugue<V>, FugueOp.Compact>?

Garbage-collect tombstoned elements that are causally stable under the eviction-safe causal-stability barrier (same design as Rga.compact, docs/op-log-crdt-compaction.md).

A tombstoned element with dot (r, sᵢ) is purged iff all hold:

  1. Tombstoned — implied (only tombstones are candidates).

  2. Causally stablesᵢ ≤ stableCut[r]: every live peer has delivered it.

  3. Frontier-complete∀x: delivered[x] ≥ frontierMax[x]: this replica has delivered every op below every known frontier, so any concurrent Insert(J, parent=id) that exists anywhere has been delivered locally.

  4. No surviving tree anchor — no live FugueOp.Insert has parent == id OR rightOrigin == id. Dropping a node while a child still refers to it as its tree parent would detach that child's subtree; dropping a node that is still a rightOrigin of a surviving insert would change the right-sibling ordering and break non-interleaving. The compacted positions map handles re-rooting surviving children after GC on the next compaction pass.

Returns the compacted Fugue and a FugueOp.Compact delta to broadcast to peers, or null if no element qualifies (or condition 3 is not yet met).

Peers that receive the FugueOp.Compact apply it via apply or absorb it through piece — both paths strip the referenced ops from the log.

Parameters

stableCut

S — elementwise min over all live peers' delivered VVs.

frontierMax

F — elementwise max of the live frontier and any retained (evicted-peer) frontier; the set of dots known to exist.

delivered

this replica's own contiguous delivered VV.