pub struct AtomicLog<T> { /* private fields */ }Expand description
Shared read handle for a segmented rolling log.
AtomicLog<T> is cheaply clonable and can be sent to many reader threads. Readers use
snapshot to capture a stable, zero-copy view of the currently
retained data.
Implementations§
Source§impl<T> AtomicLog<T>
impl<T> AtomicLog<T>
Sourcepub fn new(
retained_capacity: usize,
segment_capacity: usize,
) -> (Writer<T>, Self)
pub fn new( retained_capacity: usize, segment_capacity: usize, ) -> (Writer<T>, Self)
Creates a new log and its corresponding writer.
retained_capacity is the target logical retention size in elements. The current
implementation retains whole segments, so the observed window may exceed this value.
segment_capacity is the number of elements stored in each segment and remains fixed
for the lifetime of the log.
§Panics
Panics if either capacity is zero.
Sourcepub fn retained_capacity(&self) -> usize
pub fn retained_capacity(&self) -> usize
Returns the configured logical retained capacity, in elements.
Sourcepub fn segment_capacity(&self) -> usize
pub fn segment_capacity(&self) -> usize
Returns the fixed segment size, in elements.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for AtomicLog<T>
impl<T> !RefUnwindSafe for AtomicLog<T>
impl<T> Send for AtomicLog<T>
impl<T> Sync for AtomicLog<T>
impl<T> Unpin for AtomicLog<T>
impl<T> UnsafeUnpin for AtomicLog<T>
impl<T> !UnwindSafe for AtomicLog<T>
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