pub struct SqliteCheckpointer { /* private fields */ }Expand description
SQLite-backed graph checkpointer.
Stores graph state checkpoints in a local SQLite database file (or in-memory
for testing). Uses tokio::task::spawn_blocking to avoid blocking the async
runtime during SQLite operations.
§Example
use synaptic_sqlite::SqliteCheckpointer;
// File-based (persists across restarts)
let cp = SqliteCheckpointer::new("/var/lib/myapp/checkpoints.db")?;
// In-memory (for testing)
let cp = SqliteCheckpointer::in_memory()?;Implementations§
Source§impl SqliteCheckpointer
impl SqliteCheckpointer
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self, SynapticError>
pub fn new(path: impl AsRef<Path>) -> Result<Self, SynapticError>
Create a new checkpointer backed by a SQLite database file.
Sourcepub fn in_memory() -> Result<Self, SynapticError>
pub fn in_memory() -> Result<Self, SynapticError>
Create an in-memory checkpointer (useful for testing).
Trait Implementations§
Source§impl Checkpointer for SqliteCheckpointer
impl Checkpointer for SqliteCheckpointer
Source§fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
checkpoint: &'life2 Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
checkpoint: &'life2 Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save a checkpoint for the given thread.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a checkpoint. If
config.checkpoint_id is set, returns that specific
checkpoint; otherwise returns the latest checkpoint for the thread.Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 CheckpointConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all checkpoints for a thread, ordered oldest to newest.
Auto Trait Implementations§
impl Freeze for SqliteCheckpointer
impl RefUnwindSafe for SqliteCheckpointer
impl Send for SqliteCheckpointer
impl Sync for SqliteCheckpointer
impl Unpin for SqliteCheckpointer
impl UnsafeUnpin for SqliteCheckpointer
impl UnwindSafe for SqliteCheckpointer
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