Skip to main content

Module protocol

Module protocol 

Source
Expand description

The statement protocol the main thread speaks to the SQL worker (docs/persistence.md). Both sides link this module (the day-persistence proxy driver encodes requests and decodes replies; the worker loop does the reverse), so the wire format cannot drift. Everything is little-endian, length-prefixed, and version-tagged; the JS shuttle between them moves opaque bytes and never parses them (oversized replies are chunked JS-side, invisible here).

Structs§

WireError
A truncated or malformed buffer. Both sides treat it as a protocol bug, not user error.

Enums§

Reply
The worker’s answer. Err carries the SQLite (or pool) message.
Req
One request from the main thread. Connection ids are worker-assigned.
Value
A SQL value on the wire: the same five kinds SQLite itself has.

Constants§

VERSION
First byte of every request; bumped only if the format ever changes shape.

Functions§

decode_reply
decode_req
encode_reply
encode_req