pub struct MemoryJournal { /* private fields */ }Expand description
In-memory journal backed by a ring buffer.
Useful for development, testing, and short-lived routers that don’t need persistence across restarts.
Implementations§
Source§impl MemoryJournal
impl MemoryJournal
Sourcepub fn default_capacity() -> Self
pub fn default_capacity() -> Self
Create with default capacity (10,000 entries)
Trait Implementations§
Source§impl Journal for MemoryJournal
impl Journal for MemoryJournal
Source§fn append<'life0, 'async_trait>(
&'life0 self,
entry: JournalEntry,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
entry: JournalEntry,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append an entry to the journal. Returns the assigned sequence number.
Source§fn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
from: Option<u64>,
to: Option<u64>,
limit: Option<u32>,
types: &'life2 [SignalType],
) -> Pin<Box<dyn Future<Output = Result<Vec<JournalEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
from: Option<u64>,
to: Option<u64>,
limit: Option<u32>,
types: &'life2 [SignalType],
) -> Pin<Box<dyn Future<Output = Result<Vec<JournalEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Query entries matching a pattern within a time range.
Source§fn since<'life0, 'async_trait>(
&'life0 self,
seq: u64,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JournalEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn since<'life0, 'async_trait>(
&'life0 self,
seq: u64,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JournalEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get entries since a given sequence number.
Source§fn latest_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn latest_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the latest sequence number.
Source§fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 [ParamSnapshot],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 [ParamSnapshot],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save a state snapshot for faster recovery.
Source§fn load_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ParamSnapshot>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ParamSnapshot>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load the most recent snapshot.
Source§fn compact<'life0, 'async_trait>(
&'life0 self,
before_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn compact<'life0, 'async_trait>(
&'life0 self,
before_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove entries older than the given sequence number.
Returns the number of entries removed.
Auto Trait Implementations§
impl !Freeze for MemoryJournal
impl !RefUnwindSafe for MemoryJournal
impl Send for MemoryJournal
impl Sync for MemoryJournal
impl Unpin for MemoryJournal
impl UnsafeUnpin for MemoryJournal
impl UnwindSafe for MemoryJournal
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