omgbase-sync
The omgbase sync layer, Rust implementation of spec/sync: how bytes get
between an omgbase repository (an omgbase-store database) and the places
they live.
- Workspace (§1):
.omgbase/discovery by walking up,Workspace::open/find/locate(--workspace>OMGBASE_WORKSPACE> discovery), repos with their derived root path, andselect_repoas a pure function over[(slug, root_path)]+cwd+ an optional slug. - Registry (§2):
ensure_adapter,create_source(mintssrc),delete_source,attach/detach,sources_for_repo,ensure_repo(mintsrpand the<slug>-fssource),render_config_flagswith JavaScript stringification of scalars. - Settings (§3): the workspace layer and a repo's own blob,
deep_merge,resolve_settings. - Checkpoints and the filesystem fast path (§4): a
FileSystemseam (RealFileSystem,MemFileSystemfor fixtures — the walk visits each directory's entries in bytewise name order, depth-first),process_checkpoint,sweep_planas a pure function over thefile_statscache and a snapshot,freshness_sweep,record_file_stat,detect_disk_drift,rebuild_file_stats,recover_repo,repos_status,sync_status. - The adapter protocol (§5): the
SyncSourcetrait andExternalSource, which spawns an adapter withargs + render_config_flags(config)and the source'senvand speaks the NDJSON handshake / request / response protocol (ids from 1), with the watch stream on a channel.pipeoffers an in-memory pipe and a scripted adapter for driving it without a process. - Driver and coordinator (§6):
reconcile_changes,attach_source, theEngineClienttrait withInProcessEngineClientover the store (observe_many,observe_delete,changes_since,read_doc), andCoordinator::{sync_in, reconcile, sync_out, watch_in}. - Locks (§7):
WriterLock(O_EXCL, pid JSON, dead holders stolen, 25 ms poll / 5 s timeout) andWatchLease; liveness viakill(pid, 0).
use Config;
use Store;
use ;
let mut store = open?;
let repo = ensure_repo?;
let sweep = freshness_sweep?;
println!;
# Ok::
Conformance: tests/spec.rs runs every case under spec/sync/cases
(pure, registry, checkpoint, protocol — adapter transcripts over an
in-process pipe, coordinator scripts against a recording engine client),
gated by tests/spec-passing.txt while the port runs behind the fixtures.
The crate version tracks spec/sync/VERSION (1.1).
Unix only: lock-holder liveness uses kill(pid, 0).