Rindle docs and package mapSkip to main content

ClusterWriteTxn

Struct ClusterWriteTxn 

Source
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

Source

pub fn exec( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<usize, ReplicaError>

Run one statement with positional parameters inside the open transaction.

Source

pub fn exec_batch(&mut self, sql: &str) -> Result<(), ReplicaError>

Run a batch of statements (no parameters) inside the open transaction.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn rollback(self)

Explicitly roll back. Leaves every view untouched; delivers nothing.

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.

Source§

fn exec( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<usize, ReplicaError>

Run one statement with positional parameters; returns rows changed.
Source§

fn query( &mut self, sql: &str, params: &[OwnedValue], ) -> Result<Vec<Vec<OwnedValue>>, ReplicaError>

Run a read returning all rows, each cell mapped from its raw SQLite storage class (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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,