pub struct SqliteStore { /* private fields */ }Expand description
Durable Troupekit store over one SQLite file in WAL mode. Cheap to clone; clones share one connection. Every call runs on tokio’s blocking pool, so it needs a tokio runtime. A caller that stops waiting does not stop the call: it runs to its commit or rollback.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Source§impl SqliteStore
impl SqliteStore
Sourcepub async fn vectors(
&self,
name: &str,
settings: VectorSettings,
) -> Result<SqliteVectors, CoreError>
pub async fn vectors( &self, name: &str, settings: VectorSettings, ) -> Result<SqliteVectors, CoreError>
Opens the vector index name, creating it on first use.
Input: a name of 1 to 64 chars in [a-z0-9_] and its settings.
Output: a handle, CoreError::DimensionMismatch when the stored
index has other dims, or CoreError::Store for bad settings.
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn builder(path: impl AsRef<Path>) -> SqliteStoreBuilder
pub fn builder(path: impl AsRef<Path>) -> SqliteStoreBuilder
Starts a builder for the file at path with every setting at its
default. Input: the file path. Output: the builder; nothing is
opened until open.
Trait Implementations§
Source§impl BlobStore for SqliteStore
impl BlobStore for SqliteStore
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
bytes: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl CheckpointStore for SqliteStore
impl CheckpointStore for SqliteStore
fn save<'life0, 'async_trait>(
&'life0 self,
cp: Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn latest<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn history<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn history<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the kept checkpoints of
run_id, lowest step first.
The default lists latest as zero or one checkpoint, which is
exact for a store that keeps only the latest step.Source§fn prune<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
keep_last: u64,
) -> Pin<Box<dyn Future<Output = Result<u64, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prune<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
keep_last: u64,
) -> Pin<Box<dyn Future<Output = Result<u64, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes all but the
keep_last highest steps of run_id and returns
how many it deleted. The latest step is never deleted, so save keeps
its next-step rule. keep_last == 0 returns CoreError::Store.
The default deletes nothing.Source§impl Clone for SqliteStore
impl Clone for SqliteStore
Source§impl Debug for SqliteStore
impl Debug for SqliteStore
Source§impl JobQueue for SqliteStore
impl JobQueue for SqliteStore
fn enqueue<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
due_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn claim_due<'life0, 'async_trait>(
&'life0 self,
limit: usize,
lease_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Lease>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 Lease,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fail<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
lease: &'life1 Lease,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn reschedule<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 Lease,
due_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl MemoryLog for SqliteStore
impl MemoryLog for SqliteStore
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
log: &'life1 str,
expected_len: u64,
entries: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<u64, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
log: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl UsageLedger for SqliteStore
impl UsageLedger for SqliteStore
fn period_total<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
usage: Usage,
) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteStore
impl !UnwindSafe for SqliteStore
impl Forget for SqliteStore
impl Freeze for SqliteStore
impl Move for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl UnsafeUnpin for SqliteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more