pub struct SqliteRunTraceStore { /* private fields */ }Expand description
SQLite-backed persistent RunTraceStore.
Open with SqliteRunTraceStore::open (file path — typically the
SAME path as the SqliteRunStore) or
SqliteRunTraceStore::open_in_memory (tests). Both return the
store plus an AsyncIsleDriver the caller must shutdown().await
when done.
Implementations§
Source§impl SqliteRunTraceStore
impl SqliteRunTraceStore
Sourcepub async fn open(
path: impl AsRef<Path>,
) -> Result<(Self, AsyncIsleDriver), TraceStoreError>
pub async fn open( path: impl AsRef<Path>, ) -> Result<(Self, AsyncIsleDriver), TraceStoreError>
Open (or create) a SQLite database file and ensure the
run_trace table exists. Safe to point at the file another
store already owns — CREATE TABLE IF NOT EXISTS never touches
foreign tables.
Sourcepub async fn open_in_memory() -> Result<(Self, AsyncIsleDriver), TraceStoreError>
pub async fn open_in_memory() -> Result<(Self, AsyncIsleDriver), TraceStoreError>
Open an ephemeral in-memory database (tests, doctests).
Sourcepub fn with_max_events_per_run(self, max: usize) -> Self
pub fn with_max_events_per_run(self, max: usize) -> Self
Override the per-Run retention ceiling (tests).
Trait Implementations§
Source§impl RunTraceStore for SqliteRunTraceStore
impl RunTraceStore for SqliteRunTraceStore
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
draft: TraceEventDraft,
) -> Pin<Box<dyn Future<Output = Result<TraceEvent, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
draft: TraceEventDraft,
) -> Pin<Box<dyn Future<Output = Result<TraceEvent, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append one event to
run_id’s stream, assigning the next seq
and stamping ts_ms. The store caps draft.payload via
cap_payload and prunes the oldest rows beyond the per-Run
retention ceiling. Appending to an unknown run_id is legal —
the trace rail has no foreign-key coupling to RunStore (a
trace writer must never fail because Run-row creation raced it).Source§fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
query: &'life2 TraceQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<TraceEvent>, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
query: &'life2 TraceQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<TraceEvent>, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
List
run_id’s events matching query, ascending by seq.Source§fn delete_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
) -> Pin<Box<dyn Future<Output = Result<u64, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_run<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 RunId,
) -> Pin<Box<dyn Future<Output = Result<u64, TraceStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete every event belonging to
run_id, returning the number
of deleted events. Deleting an unknown/empty Run is Ok(0).Auto Trait Implementations§
impl Freeze for SqliteRunTraceStore
impl RefUnwindSafe for SqliteRunTraceStore
impl Send for SqliteRunTraceStore
impl Sync for SqliteRunTraceStore
impl Unpin for SqliteRunTraceStore
impl UnsafeUnpin for SqliteRunTraceStore
impl UnwindSafe for SqliteRunTraceStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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