TwoPhaseSet
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.
The pedagogical wart: tombstones grow without bound. The next rung up, ORSet, uses dots + causal context so an add issued after a remove can survive — at the cost of more bookkeeping.
Samples
var s = TwoPhaseSet.empty<String>()
s = s.piece(s.add("alice"))
check(s.contains("alice"))
s = s.piece(s.remove("alice"))
check(!s.contains("alice"))
// Even re-adding won't bring it back — the tombstone wins.
s = s.piece(s.add("alice"))
check(!s.contains("alice"))Content copied to clipboard
Properties
Functions
Link copied to clipboard
The causal Dots this state has delivered — (author, author-seq) per op.
Link copied to clipboard
The join: union both component sets.