Compact

@Serializable
data class Compact(val positions: Map<FugueId, FugueId>) : FugueOp<Nothing>

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

The map carries each compacted id's tree-parent at GC time (id → Insert.parent). buildTree uses this to re-root surviving children of a dropped node to the nearest surviving ancestor, preserving the traversal order.

The ids purged are positions.keys. Merging two Compact ops via Fugue.piece unions their positions maps — sound because a given id's Insert.parent is fixed at insert time, 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.

id is the sentinel FugueId.HEAD — a Compact carries no element id of its own but must satisfy the FugueOp contract.

Constructors

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

Properties

Link copied to clipboard
open override val id: FugueId

The FugueId of the element this operation creates or tombstones.

Link copied to clipboard

Serialized in canonical key order (#1978): the map is built from a merge-ordered tombstone set, so two replicas at the same logical state hold equal Compact ops whose plain-map encodings differ. FugueOpSerializer — the wire path, via Fugue.wireSerializer — applies the same CanonicalMapSerializer; the annotation covers the compiler-generated serializer a consumer reaches through Compact.serializer().