Expand description
Database merge engine for sync.
This is the shared core of every sync mode (directory, SSH, stdin/stdout):
merge one pxh database file into the live connection with deduplication,
optional secret filtering, an optional incremental watermark, and
unsealed-row upgrades. Callers own transport and presentation; this module
owns the merge semantics and reports what happened via MergeStats.
Structsยง
- Merge
Stats - What a merge did, for callers to present or assert on.
Constantsยง
- CHUNK_
SIZE ๐ - WRITE_
RETRY_ ๐BUDGET - Generous budget: sync is background work, so wait out long writers rather than failing the merge.
Functionsยง
- merge_
attached ๐ - Merge
other.command_history(already ATTACHed) into main. - merge_
database_ from_ file - Merge history from a database file into
conn, with an optional secret filter (rows whose command matches are skipped and counted) and an optional incremental-sync watermark (skip rows in the source whoseid <= watermark). The unsealed-row update always scans the whole source since seal info may sit at any id, watermark or not. - read_
only_ ๐uri file:URI that openspathread-only. Bytes outside the URI-safe set are percent-encoded so arbitrary (even non-UTF8) paths round-trip.- set_
sync_ watermark - Persist the watermark for a source machine. Call only after a fully successful merge: an interrupted merge must re-consider its rows.
- source_
columns ๐ - Column names of
other.command_history; empty when the table is absent. - sync_
watermark - Read the incremental-sync watermark recorded for a source machine, i.e.
the highest source
ida previous merge fully processed. - watermark_
key ๐