pub struct SQLiteCheckpointer { /* private fields */ }sqlite only.Expand description
Durable SQLite checkpointer that retains the full step history.
Storage grows with session count and step depth. For long-lived deployments
use periodic SQL maintenance — for example, delete steps older than N days
or keep only the most recent M steps per session, then VACUUM.
Implementations§
Source§impl SQLiteCheckpointer
impl SQLiteCheckpointer
Sourcepub async fn connect(database_url: &str) -> Result<Self, CheckpointerError>
pub async fn connect(database_url: &str) -> Result<Self, CheckpointerError>
Open (or create) a SQLite database at database_url and return a ready checkpointer.
When the sqlite-migrations feature is enabled (default), embedded migrations
are applied automatically (idempotent).
Example URL: "sqlite://weavegraph.db"
Source§impl SQLiteCheckpointer
impl SQLiteCheckpointer
Sourcepub async fn query_steps(
&self,
session_id: &str,
query: StepQuery,
) -> Result<StepQueryResult>
pub async fn query_steps( &self, session_id: &str, query: StepQuery, ) -> Result<StepQueryResult>
Query the full step history for a session with optional filters and pagination.
Results are ordered by step number descending. limit defaults to 100 and
is capped at 1 000. The total record count before pagination is reported in
PageInfo::total_count.
§Example
use weavegraph::runtimes::checkpointer_sqlite::{SQLiteCheckpointer, StepQuery};
let cp = SQLiteCheckpointer::connect("sqlite://app.db").await?;
let result = cp.query_steps("my-session", StepQuery {
limit: Some(25),
min_step: Some(10),
..Default::default()
}).await?;
println!("{} total, {} on page", result.page_info.total_count, result.page_info.page_size);Sourcepub async fn save_with_concurrency_check(
&self,
checkpoint: Checkpoint,
expected_last_step: Option<u64>,
) -> Result<()>
pub async fn save_with_concurrency_check( &self, checkpoint: Checkpoint, expected_last_step: Option<u64>, ) -> Result<()>
Save a checkpoint only when sessions.last_step equals expected_last_step.
Pass None to skip the check (equivalent to Checkpointer::save).
§Example
use weavegraph::runtimes::checkpointer_sqlite::SQLiteCheckpointer;
let cp = SQLiteCheckpointer::connect("sqlite://app.db").await?;
cp.save_with_concurrency_check(checkpoint, Some(4)).await?;Trait Implementations§
Source§impl Checkpointer for SQLiteCheckpointer
impl Checkpointer for SQLiteCheckpointer
Source§fn save<'life0, 'async_trait>(
&'life0 self,
checkpoint: Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
checkpoint: Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn load_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
None if absent.Auto Trait Implementations§
impl !RefUnwindSafe for SQLiteCheckpointer
impl !UnwindSafe for SQLiteCheckpointer
impl Freeze for SQLiteCheckpointer
impl Send for SQLiteCheckpointer
impl Sync for SQLiteCheckpointer
impl Unpin for SQLiteCheckpointer
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more