Rindle docs and package mapSkip to main content

ApplyTxn

Struct ApplyTxn 

Source
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

Source

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.

Source

pub fn store(&self) -> &ApplyStore

The store this transaction is open on.

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_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.

Source

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.

Source

pub fn is_open(&self) -> bool

Whether the underlying writer transaction is still open (neither finished by this handle nor auto-aborted by SQLite).

Source

pub fn captured_user_event_count(&self) -> usize

How many user-table row events the capture hook has recorded this transaction.

Source

pub fn next_tx_id(&self) -> TxId

The tx id this transaction will commit as.

Source

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.

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_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.

Source

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.

Source

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.

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 — 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.

Source

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.

Source

pub fn rollback(self)

Explicitly roll back. Delivers nothing; a live pool’s views are untouched.

Trait Implementations§

Source§

impl Drop for ApplyTxn

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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,