Skip to main content

FileEventLog

Struct FileEventLog 

Source
pub struct FileEventLog { /* private fields */ }
Expand description

File-based event log implementation

Implementations§

Source§

impl FileEventLog

Source

pub fn open(config: FileEventLogConfig) -> Result<Self>

Open or create a file-based event log

Source

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().

Source

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

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl EventLog for FileEventLog

Source§

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<()>

Append multiple events in a batch with pre-allocated EventIds Read more
Source§

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>>

Iterate over events in a range Read more
Source§

fn get(&self, event_id: EventId) -> Result<Option<Vec<u8>>>

Get a single event by ID
Source§

fn delete_range(&self, start: EventId, end: EventId) -> Result<usize>

Delete events up to (and including) the given EventId Read more
Source§

fn rotate(&self) -> Result<PathBuf>

Rotate the current log file Read more
Source§

fn oldest_event_id(&self) -> Result<EventId>

Get the oldest event ID still in storage
Source§

fn newest_event_id(&self) -> Result<EventId>

Get the newest event ID in storage
Source§

fn sync(&self) -> Result<()>

Sync all writes to disk
Source§

fn stats(&self) -> Result<EventLogStats>

Get statistics about the event log

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more