Skip to main content

SqliteStateMachine

Struct SqliteStateMachine 

Source
pub struct SqliteStateMachine { /* private fields */ }

Implementations§

Source§

impl SqliteStateMachine

Source

pub fn open( path: impl AsRef<Path>, cluster_id: &str, node_id: &str, epoch: u64, config_id: u64, ) -> Result<Self>

Source

pub fn open_with_configuration( path: impl AsRef<Path>, cluster_id: &str, node_id: &str, epoch: u64, configuration_state: ConfigurationState, ) -> Result<Self>

Source

pub fn open_existing(path: impl AsRef<Path>) -> Result<Self>

Source

pub fn close_for_handoff(self) -> Result<()>

Closes a detached state machine so another owner can reopen the canonical database.

SQLite may retain empty WAL sidecars after the last connection closes on some filesystems. Once the WAL is checkpointed and the connection is closed, those sidecars are owned crash artifacts and must be removed before the strict reopen validation.

Source

pub fn apply_entry(&self, entry: &LogEntry) -> Result<ApplyProgress>

Source

pub fn apply_entry_with_result(&self, entry: &LogEntry) -> Result<ApplyOutcome>

Source

pub fn get_value(&self, key: &str) -> Result<Option<String>>

Source

pub fn query_sql( &self, query: &SqlStatement, max_rows: usize, max_bytes: usize, ) -> Result<SqlQueryResult>

Source

pub fn query_sql_with_timeout( &self, query: &SqlStatement, max_rows: usize, max_bytes: usize, timeout: Duration, ) -> Result<SqlQueryResult>

Source

pub fn validate_sql_write(&self, command: &SqlCommand) -> Result<()>

Source

pub fn prepare_sql_batch_effect( &self, members: &[SqlBatchMember<'_>], base_index: LogIndex, base_hash: LogHash, ) -> Result<SqlBatchPreparation>

Prepares one physical QWAL v3 effect for the successful subset of an ordered SQL batch.

Each member runs inside its own savepoint nested under one outer SQLite transaction. A failed member is rolled back and reported at the same input position; later members still observe all prior successful members. Every successful member is bound into the effect as an ordered receipt template and is committed at the effect’s single log anchor.

Source

pub fn prepare_put_effect( &self, request_id: &str, key: &str, value: &str, request_payload: &[u8], base_index: LogIndex, base_hash: LogHash, ) -> Result<Vec<u8>>

Source

pub fn check_request( &self, request_id: &str, command_payload: &[u8], ) -> Result<Option<RequestOutcome>>

Source

pub fn connection_pragmas(&self) -> Result<(String, i64)>

Source

pub fn check_sql_request( &self, request_id: &str, command_payload: &[u8], ) -> Result<Option<(RequestOutcome, Option<SqlCommandResult>)>>

Source

pub fn check_sql_requests( &self, requests: &[(&str, &[u8])], ) -> Result<Vec<SqlRequestLookup>>

Checks unique SQL request ids with one bounded control-sidecar query.

Results preserve input order. A missing receipt is Ok(None), an exact receipt is decoded into its original outcome and result, and a digest conflict or invalid payload is returned in that member’s aligned slot. Duplicate request ids are rejected before querying; callers that accept aliases must deduplicate by id and fan the aligned result back out.

Source

pub fn applied_index_value(&self) -> Result<LogIndex>

Source

pub fn applied_hash_value(&self) -> Result<LogHash>

Source

pub fn applied_tip(&self) -> Result<ApplyProgress>

Returns the applied index and hash observed by one control-store snapshot.

Source

pub fn applied_tip_value(&self) -> Result<(LogIndex, LogHash)>

Source

pub fn configuration_state_value(&self) -> Result<ConfigurationState>

Source

pub fn embedded_log_entries( &self, from_index: LogIndex, through_index: LogIndex, ) -> Result<Vec<LogEntry>>

Source

pub fn compact_embedded_log_before(&self, anchor_index: LogIndex) -> Result<()>

Source

pub fn canonical_db_digest(&self) -> Result<LogHash>

Source

pub fn create_snapshot(&self, target: LogIndex) -> Result<Snapshot>

Source

pub fn create_recovery_snapshot( &self, recovery_generation: u64, ) -> Result<RecoverySnapshot>

Trait Implementations§

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.