Structures

GSet

The ranger sends Alice, Bob, and Carol onto separate trails to list every beacon they find. Their first rule is simple: they can add names to the survey, but they cannot remove them.

Alice reports Eagle Creek

Alice finds the Eagle Creek beacon and adds its name to her notebook. Bob and Carol are out of radio range. They still have empty lists.

Each notebook stores a set of names. At this moment Alice has { Eagle Creek }, while Bob and Carol each have {}. No hiker has a global survey yet.

A GSet only adds members. When the hikers exchange their notebooks, each replica keeps the union of every name it has seen.

MomentAliceBobCarol
Alice reportsEagle Creekemptyempty
Report deliveredEagle CreekEagle CreekEagle Creek
Old copy repeatsEagle CreekEagle CreekEagle Creek
Union keeps one member even when the network delivers Alice's report more than once.
local members ∪ remote members

Three field notebooks

Combine the hikers' reports

Alice and Bob report different beacons while Carol waits. Exchange the records and watch every notebook keep the same union.

Merge rule Keep every distinct reported name.

Alice

No reports yet

Visible beacon list

Empty set

Checkpoint note Additions page: Eagle Creek

Bob

No reports yet

Visible beacon list

Empty set

Checkpoint note Additions page: Ridge Pass

Carol

No reports yet

Visible beacon list

Empty set

Checkpoint note No note in this race

Trail relay No ordering decision 0 records shared

Mechanism evidence Entries can only accumulate.

  1. No records shared yet.

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

Run the survey race, or let any hiker report a beacon.

Then the ranger needs an active list

Alice returns to Eagle Creek and finds that the old beacon has been taken down. The ranger no longer wants a record of every beacon ever observed. The ranger needs the beacons that are active now, but Alice has no valid GSet entry she can write to mean “remove Eagle Creek.”

A GSet cannot express that change. Removing the name locally would not be monotonic, and Carol's delayed copy could restore it. The next set adds permanent removal evidence instead of deleting history.

Sources and implementation

Watershed's GSet kernel uses set union for confirmed, optimistic, and peer-to-peer state.