pub struct MemoryOperationLog { /* private fields */ }Expand description
In-memory operation log (for testing/development) For production, implement FileOperationLog or DatabaseOperationLog
Implementations§
Source§impl MemoryOperationLog
impl MemoryOperationLog
pub fn new() -> Self
Sourcepub fn append(&self, operation: Operation) -> Result<u64, String>
pub fn append(&self, operation: Operation) -> Result<u64, String>
Append an operation to the log Returns the log index assigned to this operation
Sourcepub fn get_by_id(&self, operation_id: &OperationId) -> Option<OperationLogEntry>
pub fn get_by_id(&self, operation_id: &OperationId) -> Option<OperationLogEntry>
Get an operation by its ID
Sourcepub fn get_by_index(&self, log_index: u64) -> Option<OperationLogEntry>
pub fn get_by_index(&self, log_index: u64) -> Option<OperationLogEntry>
Get an operation by log index
Sourcepub fn get_range(
&self,
start_index: u64,
end_index: u64,
) -> Vec<OperationLogEntry>
pub fn get_range( &self, start_index: u64, end_index: u64, ) -> Vec<OperationLogEntry>
Get all operations in range [start_index, end_index)
Sourcepub fn iter(&self) -> Vec<OperationLogEntry>
pub fn iter(&self) -> Vec<OperationLogEntry>
Iterate over all entries in the log
Sourcepub fn contains_operation_id(&self, operation_id: &OperationId) -> bool
pub fn contains_operation_id(&self, operation_id: &OperationId) -> bool
Check if an operation ID has been logged
Trait Implementations§
Source§impl Clone for MemoryOperationLog
impl Clone for MemoryOperationLog
Auto Trait Implementations§
impl Freeze for MemoryOperationLog
impl RefUnwindSafe for MemoryOperationLog
impl Send for MemoryOperationLog
impl Sync for MemoryOperationLog
impl Unpin for MemoryOperationLog
impl UnsafeUnpin for MemoryOperationLog
impl UnwindSafe for MemoryOperationLog
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