Structures

Complexity Advanced

Observed-remove set

The TwoPSet hid Bob's replacement camera forever. This time, Alice removes the old Eagle Creek camera while Bob reports its replacement from another trail. Carol still has an older notebook and may receive their notes in either order. All three notebooks must keep the replacement without restoring the old camera.

A removed camera has a rounded tag, while a replacement camera strapped to a tree has a diamond tag; the notebook retains separate records.

A replacement needs a new identity

Alice's original report gave the old camera a dot: A:1. A dot combines the writer's replica ID with a local counter.

Before the hikers lose contact, both Bob and Carol receive Alice's A:1 note. They copy it into their additions pages and record 1 as the highest dot counter seen. Carol makes no later change, so her notebook remains a stale copy of that original state. Losing contact stops new notes; it does not erase what anyone already wrote.

Alice finds the old camera gone and removes Eagle Creek. The only Eagle Creek dot she has seen is A:1, so she copies the pair Eagle Creek A:1 onto her removals page.

Bob has not seen Alice's removal. He adds the replacement. Each hiker's next counter is one more than the highest counter they have seen from any writer, so Bob's replacement gets B:2, not B:1. An observed-remove set removes only the dots the remover has seen.

Each additions-page row pairs a camera name with its dot. Each removals-page row is a tombstone: it copies the same pair, so an old note cannot restore that installation. The notebook also keeps the highest dot counter seen.

Before contact is lost

Alice's original note has reached all three notebooks.

Notebook Additions page Removals page Highest dot counter seen Visible list
Alice Eagle CreekA:1
empty 1 Eagle CreekA:1
Bob Eagle CreekA:1
empty 1 Eagle CreekA:1
Carol Eagle CreekA:1
empty 1 Eagle CreekA:1

While notes are blocked

Alice records the removal while Bob records the replacement. Carol still has the earlier page.

Notebook Additions page Removals page Highest dot counter seen Visible list
Alice empty Eagle CreekA:1
1 empty
Bob Eagle CreekA:1
Eagle CreekB:2
empty 2 Eagle CreekA:1B:2
Carol Eagle CreekA:1
empty 1 Eagle CreekA:1

After every note arrives

All three notebooks retain the replacement dot and the old dot's removal.

Notebook Additions page Removals page Highest dot counter seen Visible list
Alice Eagle CreekB:2
Eagle CreekA:1
2 Eagle CreekB:2
Bob Eagle CreekB:2
Eagle CreekA:1
2 Eagle CreekB:2
Carol Eagle CreekB:2
Eagle CreekA:1
2 Eagle CreekB:2

Three field notebooks

Keep the replacement, not the old camera

Alice removes the installation she observed while Bob concurrently installs a replacement under a fresh identity.

Merge rule Remove observed dots; keep concurrent fresh dots.

Alice

Eagle Creek is active

Additions page
Eagle Creek: A:1

Highest dot counter seen 1

Visible camera list

Eagle Creek A:1

Checkpoint note Remove observed dot A:1

Bob

Eagle Creek is active

Additions page
Eagle Creek: A:1

Highest dot counter seen 1

Visible camera list

Eagle Creek A:1

Checkpoint note Add Eagle Creek as B:2

Carol

Eagle Creek is active

Additions page
Eagle Creek: A:1

Highest dot counter seen 1

Visible camera list

Eagle Creek A:1

Checkpoint note No note in this race

Trail relay No ordering decision 0 notes shared

Mechanism evidence A:1 is the live old installation.

  1. No notes shared yet.

Enable JavaScript to run the demo. The starting state and expected result remain in the lesson.

The old Eagle Creek installation is active. Race its removal against Bob's replacement.

The concurrent replacement wins

Alice had not seen B:2 when she removed the old camera, so her removal applies only to A:1, the dot she had seen. Bob's concurrent addition survives. This is the set's add-wins rule.

The visible value is still Eagle Creek, but the surviving B:2 dot identifies Bob's replacement, not the old camera.

An old note is not a fresh addition

Save Alice's original Eagle Creek addition. Remove that observed addition everywhere, then replay exactly the saved note.

The membership-only toy resurrects the old camera. Retained causal context keeps the original addition removed.

NotebookToy model: discard removal evidenceObserved-remove set
Alice Eagle Creek Eagle Creek
Bob Eagle Creek Eagle Creek
Carol Eagle Creek Eagle Creek

Ready: both paths have the same starting input.

Inspect the decision evidence

Toy model: discard removal evidence

Intentional toy: remember only current membership; a delayed add is accepted again.

Observed-remove set

Saved operation tags: [{"value":"Eagle Creek","tags":[{"replicaId":"A","counter":1}]}]; retained removals: [[],[],[]]

Enable JavaScript to run the comparison. The starting state and expected lesson remain above.

Removal records pile up

This OR-set keeps A:1's removal record after the live dot disappears. The demo does not garbage-collect tombstones. If Alice discarded that record while an old note, snapshot, or returning replica could reintroduce A:1, the old camera could reappear. What causal metadata costs explains the storage cost and what safe cleanup requires.

The in-depth sheet and lab let you temporarily block notes between Alice and Bob, preserve a stale copy, exchange the conflicting deltas, and inspect the live dots and tombstones.

Open the in-depth observed-remove set sheet and lab

The next lesson, LWWRegister, moves from a list to a single answer: is the Eagle Creek trail open?

Sources and implementation

Sources: Watershed's OR-set kernel. The observed-remove set is described in A comprehensive study of Convergent and Commutative Replicated Data Types.

Implementation: The demo calls the Watershed kernel through the site's Gleam toolkit. The trail relay carries notes without ordering them.