Rindle docs and package mapSkip to main content

WriteTxn

Struct WriteTxn 

Source
pub struct WriteTxn { /* private fields */ }
Expand description

An open write transaction on the single writer connection. Run ordinary SQL with exec/exec_batch; the preupdate hook captures row deltas. commit derives against a read-only pre-commit snapshot and batch overlay, commits SQL, then calls subscribers. Dropping without committing rolls back and delivers no events.

Implementations§

Source§

impl WriteTxn

Source

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

Run one statement with positional parameters inside the open transaction. Returns the number of rows changed. The preupdate hook captures the row deltas.

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 commit(self) -> Result<TxId, ReplicaError>

Commit: derive each query’s incremental change against the pre-commit snapshot, persist the tx watermark + COMMIT the durable data, then deliver Update::Changed to affected subscribers. Returns the new tx id.

Subscriber callbacks run synchronously after commit. A callback panic does not roll back the SQL transaction.

A transaction that exceeds the batch-delta memory budget still commits — it is shed (design 306 D4): the engine rebuilds and every query re-hydrates, subscribers receiving a replacing Update::Hydrated instead of Changed events (see CommitInfo::shed). Any other derive error aborts the transaction as before.

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 _rindle_client_mutations rows) feeds the engine; lmid flows to clients as ordinary query data (see crate::mutations).

Source

pub fn rollback(self)

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

Trait Implementations§

Source§

impl Drop for WriteTxn

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl MutationSql for WriteTxn

The SQL MutationTx flavor (design §4.2): a server mutator runs against the open single-writer transaction, reading through the same connection so it sees its own uncommitted writes.

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,