pub struct MockLogStore { /* private fields */ }Implementations§
Source§impl MockLogStore
impl MockLogStore
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new method can still be called
like <MockX as TraitY>::new
Source§impl MockLogStore
impl MockLogStore
Sourcepub fn expect_persist_entries(&mut self) -> &mut Expectation
pub fn expect_persist_entries(&mut self) -> &mut Expectation
Create an Expectation for mocking the persist_entries method
Sourcepub fn expect_entry(&mut self) -> &mut Expectation
pub fn expect_entry(&mut self) -> &mut Expectation
Create an Expectation for mocking the entry method
Sourcepub fn expect_get_entries(&mut self) -> &mut Expectation
pub fn expect_get_entries(&mut self) -> &mut Expectation
Create an Expectation for mocking the get_entries method
Sourcepub fn expect_purge(&mut self) -> &mut Expectation
pub fn expect_purge(&mut self) -> &mut Expectation
Create an Expectation for mocking the purge method
Sourcepub fn expect_truncate(&mut self) -> &mut Expectation
pub fn expect_truncate(&mut self) -> &mut Expectation
Create an Expectation for mocking the truncate method
Sourcepub fn expect_flush(&mut self) -> &mut Expectation
pub fn expect_flush(&mut self) -> &mut Expectation
Create an Expectation for mocking the flush method
Sourcepub fn expect_flush_async(&mut self) -> &mut Expectation
pub fn expect_flush_async(&mut self) -> &mut Expectation
Create an Expectation for mocking the flush_async method
Sourcepub fn expect_reset(&mut self) -> &mut Expectation
pub fn expect_reset(&mut self) -> &mut Expectation
Create an Expectation for mocking the reset method
Sourcepub fn expect_last_index(&mut self) -> &mut Expectation
pub fn expect_last_index(&mut self) -> &mut Expectation
Create an Expectation for mocking the last_index method
Trait Implementations§
Source§impl Debug for MockLogStore
impl Debug for MockLogStore
Source§impl Default for MockLogStore
impl Default for MockLogStore
Source§impl LogStore for MockLogStore
impl LogStore for MockLogStore
Source§fn persist_entries<'life0, 'async_trait>(
&'life0 self,
entries: Vec<Entry>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn persist_entries<'life0, 'async_trait>(
&'life0 self,
entries: Vec<Entry>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Batch persist entries into disk (optimized for sequential writes)
§Performance
Implementations should use batch operations and avoid per-entry synchronization. Expected throughput: >100k ops/sec.
Source§fn entry<'life0, 'async_trait>(
&'life0 self,
index: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Entry>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn entry<'life0, 'async_trait>(
&'life0 self,
index: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Entry>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get single log entry by index
Source§fn get_entries(&self, range: RangeInclusive<u64>) -> Result<Vec<Entry>, Error>
fn get_entries(&self, range: RangeInclusive<u64>) -> Result<Vec<Entry>, Error>
Get entries in range [start, end] (inclusive)
§Performance
Should use efficient range scans. Expected latency: <1ms for 10k entries.
Source§fn purge<'life0, 'async_trait>(
&'life0 self,
cutoff_index: LogId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn purge<'life0, 'async_trait>(
&'life0 self,
cutoff_index: LogId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove logs up to specified index
Source§fn truncate<'life0, 'async_trait>(
&'life0 self,
from_index: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn truncate<'life0, 'async_trait>(
&'life0 self,
from_index: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Truncates log from specified index onward
Source§fn flush_async<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush_async<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Optional: Flush pending writes (use with caution)
Source§fn last_index(&self) -> u64
fn last_index(&self) -> u64
Get last log index (optimized for frequent access)
§Implementation note
Should maintain cached value updated on write operations
fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for MockLogStore
impl RefUnwindSafe for MockLogStore
impl Send for MockLogStore
impl Sync for MockLogStore
impl Unpin for MockLogStore
impl UnwindSafe for MockLogStore
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request