rindle_wire/lib.rs
1//! # rindle-wire — the normalized subscription protocol
2//!
3//! The wire vocabulary of Rindle Realtime's "both wires, one protocol" rule
4//! (`RINDLE-REALTIME-DESIGN.md` thesis + §4): the same normalized subscription is spoken
5//! client←room and room←`rindled`, so its types live in one crate that every party
6//! depends on — the native daemons (`rindle-replica`, `rindle-server`) on the emit
7//! side, the room (`rindle-room-core`) on both sides, and, twinned in TypeScript,
8//! `@rindle/remote` on the client. Three layers, one per module:
9//!
10//! - [`normalize`] — the fold: one transaction's engine changes → deduplicated,
11//! table-tagged [`normalize::NormalizedOp`]s (the payload).
12//! - [`normalize_protocol`] — the envelope: the once-per-subscription
13//! [`normalize_protocol::NormalizedHello`], seq-0 snapshot, gap-free
14//! [`normalize_protocol::NormalizedBatch`]es; fingerprint, epoch/seq validation.
15//! - [`wire_json`] — the JSON rendering the sockets actually carry (bare cells,
16//! camelCase, f64-safe counters, hex fingerprints) — byte-for-byte what
17//! `@rindle/remote` validates. The golden wire vectors are pinned here.
18//!
19//! Beside the frame layers sits [`query_key`] — the canonical query identity every
20//! materialization map dedups by (`rindled`'s manager and the room's
21//! materialize-on-presentation), so both ends of a wire agree on "the same query" —
22//! and [`family_key`], the same construction over a query's **template** (its root
23//! equality literals punched into holes), which is how the daemon recognizes the V
24//! subscriptions that differ only in a literal as one parameterized query family
25//! (design 310).
26//!
27//! **This crate must stay wasm-clean** — the same discipline as the root `rindle`
28//! crate: std-only, no C-toolchain/SQLite deps, no threads. And it holds **no
29//! transport**: sockets and IO belong to the hosts (`rindle-server`, the Node shell,
30//! the DO). The gate is `cargo check -p rindle-wire --target wasm32-unknown-unknown`;
31//! keep it green.
32
33pub mod family_key;
34pub mod normalize;
35pub mod normalize_protocol;
36pub mod query_key;
37pub mod wire_json;
38
39#[cfg(kani)]
40mod kani_proofs;