Structures
LWWMap
The hikers still share named fields, but the ranger's delivery order no longer defines “last.” Every key includes its own clock and writer evidence.
A clock for each key
An LWWMap compares metadata for each key independently. A newer timestamp can take precedence over a write that the server delivers later. At equal time, a tombstone takes precedence over a value, then writer ID breaks a set/set tie.
max(timestamp, tombstone, writer ID)Three field maps
Merge timestamped gate settings
Alice and Bob write the same key. Every replica applies the same per-key timestamp rule instead of trusting arrival order.
Conflict rule Use the greatest timestamp; equal-time ties use removal and writer metadata.
Alice
Empty map
- No entries
Map-edit slip gate-status: Trail open timestamp from writer A
Bob
Empty map
- No entries
Map-edit slip gate-status: Trail closed timestamp from writer B
Carol
Empty map
- No entries
Map-edit slip No slip in this race Carol observes delivery
Mechanism evidenceNo race delivered yet.
- No operations shared yet.
Enable JavaScript to run the demo. The race and expected result remain in the lesson.
Run the authored race, or let any hiker edit a local map.
“Last” depends on the clock
A fast clock can defeat a later human action. Tombstones must remain until the system can safely forget them. Use this map only when a deterministic single winner is worth those costs.
Sources and implementation
The demo uses Watershed's LWWMap kernel and runtime-issued per-key clocks.