Apply compatible DB sync batches

This commit is contained in:
Eric Wendland 2026-05-19 19:02:39 +02:00
commit 43433dbf1d
8 changed files with 185 additions and 26 deletions

View file

@ -151,10 +151,12 @@ extract read-only typed change batches from `crsql_changes` with schema metadata
through `db changes`. As a staged network path, `geth db sync <node-id> <name>`
uses the protected Iroh control ALPN to request remote typed change batches when
the caller has `db.sync` on the remote `resource:db:<name>`. The requester
checks remote schema metadata against its local DB before advancing its
per-peer/per-DB cursor. Loading cr-sqlite and applying remote changes through
`crsql_changes` are future work; the current path exchanges and cursors changes
but does not mutate the local application database.
checks remote schema metadata against its local DB before applying changes and
advancing its per-peer/per-DB cursor. Compatible remote batches are inserted
into the local `crsql_changes` table or view before the cursor advances.
Loading/configuring the cr-sqlite extension for real application databases
remains the database owner's responsibility; the bootstrap tests use
deterministic fixture tables.
`geth-kv` currently provides a SQLite-backed local fallback for named KV stores
through `kv create/set/get`. `kv set --subject <principal>` evaluates local auth

View file

@ -438,7 +438,11 @@ Automerge documents.
- `[x]` Background live-sync runs DB sync for local DB resources and known
peers.
- `[x]` Per-peer/per-DB high-water cursors are stored in `module_state`.
- `[ ]` Apply compatible remote changes through cr-sqlite.
- `[x]` Extracted batches are exposed through `geth db changes`.
- `[x]` Compatible remote batches are inserted into the local
`crsql_changes` table or view before advancing the cursor.
- `[x]` Tests cover typed batch application into deterministic fixture
`crsql_changes` tables.
- `[ ]` Add an integration test with a real cr-sqlite-enabled SQLite DB that
proves two local test nodes exchange and apply changes.
- `[ ]` Optional CAS-backed snapshots or batches are documented if used.