pub struct InMemoryEventLog { /* private fields */ }Expand description
A task’s update log held in this process’s memory.
Cloning shares the log, so a clone sees the same events. This is the default
under InMemoryStreamingHandler, and it is what makes resumption work
within one run of a server: a client that reconnects gets the tail it missed,
up to capacity events per task.
What it cannot do is survive the process. A restart starts every task’s ids
again at 1, and a client resuming with an id from before the restart is told
the log cannot cover it (Replay::complete is false) rather than handed a
tail that means something else. Use a durable log — SqlxTaskStorage
implements this port — where resumption has to outlive a restart.
Retained tasks are never evicted: a task that has finished still holds its
ring until discard is called for it. Bounded per
task, unbounded in task count, which is the other reason a long-running
server wants the durable log.
Implementations§
Source§impl InMemoryEventLog
impl InMemoryEventLog
Sourcepub fn new() -> Self
pub fn new() -> Self
A log keeping DEFAULT_CAPACITY events per task.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
A log keeping capacity events per task.
A capacity of zero would retain nothing and make every resume incomplete, so it is raised to one.
Trait Implementations§
Source§impl AsyncEventLog for InMemoryEventLog
impl AsyncEventLog for InMemoryEventLog
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
event: UpdateEvent,
) -> Pin<Box<dyn Future<Output = Result<SeqEvent, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
event: UpdateEvent,
) -> Pin<Box<dyn Future<Output = Result<SeqEvent, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
event as the next event on task_id’s stream and return it
with the id it was given. Read moreSource§fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
from: u64,
) -> Pin<Box<dyn Future<Output = Result<Replay, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
from: u64,
) -> Pin<Box<dyn Future<Output = Result<Replay, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
from.Source§impl Clone for InMemoryEventLog
impl Clone for InMemoryEventLog
Source§fn clone(&self) -> InMemoryEventLog
fn clone(&self) -> InMemoryEventLog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for InMemoryEventLog
impl !UnwindSafe for InMemoryEventLog
impl Freeze for InMemoryEventLog
impl Send for InMemoryEventLog
impl Sync for InMemoryEventLog
impl Unpin for InMemoryEventLog
impl UnsafeUnpin for InMemoryEventLog
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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