Skip to main content

SqliteStore

Struct SqliteStore 

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

Rows keyed by (doc_id, sid, time_start), whose operations are immutable. Rows stay pending until their actor prefix is contiguous and their dependencies are stored. A field without history keeps each actor’s newest write to it in pulsify_values, overwritten in place: the sequence numbers of the writes it replaces hold nothing, and spans are computed when rows are read.

Implementations§

Source§

impl SqliteStore

Source

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

Opens or creates a durable database file (WAL, synchronous FULL).

Source

pub fn open_in_memory() -> Result<Self>

Source

pub fn new(db: Connection) -> Result<Self>

Installs the schema on an existing connection.

Source

pub fn mark_deleted(&mut self, doc_id: &str, frames: &[Vec<u8>]) -> Result<()>

Retain local recovery data and permanently block the prefix, in one transaction.

Source

pub fn connection(&self) -> &Connection

Source

pub fn append(&mut self, rows: &[PatchRow]) -> Result<AppendResult>

Validates and stores rows of one document in one IMMEDIATE transaction. Retransmissions are ignored; a conflict rolls back the whole batch.

Source

pub fn vector(&self, doc_id: &str) -> Result<VersionVector>

Source

pub fn missing( &self, doc_id: &str, remote: &VersionVector, ) -> Result<Vec<PatchRow>>

Ready rows the peer lacks, ordered by actor and clock.

Source

pub fn sync_state( &mut self, doc_id: &str, remote: &VersionVector, ) -> Result<(Vec<PatchRow>, VersionVector)>

missing and vector from one consistent snapshot.

Trait Implementations§

Source§

impl DocumentStore for SqliteStore

Source§

fn is_deleted(&self, doc_id: &str) -> Result<bool>

Source§

fn delete_documents( &mut self, doc_id: &str, preserve_rows: bool, ) -> Result<usize>

Source§

fn recover_rows(&self, doc_id: &str) -> Result<Vec<PatchRow>>

Source§

fn documents( &self, doc_id: &str, after: &str, limit: usize, ) -> Result<Vec<String>>

Source§

impl PatchStore for SqliteStore

Source§

type Error = Error

Carries a Pulsify protocol error code, like Error.
Source§

fn append(&mut self, rows: &[PatchRow]) -> Result<AppendResult>

Validates and stores rows of one document atomically. Retransmissions are ignored, whatever their span; a conflict (other operations at a stored identity, or an actor fork) stores nothing.
Source§

fn vector(&self, doc_id: &str) -> Result<VersionVector>

Source§

fn missing(&self, doc_id: &str, remote: &VersionVector) -> Result<Vec<PatchRow>>

Ready rows the peer lacks, ordered by actor and clock.
Source§

fn sync_state( &mut self, doc_id: &str, remote: &VersionVector, ) -> Result<(Vec<PatchRow>, VersionVector)>

missing and vector from one consistent snapshot.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.