GSet
Alice, Bob, and Carol hike separate trails and list every wildlife camera 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 camera and adds its name to her notebook. Bob and Carol have not found her note yet, so their lists are still empty.
A GSet only adds members. When a note arrives, the hiker adds every name on it to their notebook; a name they already have is not added again. The notebook keeps the union of every name the hiker has seen.
| Moment | Alice | Bob | Carol |
|---|---|---|---|
| Alice reports | Eagle Creek | empty | empty |
| Report delivered | Eagle Creek | Eagle Creek | Eagle Creek |
| Old copy repeats | Eagle Creek | Eagle Creek | Eagle Creek |
If Bob reports Ridge Pass at the same time, the order of arrival does not matter: every notebook ends with both names.
Three field notebooks
Combine the hikers' reports
Alice and Bob report different cameras 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 camera list
Checkpoint note Report: Eagle Creek
Bob
No reports yet
Visible camera list
Checkpoint note Report: Ridge Pass
Carol
No reports yet
Visible camera list
Checkpoint note No note in this race
Mechanism evidence Entries can only accumulate.
- No notes 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 camera.
Names cannot be removed
Alice returns to Eagle Creek and finds that the old camera has been taken down. The hikers now need a list of active cameras, but a GSet cannot express “remove Eagle Creek.” If Alice erased the name from her notebook, Carol's older note, which still lists Eagle Creek, would add it back at the next merge.
The next lesson, TwoPSet, records removals on a second page instead of erasing names.
Sources and implementation
Sources: Watershed's GSet kernel. The grow-only 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.