pub trait SessionLog:
Send
+ Sync
+ 'static {
// Required methods
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
events: &'life2 [GraphEvent],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn load_since<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
cursor: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<GraphEvent>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn archive_before<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
watermark: u64,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Persistent durable session-event log.
SessionGraph::events is the in-memory shape; this trait is the
durable companion that survives process restarts. A SessionGraph
can be hydrated from a SessionLog by replaying every event the
log returns for key.
Every method is keyed by ThreadKey, the canonical
(tenant_id, thread_id) tuple — a backend cannot accidentally
drop the tenant scope because the tenant component is
syntactically required by the type signature. Same isolation
pattern that entelix_graph::Checkpointer uses (Invariant 11 /
F2).
Required Methods§
Sourcefn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
events: &'life2 [GraphEvent],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
events: &'life2 [GraphEvent],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append events for key. Returns the highest ordinal
assigned (1-based, so an empty log becomes ordinal 1 after
appending the first event).
Sourcefn load_since<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
cursor: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<GraphEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_since<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
cursor: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<GraphEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load every event with ordinal > cursor. Pass 0 for “from
the beginning”. Returns events in ordinal-ascending order.
Sourcefn archive_before<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
watermark: u64,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn archive_before<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ThreadKey,
watermark: u64,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Advance the archival watermark to watermark. Events with
ordinal <= watermark may be moved to cold storage at the
implementation’s discretion. Returns the number of events
archived. The watermark is monotonic per key; calls with
a value <= the current watermark are no-ops.