pub struct ApplyTxn { /* private fields */ }Expand description
An open write transaction on the store’s single writer connection. See the module
docs; the derivation host’s ClusterWriteTxn is a thin public wrapper over this.
Implementations§
Source§impl ApplyTxn
impl ApplyTxn
Sourcepub fn begin(
store: Rc<ApplyStore>,
fanout: Rc<dyn CommitFanout>,
) -> Result<ApplyTxn, ReplicaError>
pub fn begin( store: Rc<ApplyStore>, fanout: Rc<dyn CommitFanout>, ) -> Result<ApplyTxn, ReplicaError>
Open the single-writer transaction (the store’s writer_begin_sql flavor).
Errors if one is already open.
Sourcepub fn store(&self) -> &ApplyStore
pub fn store(&self) -> &ApplyStore
The store this transaction is open on.
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_bounded(
&mut self,
sql: &str,
params: &[OwnedValue],
guarded: bool,
) -> Result<usize, StatementRunError>
pub fn exec_bounded( &mut self, sql: &str, params: &[OwnedValue], guarded: bool, ) -> Result<usize, StatementRunError>
Run one mutation statement under the shared writer time/VM budget and, for guarded public
mutations, the reserved-object authorizer. This is the bounded twin of exec
used by a standalone daemon’s write plane; it still pumps capture between statements.
Sourcepub fn public_statement(
&mut self,
request: &SqlStatementRequest,
preserve_on_error: bool,
result_byte_limit: usize,
) -> Result<StatementResult, StatementRunError>
pub fn public_statement( &mut self, request: &SqlStatementRequest, preserve_on_error: bool, result_byte_limit: usize, ) -> Result<StatementResult, StatementRunError>
Run one v1 public-SQL statement through the shared classifier/authorizer and writer budget. Interactive calls request a savepoint so ordinary statement failures preserve the surrounding transaction; one-shot batches let their coordinator roll the whole unit back.
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Whether the underlying writer transaction is still open (neither finished by this handle nor auto-aborted by SQLite).
Sourcepub fn captured_user_event_count(&self) -> usize
pub fn captured_user_event_count(&self) -> usize
How many user-table row events the capture hook has recorded this transaction.
Sourcepub fn next_tx_id(&self) -> TxId
pub fn next_tx_id(&self) -> TxId
The tx id this transaction will commit as.
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
The open transaction’s connection for narrow host bookkeeping helpers. Anything written here still passes through the capture hook (the hook is on the connection), so application rows written raw are counted — but hosts should stay on the typed mutation methods and keep this for unregistered bookkeeping.
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_text: &str,
params: &[OwnedValue],
) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>
pub fn query( &mut self, sql_text: &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.
Sourcepub fn query_with_cols(
&mut self,
sql_text: &str,
params: &[OwnedValue],
) -> Result<(Vec<String>, Vec<Vec<OwnedValue>>), ReplicaError>
pub fn query_with_cols( &mut self, sql_text: &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>
Commit: run the fan-out’s begin-barrier, persist the watermark + COMMIT the durable data, then release the gate. Returns the new tx id.
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 — flows to the
fan-out: on the live replica 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 barrier: it has no data to derive, but on the live replica 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.
Sourcepub fn commit_metadata_only(self) -> Result<(), ReplicaError>
pub fn commit_metadata_only(self) -> Result<(), ReplicaError>
Commit host-local metadata when the public SQL unit captured no application effects.
This deliberately does not mint a TxId: the retained outcome has cursor = NULL, and
no progress boundary exists for a metadata-only cache write.