pub struct InMemoryCheckpointer { /* private fields */ }Expand description
In-process memory Checkpointer, state is lost on restart, suitable for tests
Implementations§
Source§impl InMemoryCheckpointer
impl InMemoryCheckpointer
pub fn new() -> InMemoryCheckpointer
Sourcepub async fn list_with_limit(
&self,
session_id: &str,
offset: usize,
limit: usize,
) -> Vec<Checkpoint>
pub async fn list_with_limit( &self, session_id: &str, offset: usize, limit: usize, ) -> Vec<Checkpoint>
List checkpoints with pagination (offset + limit).
Sourcepub async fn cleanup_old(&self, days: u64) -> usize
pub async fn cleanup_old(&self, days: u64) -> usize
Clean up snapshots older than days days.
Trait Implementations§
Source§impl Checkpointer for InMemoryCheckpointer
impl Checkpointer for InMemoryCheckpointer
Source§fn put<'a>(
&'a self,
session_id: &'a str,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<String, ReactError>> + Send + 'a>>
fn put<'a>( &'a self, session_id: &'a str, messages: Vec<Message>, ) -> Pin<Box<dyn Future<Output = Result<String, ReactError>> + Send + 'a>>
Save the current session’s message history, returning the new snapshot ID
Source§fn get<'a>(
&'a self,
session_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, ReactError>> + Send + 'a>>
fn get<'a>( &'a self, session_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, ReactError>> + Send + 'a>>
Get the latest snapshot for the given session (returns
None if not found)Source§fn list<'a>(
&'a self,
session_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, ReactError>> + Send + 'a>>
fn list<'a>( &'a self, session_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, ReactError>> + Send + 'a>>
Get all historical snapshots for the given session (reverse chronological order)
Source§fn delete_session<'a>(
&'a self,
session_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + 'a>>
fn delete_session<'a>( &'a self, session_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + 'a>>
Delete all snapshots for the given session
Source§fn list_sessions(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ReactError>> + Send + '_>>
fn list_sessions( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ReactError>> + Send + '_>>
List all existing session IDs
Source§impl Default for InMemoryCheckpointer
impl Default for InMemoryCheckpointer
Source§fn default() -> InMemoryCheckpointer
fn default() -> InMemoryCheckpointer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for InMemoryCheckpointer
impl !RefUnwindSafe for InMemoryCheckpointer
impl Send for InMemoryCheckpointer
impl Sync for InMemoryCheckpointer
impl Unpin for InMemoryCheckpointer
impl UnsafeUnpin for InMemoryCheckpointer
impl !UnwindSafe for InMemoryCheckpointer
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request