Compact

@Serializable
data class Compact(val positions: Map<RgaId, RgaId>) : RgaOp<Nothing>

Records that the positions entries have been garbage-collected from the op-log.

The map carries each compacted id's predecessor at GC time (id → Insert.after). computeSequence uses this to reattach surviving successors to the nearest surviving ancestor (positional reroot, #293) rather than to RgaId.HEAD.

The ids that are purged are positions.keys. Merging two Compact ops via Rga.piece unions their positions maps — sound because a given id's after is fixed when its Insert was created, so two replicas always agree on the value.

Applying a Compact removes every Insert and Remove op whose id is in positions.keys. Receiving the same Compact twice is idempotent.

Constructors

Link copied to clipboard
constructor(positions: Map<RgaId, RgaId>)

Properties

Link copied to clipboard