Skip to main content

Crate syncular_client

Crate syncular_client 

Source
Expand description

§syncular-client — Syncular v2 Rust client core (POC stage 2)

A clean-room client implementation of the SPEC.md client-behavior contract on rusqlite local storage, consuming the committed ssp2 codec as its wire layer. Built without reading the v1 Rust tree or the v2 TypeScript client — the conformance catalog (packages/conformance) is the proof that both cores implement one written protocol.

The API is synchronous request/response: the host drives sync() / sync_until_idle() and feeds inbound realtime traffic through on_realtime_text / on_realtime_binary. Scheduling is host policy (§8.4); the core exposes the coalesced sync_needed signal only.

Re-exports§

pub use api::ClientLimits;
pub use api::ConflictRecord;
pub use api::Mutation;
pub use api::PresencePeer;
pub use api::RejectionRecord;
pub use api::RowState;
pub use api::SchemaFloor;
pub use api::SubscriptionStateView;
pub use api::SyncOutcome;
pub use api::SyncReport;
pub use api::WindowBase;
pub use client::SyncClient;
pub use schema::compile_schema;
pub use schema::parse_schema_json;
pub use schema::ClientSchema;
pub use transport::BlobDownload;
pub use transport::BlobUploadGrant;
pub use transport::SegmentRequest;
pub use transport::Transport;
pub use transport::TransportError;
pub use realtime_round::RealtimeRound;
pub use realtime_round::RoundInbound;
pub use realtime_round::REALTIME_TAG_DELTA;
pub use realtime_round::REALTIME_TAG_ROUND;

Modules§

api
Driver-facing API shapes (JSON-able), mirroring the conformance ClientInstance contract: sync reports, conflicts, rejections, row states, subscription states. Serialized as camelCase to cross the shim boundary unchanged.
client
The Syncular v2 Rust client core (SPEC.md client-behavior contract): rusqlite local storage, §3.2/§3.3 effective-scope persistence + purge, §4 pull/cursor/bootstrap (§4.7 resume, §5.6 segment application), §6 push with outbox order, §7 optimistic apply / rollback / replay-on-top, §2.3 clientCommitId idempotency, §8 realtime client rules, §10 errors.
realtime_round
Transport-agnostic §8.7 sync-round-over-socket framing.
schema
Client schema IR (SPEC.md §2.4) — the same JSON shape the conformance fixture uses (DriverSchema): tables with typed columns, a primary key, and §3.1 scope patterns ('prefix:{variable}', column defaults to the variable name).
transport
The transport seam handed TO the client by its host (the conformance harness, an app shell, …). Bytes and strings only — mirroring the ClientEndpoints inversion of the conformance driver contract. The client is synchronous: the driver protocol is request/response.
values
Value conversions at the client’s edges: driver JSON ({"$bytes": hex} convention) ↔ the §2.4 row-codec values ↔ SQLite storage, plus the §11.2 canonical scope JSON (contractual across implementations).

Structs§

MessageStreamScanner
Feed bytes, learn exactly where one complete SSP2 envelope ends.
ScannedMessage
A completed scan: the exact envelope bytes plus any surplus buffered past the END frame.