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;
15#[cfg(feature = "bench-internals")]
16mod bench;
17pub mod client;
18/// §5.10.5 native CRDT helpers (the `crdt-yjs` feature) — the Rust face of the
19/// Yjs binding, mirroring `@syncular/crdt-yjs`. Off by default (dependency-lean).
20#[cfg(feature = "crdt-yjs")]
21pub mod crdt;
22/// Shared blocking HTTP/WebSocket host transport for Rust-backed bindings.
23/// The network stack is feature-gated; its no-network shape remains available
24/// in dependency-lean builds so host code needs only one transport type.
25pub mod native_transport;
26pub mod query_guard;
27pub mod realtime_round;
28pub mod remote;
29pub mod schema;
30pub mod transport;
31pub mod values;
32
33pub use api::{
34    creation_time_bucket, last, ClientChangeBatch, ClientDiagnosticsHost, ClientDiagnosticsLease,
35    ClientDiagnosticsReplica, ClientDiagnosticsRequest, ClientDiagnosticsSchema,
36    ClientDiagnosticsSnapshot, ClientDiagnosticsStorage, ClientLimits, CommandEffects,
37    CommitOperation, CommitOperationOutcome, CommitOutcome, CommitOutcomeQuery,
38    CommitOutcomeResolution, CommitOutcomeStatus, ConflictRecord, CoverageSnapshot,
39    DiagnosticLastChange, DiagnosticLastRound, DiagnosticRoundCounters, DiagnosticSubscription,
40    ExpectedDiagnosticSubscription, LocalDataPurgeInput, LocalDataPurgeResult,
41    LocalDataPurgeTarget, LocalDataRebootstrapInput, LocalDataRebootstrapResult, Mutation,
42    PresencePeer, QueryRow, QuerySnapshot, QueryValue, RejectionRecord, ResolveCommitOutcomeInput,
43    RowState, SchemaFloor, SubscriptionStateView, SyncIntent, SyncOutcome, SyncReport,
44    SyncStatusSnapshot, TableChange, TimeBucketUnit, WindowBase, WindowChange, WindowCoverage,
45    WindowState, WindowUnitRef, CLIENT_DIAGNOSTICS_VERSION, MAX_DIAGNOSTIC_EXPECTED_SUBSCRIPTIONS,
46};
47pub use client::{FileQuerySnapshotReader, SyncClient, SECURITY_PREFLIGHT_REQUIRED_CODE};
48pub use schema::{compile_schema, parse_schema_json, ClientSchema};
49pub use transport::{BlobDownload, BlobUploadGrant, SegmentRequest, Transport, TransportError};
50
51// Re-export the SSP2 stream scanner (§8.7 round-response reassembly) so the
52// native transports (FFI + Tauri plugin) reach it through their existing
53// `syncular-client` dependency, without each adding a direct `ssp2` path dep.
54pub use realtime_round::{RealtimeRound, RoundInbound, REALTIME_TAG_DELTA, REALTIME_TAG_ROUND};
55pub use remote::{
56    PreparedRemoteCommit, RemoteBytes, RemoteClientError, RemoteCommandResult, RemoteCommitInput,
57    RemoteCommitResult, RemoteQueryResult, SyncRemoteClient,
58};
59pub use ssp2::{MessageStreamScanner, ScannedMessage};