Skip to main content

SqliteThingStore

Struct SqliteThingStore 

Source
pub struct SqliteThingStore { /* private fields */ }
Available on crate feature sqlite only.
Expand description

SQLite-backed memory store.

Implementations§

Source§

impl SqliteThingStore

Source

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

Open a SQLite database file and initialize the schema.

§Errors

Returns an error when SQLite cannot open the path or initialize schema.

Source

pub fn open_in_memory() -> ThingdResult<Self>

Open an in-memory SQLite database and initialize the schema.

§Errors

Returns an error when SQLite cannot initialize schema.

Source

pub fn schema_version(&self) -> ThingdResult<u32>

Return the latest applied SQLite schema version.

§Errors

Returns an error when the migration metadata cannot be read.

Source

pub fn wal_checkpoint(&self) -> ThingdResult<(i32, i32)>

Run PRAGMA wal_checkpoint(TRUNCATE) to flush the WAL into the main database.

Returns (frames_before, frames_after) where frames_after should be 0 when the checkpoint fully succeeds.

§Errors

Returns an error when SQLite fails to run the checkpoint.

Source

pub fn close(&self) -> ThingdResult<()>

Close the database connection after running a WAL checkpoint.

§Errors

Returns an error when the checkpoint fails.

Source

pub fn backup_to(&self, path: &str) -> ThingdResult<()>

Create a consistent snapshot backup using VACUUM INTO.

The backup file will contain all data at the current point in time. The file can be opened with any SQLite client.

§Errors

Returns an error when the destination path cannot be written.

Trait Implementations§

Source§

impl EventLog for SqliteThingStore

Source§

fn append_event(&mut self, event: MemoryEvent) -> ThingdResult<MemoryEvent>

Append an event to a stream. Read more
Source§

fn append_events_batch( &mut self, events: Vec<MemoryEvent>, ) -> ThingdResult<Vec<MemoryEvent>>

Append multiple events to a stream in a single transaction. Read more
Source§

fn list_events( &self, stream: Option<&str>, options: ListEventsOptions, ) -> ThingdResult<Vec<MemoryEvent>>

List events, optionally filtered by stream, with pagination. Read more
Source§

fn count_events(&self) -> ThingdResult<u64>

Count total events across all streams. Read more
Source§

fn list_streams(&self) -> ThingdResult<Vec<String>>

List all unique stream names. Read more
Source§

fn delete_last_event( &mut self, stream: &str, ) -> ThingdResult<Option<MemoryEvent>>

Delete the most recent event from a stream. Read more
Source§

fn delete_stream(&mut self, stream: &str) -> ThingdResult<u64>

Delete all events in a stream. Read more
Source§

impl LinkStore for SqliteThingStore

Create a new graph link. Read more
Delete a graph link by id. Read more
Get a graph link by id. Read more
Source§

fn get_neighbors( &self, reference: &str, direction: LinkDirection, options: LinkQueryOptions, ) -> ThingdResult<Vec<Link>>

Get neighbors of a reference (outgoing, incoming, or both). Read more
Count total links. Read more
Source§

impl ObjectStore for SqliteThingStore

Source§

fn put_object(&mut self, object: MemoryObject) -> ThingdResult<MemoryObject>

Insert or replace an object. Read more
Source§

fn put_objects_batch( &mut self, objects: Vec<MemoryObject>, ) -> ThingdResult<Vec<MemoryObject>>

Insert or replace multiple objects in a single transaction. Read more
Source§

fn put_object_with_options( &mut self, object: MemoryObject, options: PutObjectOptions, ) -> ThingdResult<MemoryObject>

Insert or replace an object with explicit options. Read more
Source§

fn get_object( &self, collection: &str, id: &str, ) -> ThingdResult<Option<MemoryObject>>

Read an object by collection and id. Read more
Source§

fn list_objects( &self, collections: Option<&[String]>, options: &ListObjectsOptions, ) -> ThingdResult<Vec<MemoryObject>>

List objects in one or more collections, with optional filtering, limit, and offset. Read more
Source§

fn delete_object(&mut self, collection: &str, id: &str) -> ThingdResult<bool>

Delete an object by collection and id. Read more
Source§

fn delete_objects_batch( &mut self, keys: &[(String, String)], ) -> ThingdResult<u64>

Delete multiple objects in a single transaction. Read more
Source§

fn count_objects(&self) -> ThingdResult<u64>

Count total objects across all collections. Read more
Source§

fn list_collections(&self) -> ThingdResult<Vec<String>>

List all unique collection names. Read more
Source§

impl QueueStore for SqliteThingStore

Source§

fn push_job(&mut self, job: QueueJob) -> ThingdResult<QueueJob>

Push a job onto a queue. Read more
Source§

fn push_jobs_batch( &mut self, jobs: Vec<QueueJob>, ) -> ThingdResult<Vec<QueueJob>>

Push multiple jobs onto a queue in a single transaction. Read more
Source§

fn claim_job_with_options( &mut self, queue: &str, options: QueueClaimOptions, ) -> ThingdResult<Option<QueueJob>>

Claim the next ready job from a queue with explicit options. Read more
Source§

fn ack_job(&mut self, queue: &str, id: &str) -> ThingdResult<Option<QueueJob>>

Acknowledge a leased job as completed. Read more
Source§

fn claim_and_ack( &mut self, queue: &str, options: QueueClaimOptions, ) -> ThingdResult<Option<QueueJob>>

Claim and immediately ack a job in a single transaction. Read more
Source§

fn nack_job_with_options( &mut self, queue: &str, id: &str, options: QueueNackOptions, ) -> ThingdResult<Option<QueueJob>>

Reject a leased job for retry or dead-letter routing with explicit options. Read more
Source§

fn list_jobs(&self, queue: &str) -> ThingdResult<Vec<QueueJob>>

List all jobs in a queue. Read more
Source§

fn list_dead_jobs(&self, queue: &str) -> ThingdResult<Vec<QueueJob>>

List dead-letter jobs in a queue. Read more
Source§

fn list_queues(&self) -> ThingdResult<Vec<String>>

List all unique queue names. Read more
Source§

fn count_active_jobs(&self) -> ThingdResult<u64>

Count total active jobs across all queues. Read more
Source§

fn count_dead_jobs(&self) -> ThingdResult<u64>

Count total dead-letter jobs across all queues. Read more
Source§

fn claim_job(&mut self, queue: &str) -> ThingdResult<Option<QueueJob>>

Claim the next ready job from a queue. Read more
Source§

fn nack_job(&mut self, queue: &str, id: &str) -> ThingdResult<Option<QueueJob>>

Reject a leased job for retry or dead-letter routing. Read more
Source§

impl Searcher for SqliteThingStore

Source§

fn search( &self, query: &str, options: SearchOptions, ) -> ThingdResult<Vec<SearchHit>>

Search memory objects and event logs by query text. 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> ThingStore for T

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.