Live sync JSON documents over Iroh

This commit is contained in:
Eric Wendland 2026-05-18 18:49:34 +02:00
commit 284207eb01
8 changed files with 370 additions and 7 deletions

View file

@ -153,7 +153,12 @@ exposed to remote peers.
`geth-document` currently registers local document resources and stores
validated JSON state in the local SQLite metadata store through
`document create/status/set/get`. This is a bootstrap editing surface, not yet
Automerge CRDT state. Automerge state encoding and sync are future work.
Automerge CRDT state. `geth document sync <node-id> <name>` can pull remote JSON
state over the protected Iroh control ALPN when the peer grants `document.read`
on `resource:document:<name>`. The daemon background live-sync loop runs the same
sync for local documents and known peers using per-peer/per-document cursors.
The import rule is last-writer-wins by document timestamp. Automerge state
encoding and sync are future work.
`geth-pubsub` currently supports local publish/subscribe snapshots through the
daemon control protocol. Messages live in a bounded in-memory ring buffer and

View file

@ -390,12 +390,17 @@ Automerge documents.
state.
- `[x]` Tests cover create, update, save, and reload of local JSON document
state.
- `[x]` `geth document sync <node-id> <name>` pulls authorized JSON state
from an imported peer over Iroh.
- `[x]` Background live-sync refreshes local JSON documents from known peers
using per-peer/per-document cursors.
- `[ ]` Automerge document state is stored durably.
- `[ ]` Tests cover Automerge create, update, save, and reload.
- `[ ]` Automerge sync over Iroh.
Acceptance criteria:
- Two local test nodes can synchronize document changes.
- `[x]` Bootstrap JSON last-writer-wins sync works across two local test
nodes over Iroh.
- Resource authorization gates read/write sync.
- Conflicts converge according to Automerge semantics.