pub struct InMemoryEventLog { /* private fields */ }Expand description
In-memory implementation of the EventLog trait
Uses a Vec for storage and a Notify for waking subscribers
when new events are appended. Thread-safe via Arc<RwLock>.
§Performance
- Append: O(1) amortized
- Subscribe replay: O(n) from start position
- Ack/Seek: O(1)
§Limitations
- Events are lost on restart (no persistence)
- Memory grows unbounded (no retention policy yet)
- Single-instance only (no cross-process sharing)
Implementations§
Trait Implementations§
Source§impl Clone for InMemoryEventLog
impl Clone for InMemoryEventLog
Source§fn clone(&self) -> InMemoryEventLog
fn clone(&self) -> InMemoryEventLog
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryEventLog
impl Debug for InMemoryEventLog
Source§impl Default for InMemoryEventLog
impl Default for InMemoryEventLog
Source§impl EventLog for InMemoryEventLog
impl EventLog for InMemoryEventLog
Source§fn append<'life0, 'async_trait>(
&'life0 self,
envelope: EventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<SeqNo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
envelope: EventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<SeqNo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append an event envelope to the log Read more
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
consumer: &'life1 str,
position: SeekPosition,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = EventEnvelope> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
consumer: &'life1 str,
position: SeekPosition,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = EventEnvelope> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to events from a given position Read more
Source§fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
consumer: &'life1 str,
seq_no: SeqNo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
consumer: &'life1 str,
seq_no: SeqNo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledge that a consumer has processed up to a sequence number Read more
Auto Trait Implementations§
impl Freeze for InMemoryEventLog
impl !RefUnwindSafe for InMemoryEventLog
impl Send for InMemoryEventLog
impl Sync for InMemoryEventLog
impl Unpin for InMemoryEventLog
impl UnsafeUnpin for InMemoryEventLog
impl !UnwindSafe 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
Mutably borrows from an owned value. Read more