Rindle docs and package mapSkip to main content

ReadConn

Struct ReadConn 

pub struct ReadConn { /* private fields */ }
Expand description

A read-only connection for the daemon’s raw-read path. See the module docs for why this is separate from the coordinator’s read-write reader.

Implementations§

§

impl ReadConn

pub fn open(path: impl AsRef<Path>) -> Result<ReadConn, ReplicaError>

Open a read-only connection at path with the default READ_TIME_BUDGET / READ_ROW_CAP. The file must already exist (a read-only connection cannot create it), so open this only after the writer has created + initialized the database.

pub fn open_with_limits( path: impl AsRef<Path>, time_budget: Duration, row_cap: usize, ) -> Result<ReadConn, ReplicaError>

Like open but with explicit budgets (tests drive tiny budgets to exercise the interrupt / row-cap paths deterministically).

pub fn open_with_budgets( path: impl AsRef<Path>, time_budget: Duration, vm_budget: u64, row_cap: usize, ) -> Result<ReadConn, ReplicaError>

Like open_with_limits, with an explicit VM-instruction budget. Exposed primarily for deterministic boundary tests and per-SKU configuration.

pub fn flush_prepared_statement_cache(&self)

Drop cached prepared statements after a committed schema boundary. SQLite may defer an automatic reprepare until the first step, which is too late for callers that inspect column metadata immediately after prepare.

pub fn committed_tx_id(&self) -> Result<u64, ReplicaError>

The standalone WAL2 authority’s latest durable commit watermark. Public read fences compare their canonical w:<16-hex> session cursor against this value on the read connection, so the check observes committed state without entering (or waiting behind) the writer queue.

pub fn begin_snapshot(&self) -> Result<u64, ReplicaError>

Open a stable read snapshot and return the committed-write watermark it observes. Under wal2 a reader holds its snapshot BESIDE the single writer, so a caller can page a multi-statement report through one consistent view while writes keep committing — this is what backs a standalone daemon’s read-only public transaction without occupying the writer.

BEGIN alone is deferred; the __replica_meta watermark read both MATERIALIZES the snapshot (pinning it at the current committed head) and returns the exact TxId the session-cursor fence compares against, so fence and snapshot cannot disagree. On a failed watermark read the transaction is rolled back before the error returns.

A held snapshot pins wal2 checkpointing for its whole lifetime — callers MUST bound it (the daemon caps concurrent snapshot sessions and reaps them at the session deadline).

pub fn end_snapshot(&self)

Release the open snapshot (idempotent; a read-only transaction’s commit and rollback are the same operation). Statement errors — including a watchdog SQLITE_INTERRUPT — can abort the transaction underneath us, so this rolls back only if one is still open.

pub fn snapshot_open(&self) -> bool

Whether a begin_snapshot transaction is still open. SQLite may abort it wholesale on a statement error; callers must check before advertising an open transaction to their client.

pub fn read_sql( &self, sql: &str, params: &[OwnedValue], ) -> Result<SqlReadRows, ReplicaError>

Run one raw read under the time budget + row cap and return its columns and rows. A bad statement / type error surfaces as Err (never a panic); a budget overrun surfaces as an interrupted Sqlite; too many rows as ReadRejected.

pub fn execute_statement( &self, request: &SqlStatementRequest, ) -> Result<StatementResult, StatementRunError>

Execute one statement through the public SQL result surface. The file handle is physically read-only and the shared classifier is checked before prepare, so transaction control and readonly-but-stateful statements cannot smuggle through this path.

pub fn execute_statement_batch( &self, requests: &[SqlStatementRequest], ) -> Result<Vec<StatementResult>, StatementRunError>

Execute an all-read batch against one committed snapshot. The transaction is always rolled back (read-only), including when a statement fails.

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,