pub struct JsonlStorage { /* private fields */ }Expand description
On-disk JSONL backend. Each message is serialised to one line; the file is
named <session_id>.jsonl inside the configured directory.
Implementations§
Source§impl JsonlStorage
impl JsonlStorage
Trait Implementations§
Source§impl Debug for JsonlStorage
impl Debug for JsonlStorage
Source§impl Storage for JsonlStorage
impl Storage for JsonlStorage
Source§fn save_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Overwrite the stored conversation with a full snapshot.
Source§fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + 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,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append messages to the existing log (does not truncate).
Source§fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load all messages for a session. Returns an empty vec when the session is unknown.
Source§fn save_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
metadata: &'life2 SessionMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
metadata: &'life2 SessionMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persist session metadata. The default is a no-op for backwards compatibility.
Source§fn load_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionMetadata>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionMetadata>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load session metadata. The default returns
None for backwards compatibility.Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete all persisted data for a session. The default is a no-op.
Auto Trait Implementations§
impl Freeze for JsonlStorage
impl RefUnwindSafe for JsonlStorage
impl Send for JsonlStorage
impl Sync for JsonlStorage
impl Unpin for JsonlStorage
impl UnsafeUnpin for JsonlStorage
impl UnwindSafe for JsonlStorage
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