-
You move a card
The browser applies the change immediately and posts the operation to
/api/sync/messages. Some function instance picks it up. It
has no memory of you, so it rebuilds your session, reads the board out
of the bucket, and applies your op.
-
It lands in the bucket
The instance writes one immutable wal/ object containing the
batch, then compare-and-swaps the _manifest object to point
at it. The swap is what makes the write real — until the manifest names
your segment, nothing reads it.
-
Your ack comes back on the same request
Not down the event stream. That stream is held open by a
different instance, which has no way to reach into this one — so
replies ride home in the response to the POST that caused them.
-
Everyone else finds out
Each open tab has its own instance holding an SSE stream. Four times a
second it fetches the manifest — one small read. If the commit counter
moved, it pulls the new segments, re-runs the board query, and pushes
the difference to that tab.
What's actually in the bucket
rooms/demo/_manifest
rooms/demo/wal/writer-a3f-7.jsonl
rooms/demo/wal/writer-91c-2.jsonl
rooms/demo/snap/0-4.json
The manifest is small, mutable and the only thing ever overwritten.
Everything else is written once and never touched again, which is what
makes it safe for many readers at once. When the segment list grows
long, a snapshot folds them into one object so a cold board still opens
in a couple of reads.
There is no lock
Two people editing at once means two instances writing at once. Each
writes its own uniquely-named segment, so they cannot overwrite each
other, and then both try to swap the manifest. One wins. The loser is
told its version was stale, re-reads, reapplies its change on top and
tries again.
That single conditional write is the only thing keeping the board
consistent — no lease, no leader election, no coordination service.
What it costs
- A batch of edits
- 1 write + 1 conditional write
- An open tab
- ~4 small reads per second
- A board nobody has open
- nothing at all
Idle costs nothing because there is nothing running: no lease to renew,
no connection to keep warm, no instance sitting on the board.