Expand description
§syncular-command — one JSON command surface over the Rust client core
The command router the conformance shim proved (JSON in, JSON out, bytes
as {"$bytes": hex}) factored into a transport-agnostic module so BOTH
the stdio conformance shim AND the FFI native core dispatch through the
same code. That keeps a single command surface, conformance-locked via
the shim: whatever the shim exercises, the FFI core inherits.
The router is generic over the Transport seam. The shim binds it to a
stdio host (transport inverted to the harness); the FFI crate binds it to
a real native HTTP+WS transport. Everything host-specific — realtime
notification draining, deferred requests, event queues — stays in each
host; only the pure method → result dispatch (and its JSON parsing) is
shared here.
Structs§
- Command
Error - The structured failure the driver protocol carries in an
error.detailsandretryablecarry the typed mutation fields to the host; non-mutation failures leave both at their defaults. - Create
Effects - Parsed side effects of a
createcommand that the host must apply to its own transport/clock (the router stays transport-agnostic). The client is already installed into theOption<SyncClient>slot bydispatch. - Snapshot
Read Params - The parsed
snapshotReadparams (§7.5), owned so a host can move them to its read thread.
Functions§
- bytes_
value - diagnostics_
event - The privacy-safe diagnostics event for
client, orNonewhile a security preflight is pending, the snapshot fails, or its state (excluding capture time) equalslast. Stores the emitted snapshot inlast. - dispatch
- Dispatch one command against the client instance over
transport. - error_
envelope - The
{"code","message","retryable"[,"details"]}object every host sends as theerrorof a failed command. - parse_
headers - Parse an
activateSecurity(or rotation)headersparam: an object of string values, replacing the transport’s FULL header set. The router validates the shape at the shared chokepoint; each host applies the parsed set to its own transport (the router stays transport-agnostic). - parse_
mutations - parse_
query_ owner - §7.5 owner:
{id, tables}, both required when present. Shared byquerySnapshotandsnapshotRead. - parse_
snapshot_ read - Parse and validate the params of
snapshotRead; shared by the router and the Tauri read sidecar. - parse_
window_ coverage - §7.5: parse a
coveragearray of{base, units}entries. Absent or null is empty; a non-array, a malformed base, or non-string units are rejected explicitly instead of silently defaulting. Shared with the Tauri plugin’s read sidecar. - presence_
event - A well-formed presence control frame (§8.6.2), the one inbound realtime
event a native host surfaces as an event: a fanout, or the server’s refusal
of this client’s own publish, which carries the server’s
errorcode. - reply
- The application-facing
{"result"}/{"error"}reply of a native host. The router’seffectsare consumed by the host and never leave it. - value_
bytes