pub trait RuntimeSessionPersistence: Send + Sync {
// Required method
fn save_runtime_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn append_token_usage_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
json_line: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Port for runtime (non-authoritative) session persistence.
Implementors must:
- Serialize concurrent saves per session ID.
- Merge on-disk authoritative metadata (
title,pinned,title_version,metadata_version) before writing, so UI edits are never clobbered.
Required Methods§
Sourcefn save_runtime_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn save_runtime_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Persist the session, merging any newer authoritative metadata from disk.
Provided Methods§
Sourcefn append_token_usage_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
json_line: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn append_token_usage_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
json_line: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Append one JSON-line analysis record to the session’s append-only
token-usage log (see Storage::append_token_usage_record). Defaults to
a no-op so non-file-backed persisters are unaffected.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl RuntimeSessionPersistence for LockedSessionStore
Infrastructure implementation of the domain runtime-persistence port.
Server should assemble this as Arc<dyn RuntimeSessionPersistence> and must
not define a separate adapter layer for the same behavior.
impl RuntimeSessionPersistence for LockedSessionStore
Infrastructure implementation of the domain runtime-persistence port.
Server should assemble this as Arc<dyn RuntimeSessionPersistence> and must
not define a separate adapter layer for the same behavior.
Source§impl<T> RuntimeSessionPersistence for Arc<T>where
T: RuntimeSessionPersistence + ?Sized,
impl<T> RuntimeSessionPersistence for Arc<T>where
T: RuntimeSessionPersistence + ?Sized,
fn save_runtime_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Arc<T>: 'async_trait,
fn append_token_usage_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
json_line: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Arc<T>: 'async_trait,
Implementors§
impl RuntimeSessionPersistence for SessionRepository
SessionRepository is the canonical RuntimeSessionPersistence: the runtime
can persist a session through the same coordinator (merge-on-write + cache
refresh) instead of a bespoke adapter.