Skip to main content

Module sync

Module sync 

Source
Expand description

linkmarks sync — multi-device sync via yrs-encoded payload.

Status: preview / dry-run only. The local state encoding and the wire format are validated; the actual POST /v1/sync round-trip is pending in the relay binary.

What this subcommand does today:

  1. Open the local SQLite store.
  2. List every bookmark (store::Store::list with high limit).
  3. Build a per-collection yrs::Doc. Bookmarks are grouped by Bookmark::collection so each collection is a self-contained sub-doc — clients merge independently and the relay can serve a single collection without unpacking the whole library.
  4. Encode each sub-doc via yrs::encode_state_as_update_v1.
  5. Print a summary table: collection name, bookmark count, encoded bytes, hash (FNV-1a-64). No HTTP, no write to store, no write to disk outside the optional --out-dir.

--out-dir <PATH>: write each sub-doc’s encoded bytes to <PATH>/<collection_slug>.ydoc.bin so the operator can inspect them (e.g. xxd, wc -c, lz4 <file> to see the post-LZ4 wire size).

Exit codes:

  • 0: dry-run completed, dry-run report printed.
  • 1: store not initialized (run linkmarks init first).
  • 2: bad args.

This subcommand is the pre-merge validation hook: running linkmarks sync --dry-run on a freshly-imported library must produce the same encoded size (within LZ4 compression tolerance) as a real linkmarks sync --remote <relay> once the relay binary ships.

Structs§

SyncArgs

Functions§

run