pub struct FileEventLog { /* private fields */ }Expand description
File-based event log implementation
Implementations§
Source§impl FileEventLog
impl FileEventLog
Sourcepub fn open(config: FileEventLogConfig) -> Result<Self>
pub fn open(config: FileEventLogConfig) -> Result<Self>
Open or create a file-based event log
Sourcepub fn set_event_notify(&mut self, notify: Arc<Notify>)
pub fn set_event_notify(&mut self, notify: Arc<Notify>)
Set the event notification handle.
When set, notify_waiters() is called after every successful
append_with_id / append_batch_with_ids, waking any task that
is awaiting notified().
Sourcepub fn event_notify(&self) -> Option<Arc<Notify>>
pub fn event_notify(&self) -> Option<Arc<Notify>>
Get a clone of the event notification handle (if set).
Trait Implementations§
Source§impl Drop for FileEventLog
Ensure metadata is saved on drop
impl Drop for FileEventLog
Ensure metadata is saved on drop
Source§impl EventLog for FileEventLog
impl EventLog for FileEventLog
Source§fn append_with_id(&self, event_id: EventId, event_bytes: &[u8]) -> Result<()>
fn append_with_id(&self, event_id: EventId, event_bytes: &[u8]) -> Result<()>
Append an event with a pre-allocated EventId Read more
Source§fn append_batch_with_ids(
&self,
first_event_id: EventId,
events: &[Vec<u8>],
) -> Result<()>
fn append_batch_with_ids( &self, first_event_id: EventId, events: &[Vec<u8>], ) -> Result<()>
Append multiple events in a batch with pre-allocated EventIds Read more
Source§fn next_event_id(&self) -> Result<EventId>
fn next_event_id(&self) -> Result<EventId>
Get the next EventId that will be assigned
Source§fn iter_range(
&self,
start: EventId,
end: Option<EventId>,
) -> Result<Box<dyn EventLogIterator>>
fn iter_range( &self, start: EventId, end: Option<EventId>, ) -> Result<Box<dyn EventLogIterator>>
Iterate over events in a range Read more
Source§fn delete_range(&self, start: EventId, end: EventId) -> Result<usize>
fn delete_range(&self, start: EventId, end: EventId) -> Result<usize>
Delete events up to (and including) the given EventId Read more
Source§fn oldest_event_id(&self) -> Result<EventId>
fn oldest_event_id(&self) -> Result<EventId>
Get the oldest event ID still in storage
Source§fn newest_event_id(&self) -> Result<EventId>
fn newest_event_id(&self) -> Result<EventId>
Get the newest event ID in storage
Source§fn stats(&self) -> Result<EventLogStats>
fn stats(&self) -> Result<EventLogStats>
Get statistics about the event log
Auto Trait Implementations§
impl Freeze for FileEventLog
impl !RefUnwindSafe for FileEventLog
impl Send for FileEventLog
impl Sync for FileEventLog
impl Unpin for FileEventLog
impl !UnwindSafe for FileEventLog
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