Skip to main content

RusqliteEngine

Struct RusqliteEngine 

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

Rusqlite-backed OLTP engine.

Uses a single dedicated write connection for DML/DDL and a round-robin pool of read connections for queries. WAL mode is enabled on startup so readers don’t block the writer.

Implementations§

Source§

impl RusqliteEngine

Source

pub async fn new_local( path: &str, read_pool_size: usize, ) -> Result<RusqliteEngine, RusqliteOltpError>

Create a new engine backed by a local SQLite database file.

read_pool_size controls how many concurrent read connections are maintained. Values below 1 are clamped to 1.

Source

pub async fn new_connection(&self) -> Result<Connection, RusqliteOltpError>

Create a fresh, independent connection to the same database file.

Used to give RusqliteCdcProducer its own connection that doesn’t compete with application reads/writes.

Source

pub fn connection(&self) -> Connection

Returns a clone of the write connection handle. Used by CDC trigger setup/teardown (DDL).

Trait Implementations§

Source§

impl OltpEngine for RusqliteEngine

Source§

async fn query( &self, sql: &str, params: &[Value], ) -> Result<Vec<RecordBatch>, <RusqliteEngine as OltpEngine>::Error>

Execute a read-only SQL query and return the results as Arrow RecordBatches.

Dispatches to the next connection in the round-robin read pool. The Arrow schema is inferred from actual cell values (see the SCHEMA_WARMUP_ROWS constant for the sparse-column strategy).

§Errors

Returns RusqliteOltpError if statement preparation, execution, or Arrow conversion fails.

Source§

async fn execute( &self, sql: &str, params: &[Value], ) -> Result<u64, <RusqliteEngine as OltpEngine>::Error>

Execute a single write statement (INSERT, UPDATE, DELETE, or DDL) and return the number of rows affected.

Always dispatches to the single dedicated write connection.

§Errors

Returns RusqliteOltpError if the statement fails (e.g., constraint violation, syntax error, or the database is locked beyond busy_timeout).

Source§

async fn execute_batch( &self, statements: &[(String, Vec<Value>)], ) -> Result<(), <RusqliteEngine as OltpEngine>::Error>

Execute a batch of write statements inside a single BEGINCOMMIT transaction.

All statements succeed or the entire transaction is rolled back. Dispatches to the dedicated write connection.

§Errors

Returns RusqliteOltpError if any statement fails or the transaction cannot be committed.

Source§

async fn table_exists( &self, table_name: &str, ) -> Result<bool, <RusqliteEngine as OltpEngine>::Error>

Return true if a table named table_name exists in sqlite_master.

Uses a read-pool connection.

§Errors

Returns RusqliteOltpError if the metadata query fails.

Source§

type Error = RusqliteOltpError

Engine-specific error type returned by all fallible methods.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,