Skip to main content

syncular_client/
lib.rs

1//! # syncular-client — Syncular v2 Rust client core (POC stage 2)
2//!
3//! A clean-room client implementation of the SPEC.md client-behavior
4//! contract on rusqlite local storage, consuming the committed `ssp2`
5//! codec as its wire layer. Built without reading the v1 Rust tree or the
6//! v2 TypeScript client — the conformance catalog (packages/conformance)
7//! is the proof that both cores implement one written protocol.
8//!
9//! The API is synchronous request/response: the host drives `sync()` /
10//! `sync_until_idle()` and feeds inbound realtime traffic through
11//! `on_realtime_text` / `on_realtime_binary`. Scheduling is host policy
12//! (§8.4); the core exposes the coalesced `sync_needed` signal only.
13
14pub mod api;
15pub mod client;
16/// §5.10.5 native CRDT helpers (the `crdt-yjs` feature) — the Rust face of the
17/// Yjs binding, mirroring `@syncular/crdt-yjs`. Off by default (dependency-lean).
18#[cfg(feature = "crdt-yjs")]
19pub mod crdt;
20/// Shared blocking HTTP/WebSocket host transport for Rust-backed bindings.
21/// The network stack is feature-gated; its no-network shape remains available
22/// in dependency-lean builds so host code needs only one transport type.
23pub mod native_transport;
24pub mod query_guard;
25pub mod realtime_round;
26pub mod remote;
27pub mod schema;
28pub mod transport;
29pub mod values;
30
31pub use api::{
32    creation_time_bucket, last, ClientChangeBatch, ClientDiagnosticsHost, ClientDiagnosticsLease,
33    ClientDiagnosticsReplica, ClientDiagnosticsRequest, ClientDiagnosticsSchema,
34    ClientDiagnosticsSnapshot, ClientDiagnosticsStorage, ClientLimits, CommandEffects,
35    CommitOperation, CommitOperationOutcome, CommitOutcome, CommitOutcomeQuery,
36    CommitOutcomeResolution, CommitOutcomeStatus, ConflictRecord, CoverageSnapshot,
37    DiagnosticLastChange, DiagnosticLastRound, DiagnosticRoundCounters, DiagnosticSubscription,
38    ExpectedDiagnosticSubscription, LocalDataPurgeInput, LocalDataPurgeResult,
39    LocalDataPurgeTarget, LocalDataRebootstrapInput, LocalDataRebootstrapResult, Mutation,
40    PresencePeer, QueryRow, QuerySnapshot, QueryValue, RejectionRecord, ResolveCommitOutcomeInput,
41    RowState, SchemaFloor, SubscriptionStateView, SyncIntent, SyncOutcome, SyncReport,
42    SyncStatusSnapshot, TableChange, TimeBucketUnit, WindowBase, WindowChange, WindowCoverage,
43    WindowState, WindowUnitRef, CLIENT_DIAGNOSTICS_VERSION, MAX_DIAGNOSTIC_EXPECTED_SUBSCRIPTIONS,
44};
45pub use client::{FileQuerySnapshotReader, SyncClient, SECURITY_PREFLIGHT_REQUIRED_CODE};
46pub use schema::{compile_schema, parse_schema_json, ClientSchema};
47pub use transport::{BlobDownload, BlobUploadGrant, SegmentRequest, Transport, TransportError};
48
49// Re-export the SSP2 stream scanner (§8.7 round-response reassembly) so the
50// native transports (FFI + Tauri plugin) reach it through their existing
51// `syncular-client` dependency, without each adding a direct `ssp2` path dep.
52pub use realtime_round::{RealtimeRound, RoundInbound, REALTIME_TAG_DELTA, REALTIME_TAG_ROUND};
53pub use remote::{
54    PreparedRemoteCommit, RemoteBytes, RemoteClientError, RemoteCommandResult, RemoteCommitInput,
55    RemoteCommitResult, RemoteQueryResult, SyncRemoteClient,
56};
57pub use ssp2::{MessageStreamScanner, ScannedMessage};