Package-level declarations
Types
A bounded / escrow counter: a shared budget pre-divided into per-replica quotas, with the invariant quota(r) >= 0 enforced locally and the derived global invariant "total spent <= total received" held by construction. No coordination is required for the local check — only for redistributing quota via transfer.
A full delta-state CRDT built from a DotStore and the DotContext that adjudicates its dots. piece is the causal join: merge the stores using both contexts, then union the contexts. This is the glue that turns any DotStore shape (DotSet now; DotFun/DotMap later) into a Quilted.
The causal history of a replica: every Dot it has ever witnessed, live or already removed. It is the memory that outlives a delete — that is what lets a merge tell "I saw that dot and dropped it on purpose" from "I just haven't seen it yet".
A DotStore mapping each Dot to a value V. Because a dot is minted once and never reused, a dot in both stores carries the same value, so the causal join needs no value-level conflict resolution — surviving dots simply keep their value. As Causal<DotFun<V>> this is a Multi-Value Register: concurrent writes each keep their (dot, value), surfacing the conflict rather than hiding it.
The simplest DotStore: a bare set of dots carrying no payload. Presence is "non-empty". As Causal<DotSet> it is an enable-wins flag / set of opaque adds; nested inside a DotMap it becomes the per-element store of an OR-Set.
A container of Dots, optionally each carrying a payload. The shapes — DotSet (presence), and later DotFun (dot → value) and DotMap (key → store) — all share the one causal join defined here in spirit; pairing any of them with a DotContext inside a Causal yields a full delta-state CRDT.
An entry in an EphemeralMap: a nullable value tagged with a per-replica monotonic clock.
A presence/awareness CRDT.
A stateful wrapper around EphemeralMap that stamps local receive times and drives TTL eviction.
A JSON scalar value held by a JsonNode.Leaf.
A multi-value register holding the value(s) last written. A single write yields one value; concurrent writes from different replicas are all retained until a later write observes and supersedes them — surfacing the conflict rather than silently picking a winner.
An observed-remove map: keys K each carry a Quilted value S that merges via its own Quilted.piece. A concurrent put of the same key survives a remove (add-wins on the key), and when both replicas hold the key the values are pieced together.
An entry of an ORMap: a DotSet of "presence tags" plus a Quilted value. The tag set is the observed-remove handle for the key; the value merges via its own Quilted.piece when both sides hold it.
An observed-remove (add-wins) set of E. Concurrent add and remove of the same element resolve in favour of the add: a remove only cancels the adds it has actually witnessed (the Dots currently on the element), so an add the remover never saw survives. This is the usable form of the dots + causal context machinery — e.g. a presence set of who is currently online.
Custom KSerializer for RgaOp<V> that correctly threads vSerializer through to RgaOp.Insert.value, bypassing the limitation in the compiler-generated sealed-class serializer where the V type parameter defaults to PolymorphicSerializer(Any::class).
A set with tombstoned remove: two grow-only sets, the added set and the removed (tombstone) set, both merged by union. An element is present iff it was added and is not tombstoned. Tombstones win permanently — once removed, an element can never be re-added; even a fresh add will be masked.
A per-author high-water version vector: replicaId → highest contiguous seq.