pub struct RecordCache { /* private fields */ }Expand description
Thread-safe in-memory cache of ingested records keyed by record id.
Implementations§
Source§impl RecordCache
impl RecordCache
Sourcepub fn new(max_records: usize) -> Self
pub fn new(max_records: usize) -> Self
Create a cache capped to at most max_records live records.
Sourcepub fn ingest<I>(&self, records: I)where
I: IntoIterator<Item = DataRecord>,
pub fn ingest<I>(&self, records: I)where
I: IntoIterator<Item = DataRecord>,
Ingest a batch of records, replacing existing entries by id.
Sourcepub fn snapshot(&self) -> Vec<DataRecord>
pub fn snapshot(&self) -> Vec<DataRecord>
Return a cloned snapshot of current cached records.
Sourcepub fn ingest_count(&self) -> u64
pub fn ingest_count(&self) -> u64
Return the number of completed ingest operations.
Sourcepub fn wait_for_ingest(&self, last_seen: u64, timeout: Duration) -> u64
pub fn wait_for_ingest(&self, last_seen: u64, timeout: Duration) -> u64
Wait until ingest count exceeds last_seen, or until timeout elapses.
Sourcepub fn wait_for_ingest_blocking(&self, last_seen: u64) -> u64
pub fn wait_for_ingest_blocking(&self, last_seen: u64) -> u64
Wait indefinitely until ingest count exceeds last_seen.
Trait Implementations§
Source§impl Clone for RecordCache
impl Clone for RecordCache
Source§fn clone(&self) -> RecordCache
fn clone(&self) -> RecordCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RecordCache
impl RefUnwindSafe for RecordCache
impl Send for RecordCache
impl Sync for RecordCache
impl Unpin for RecordCache
impl UnsafeUnpin for RecordCache
impl UnwindSafe for RecordCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more