Skip to main content

max / synckit

2.2 KB · 53 lines History Blame Raw
1 //! Higher-level "syncable store" engine.
2 //!
3 //! `SyncStore` absorbs the SQLite plumbing every consuming app otherwise
4 //! hand-writes, the changelog schema and triggers, push/pull loops, FK-ordered
5 //! apply, HLC, blobs, and the scheduler, behind a declarative [`SyncSchema`].
6 //! An app declares its tables and per-table policy once; the engine owns the
7 //! mechanics. See `docs/architecture.md` ("Proposed: the `SyncStore` helper").
8 //!
9 //! Build status: **complete (B1–B7)**, schema types ([`schema`]), trigger/
10 //! migration generation ([`migrate`]), the DB seam + bookkeeping state ([`db`]),
11 //! the FK-ordered apply engine ([`apply`]), the HLC ledger + conflict dispatch
12 //! ([`hlc`]), the push/pull loops + lifecycle ([`sync`]), the blob engine
13 //! ([`blob`]), and the [`SyncStore`](facade::SyncStore) facade + scheduler
14 //! ([`facade`], [`scheduler`]).
15 //!
16 //! Start at [`SyncStore`](facade::SyncStore): declare a [`SyncSchema`](schema),
17 //! build a store, and call `sync_now` or `spawn_scheduler`.
18
19 pub mod apply;
20 pub mod blob;
21 #[cfg(feature = "store")]
22 pub mod config;
23 pub mod db;
24 pub mod facade;
25 pub mod hlc;
26 pub mod migrate;
27 pub mod scheduler;
28 pub mod schema;
29 pub mod sync;
30
31 pub use apply::{ApplyOutcome, apply_remote_changes};
32 pub use blob::{
33 BlobOutcome, BlobPolicy, BlobRef, BlobTransport, download_blobs, download_one, sync_blobs,
34 upload_blobs,
35 };
36 pub use config::{config_sync_table, install_policy};
37 pub use db::{
38 DbSource, clear_applying_remote, device_id, get_scope_cursor, get_sync_state,
39 get_sync_state_or, set_device_id, set_scope_cursor, set_sync_state, with_applying_remote,
40 };
41 pub use facade::{SchedulerHandle, SyncConfig, SyncOutcome, SyncStore, SyncStoreBuilder};
42 pub use hlc::{
43 committed_hlc, load_clock, observe, record_committed, resolve_pull, set_committed,
44 stamp_pending,
45 };
46 pub use scheduler::{NoopObserver, SyncObserver, SyncState};
47 pub use schema::{ConflictStrategy, DeleteMode, RowIdScheme, SyncMode, SyncSchema, SyncTable};
48 pub use sync::{
49 PUSH_BATCH_LIMIT, PullOutcome, SyncScope, SyncTransport, cleanup_changelog,
50 create_initial_snapshot, enforce_changelog_retention, ensure_device_registered, pull_changes,
51 pull_scope, push_changes, push_scope,
52 };
53