Skip to main content

EventStore

Struct EventStore 

Source
pub struct EventStore<const C: usize, const I: usize, const D: usize> { /* private fields */ }
Expand description

The node’s event store: one ring per priority (§7.14.2).

Event records SHALL be buffered on the Node, with priority given to events of a higher priority level over a lower priority level.

Separate buffers rather than one shared ring with a priority field, because that sentence is a guarantee: a flood of Debug records must not be able to push out a Critical one, and in a shared ring it always can. The sizes are the caller’s, so a device that logs heavily at Debug pays for it only there.

Implementations§

Source§

impl<const C: usize, const I: usize, const D: usize> EventStore<C, I, D>

Source

pub const fn new(numbers: EventNumbers) -> Self

An empty store resuming from a counter.

Source

pub const fn numbers(&self) -> EventNumbers

The event-number counter.

Source

pub const fn reserved(&mut self, value: u64)

Records that a reservation has been durably stored (§7.14.1.1 step 2).

Source

pub fn record(&mut self, event: &NewEvent<'_>) -> Result<u64, RecordError>

Records an event, assigning it the next number.

Source

pub const fn buffer(&self, priority: EventPriority) -> &dyn BufferView

The buffer for one priority.

Source

pub fn matching<'a>( &'a self, path: &'a EventPath, accessing: Option<FabricIndex>, min_number: u64, ) -> impl Iterator<Item = &'a EventRecord>

Every buffered record matching path, visible to accessing, with a number at or above min_number, in event-number order.

§8.5: “Each Report containing events SHALL deliver queued events without reordering the queue.” Across priorities that means by number, because the number is the order things happened in — reporting all the Critical records before all the Info ones would hand a client a log that contradicts itself.

Source

pub fn len(&self) -> usize

How many records are held, across every priority.

Source

pub fn is_empty(&self) -> bool

Whether none are.

Source

pub fn prune_below(&mut self, number: u64)

Forgets every record below number, across every priority.

Trait Implementations§

Source§

impl<const C: usize, const I: usize, const D: usize> Debug for EventStore<C, I, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const C: usize, const I: usize, const D: usize> Default for EventStore<C, I, D>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const C: usize, const I: usize, const D: usize> EventSource for EventStore<C, I, D>

Source§

fn each_matching( &self, path: &EventPath, accessing: Option<FabricIndex>, min_number: u64, each: &mut dyn FnMut(&EventRecord) -> bool, )

Every queued record matching path, visible to accessing, whose number is at least min_number — in event-number order, which §8.5 requires: “Each Report containing events SHALL deliver queued events without reordering the queue.” Read more
Source§

fn highest_number(&self) -> Option<u64>

The highest event number the node has assigned, or None when it has recorded nothing. Read more

Auto Trait Implementations§

§

impl<const C: usize, const I: usize, const D: usize> Forget for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> Freeze for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> Move for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> RefUnwindSafe for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> Send for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> Sync for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> Unpin for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> UnsafeUnpin for EventStore<C, I, D>

§

impl<const C: usize, const I: usize, const D: usize> UnwindSafe for EventStore<C, I, D>

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, 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.