Skip to main content

SqliteStore

Struct SqliteStore 

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

sqlite-backed durability store.

Implementations§

Source§

impl SqliteStore

Source

pub fn open<P: AsRef<Path>>(path: P, default_contract: Contract) -> Result<Self>

Opens (creating if absent) a sqlite store at path with WAL mode.

§Errors

sqlite open/pragma/schema failure.

Source

pub fn open_in_memory(default_contract: Contract) -> Result<Self>

In-memory sqlite store (tests / pure-TRANSIENT-via-sqlite).

§Errors

sqlite open/pragma/schema failure.

Trait Implementations§

Source§

impl DurabilityStore for SqliteStore

Source§

fn set_contract(&self, topic: &str, contract: Contract) -> Result<()>

Registers (or replaces) the retention Contract for topic. The daemon calls this when it starts serving a topic. Topics without an explicit contract use the store’s default (Contract::default). Read more
Source§

fn store(&self, sample: DurabilitySample) -> Result<()>

Persists sample durably, enforcing the topic contract. Returns StoreError::OutOfResources when a KEEP_ALL cap is hit. Read more
Source§

fn query(&self, topic: &str, selector: &Selector) -> Result<Page>

Returns one ordered Page of samples for topic matching selector. Ordering is (instance_key, sequence). Drive pagination via Page::next + Selector::after_cursor. Read more
Source§

fn unregister( &self, topic: &str, instance_key: &[u8; 16], now: SystemTime, ) -> Result<()>

Marks an instance as unregistered at now; its samples become eligible for purge after now + cleanup_delay (applied by cleanup). Read more
Source§

fn cleanup(&self, now: SystemTime) -> Result<usize>

Purges instances whose unregister time + cleanup-delay is <= now. Returns the number of purged instances. Read more
Source§

fn stats(&self, topic: &str) -> Result<StoreStats>

Aggregate counters for topic. Read more
Source§

fn replay_for_topic( &self, topic: &str, ) -> Result<Vec<DurabilitySample>, StoreError>

Convenience: drains the full contracted history for topic by paging through query. Prefer paged query for large contracts; this materializes everything into a Vec. 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, 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.