pub struct ClusterWriteTxn { /* private fields */ }Expand description
An open write transaction on the cluster’s single writer connection. Run SQL
with exec/exec_batch; commit
runs the snapshot/commit handshake. Workers can deliver provisional changes while
SQL is still running. Dropping rolls back SQL; if chunks were already streamed,
affected queries fault and need a new registration. See ClusterEvent.
A thin wrapper over the apply plane’s ApplyTxn carrying the cluster’s fan-out
(design 309 §3): the state machine — capture pumping, the barriers, the commit
guards — is ONE implementation shared with the headless applier.
Implementations§
Source§impl ClusterWriteTxn
impl ClusterWriteTxn
Sourcepub fn exec(
&mut self,
sql: &str,
params: &[OwnedValue],
) -> Result<usize, ReplicaError>
pub fn exec( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<usize, ReplicaError>
Run one statement with positional parameters inside the open transaction.
Sourcepub fn exec_batch(&mut self, sql: &str) -> Result<(), ReplicaError>
pub fn exec_batch(&mut self, sql: &str) -> Result<(), ReplicaError>
Run a batch of statements (no parameters) inside the open transaction.
Sourcepub fn query(
&mut self,
sql: &str,
params: &[OwnedValue],
) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>
pub fn query( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>
Run a read through the open transaction (sees its own uncommitted writes — the
read-dependent mutator contract, §4.1), each cell mapped from its raw SQLite storage
class. The MutationSql query flavor for the parallel write path.
Sourcepub fn query_with_cols(
&mut self,
sql: &str,
params: &[OwnedValue],
) -> Result<(Vec<String>, Vec<Vec<OwnedValue>>), ReplicaError>
pub fn query_with_cols( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<(Vec<String>, Vec<Vec<OwnedValue>>), ReplicaError>
query, additionally reporting the result’s column names in order —
what a network front needs to answer a mutator-session read ({cols, rows} on the
wire, zipped client-side; DAEMON-INTERACTIVE-TXN-DESIGN.md §4.1). Same open-transaction
read-your-writes semantics and raw-storage-class cell mapping.
Sourcepub fn commit(self) -> Result<TxId, ReplicaError>
pub fn commit(self) -> Result<TxId, ReplicaError>
Finish capture, wait for worker snapshot acknowledgments, then commit SQL and
its watermark. Returns the transaction ID without waiting for every derived
event to reach the receiver. Workers may already have sent provisional changes;
release them only after their Progressed markers confirm the commit.
Sourcepub fn commit_with_info(self) -> Result<CommitInfo, ReplicaError>
pub fn commit_with_info(self) -> Result<CommitInfo, ReplicaError>
commit, additionally reporting the transaction’s CommitInfo —
the cv to stamp on outgoing batches.
The whole capture — INCLUDING any _rindle_client_mutations rows — fans out to the
workers: the lmid table is engine-hosted like any base table, so a client’s lmid
advance derives through its own system query and is released by the same cv_min
as the commit’s data (no metadata side-channel to race). An empty capture still
crosses the worker barrier: it has no data to derive, but every worker must emit
Progressed(N) so an older live query cannot pin a later query’s seq-0 snapshot
below its hydrate CV forever.
Trait Implementations§
Source§impl MutationSql for ClusterWriteTxn
The SQL MutationTx flavor (design §4.2) for the parallel write path — a server mutator
runs against the open cluster transaction, reading through the same connection so it
sees its own uncommitted writes (and lower-mid mutations’ effects). Mirrors the
single-thread impl MutationSql for WriteTxn.
impl MutationSql for ClusterWriteTxn
The SQL MutationTx flavor (design §4.2) for the parallel write path — a server mutator
runs against the open cluster transaction, reading through the same connection so it
sees its own uncommitted writes (and lower-mid mutations’ effects). Mirrors the
single-thread impl MutationSql for WriteTxn.
Source§fn exec(
&mut self,
sql: &str,
params: &[OwnedValue],
) -> Result<usize, ReplicaError>
fn exec( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<usize, ReplicaError>
Source§fn query(
&mut self,
sql: &str,
params: &[OwnedValue],
) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>
fn query( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>
INTEGER → Int, REAL → Float, TEXT → Str, NULL → Null; BLOB is
an error). Raw classes, not the engine’s number-widening coercion — the
mutator is writing SQL, not feeding the pipeline.