Expand description
The shared SQL backend (sql feature): the NamespaceStore contract
implemented once over SQLite, on the tiny synchronous SqlConn
trait.
rusqlite and Durable Object SQLite can both implement SqlConn, so
a native backend and every
per-partition Durable Object run the same statements and the same
physical schema migrations. SQL is an internal detail of this
backend: nothing above NamespaceStore sees it.
Every statement stays within Durable Object limits: at most
MAX_BOUND_PARAMS bound parameters, and no transaction-control
statement (SqlConn::transaction owns atomicity).
Modules§
- schema
- The physical schema and its versioned, forward-only migrations.
Structs§
- Capacity
- A store’s size cap.
- SqlKv
Store - The
NamespaceStorecontract (andStoreMaintenance) over anySqlConn: full capabilities, every batch oneSqlConn::transaction. - Timer
Cursor - One raw timer-index row and the exclusive position for its successor.
Enums§
- SqlError
- Why a SQL call failed. The backend’s own message never reaches a client:
it is kept
Redactedfor the server-side log only. - SqlValue
- A bound parameter or a result column: the four storage classes both
rusqliteand Durable Object SQL bind (noREAL).
Constants§
- DEFAULT_
PAGE_ SIZE - The page size the default reserve assumes:
SQLite’s default and a Durable Object’s. A database with larger pages sets its reserve withCapacity::with_reserveandreserve_floor. - GET_
MANY_ CHUNK - Keys per
get_manystatement: one partition parameter plus this many keys stays far belowsuper::MAX_BOUND_PARAMS. - MAX_
BOUND_ PARAMS - Most bound parameters in one statement: the Durable Object SQL limit
(https://developers.cloudflare.com/durable-objects/platform/limits/).
SqlKvStorenever binds more. - RESERVE_
TREE_ DEPTH - The b-tree depth the reserve plans for.
- TIMER_
WINDOW_ AFTER - Resume strictly after an index position; no aggregation or implicit wrap.
- TIMER_
WINDOW_ START - Bounded first window over the existing timer index, including raw malformed keys.
Traits§
- SqlConn
- A synchronous SQL connection: a cheaply cloneable handle (
rusqlite: a shared, lockedConnection; a Durable Object: its storage handle).
Functions§
- batch_
growth_ bytes - The most one batch can grow a database with
page_size-byte pages (see the module docs). - reserve_
floor - The smallest safe reserve: two batches’ growth (a put batch that starts just below the soft limit, then a delete-only batch).
Type Aliases§
- Row
- One result row, its columns in select order.
- TxFn
- The transaction body
SqlConn::transactionruns: owned and'static.