Skip to main content

Module sync

Module sync 

Source
Expand description

Epic S3: personal brain sync — event-log replication.

Structs§

ExportSummary
Summary returned by export_events.
ImportSummary
Summary returned by import_events.
SyncCursors
Per-source cursor state persisted at .kimetsu/sync-cursors.json.
SyncEvent
One line in a sync JSONL batch. Carries the full event so the remote projector can replay it. payload is the redacted payload (same redaction the projector applies at ingest).
SyncReport
Summary of a full sync cycle.
SyncStatus
Status of the sync configuration and state.

Functions§

atomic_write
Write data to path atomically via a sibling temp file + rename.
export_events
Export durable events from conn after since_rowid (exclusive).
import_events
Import a JSONL batch (one SyncEvent per line) into conn.
import_events_from_file
Read a JSONL batch file and import it.
is_sync_allowed
Returns true when kind is allowed in a sync batch.
max_local_sync_rowid
The max rowid among all rows in the local events table with an allowed kind. This is what we compare against the stored export cursor to decide whether there’s anything new to push.
pull_machine_batches
Pull and import all batches from <sync_dir>/<source_machine_id>/ that come AFTER since_cursor. Updates the cursor in the registry.
push_machine_batch
Write this machine’s new events as a JSONL batch under <sync_dir>/<machine_id>/<cursor>.jsonl (atomic write).
sync_conflict_count
Slice B: count unresolved concurrent-supersede conflicts surfaced by team sync (a member superseded to two different survivors). Deterministic across brains; shown by kimetsu brain sync --status.
sync_dir
Full sync cycle:
sync_status
Compute the sync status without performing any writes.