pub struct SegmentId(/* private fields */);Expand description
Monotonic identifier for a WAL segment file.
Allocation policy: ids start at 1 (SegmentId(0) is reserved as a
“no segment” sentinel that callers should never encounter for a
live WAL), and rotation simply does id + 1. Ids are stable: a
truncated segment retains its id even after every preceding segment
has been deleted.
Implementations§
Source§impl SegmentId
impl SegmentId
pub const FIRST: SegmentId
pub const fn new(value: u64) -> Self
pub const fn raw(self) -> u64
pub fn next(self) -> Self
Sourcepub fn saturating_prev(self) -> Self
pub fn saturating_prev(self) -> Self
Predecessor id, saturating at zero. Used for the “active and
the segment immediately preceding it” tombstone-retention rule
in crate::wal::Wal::truncate_up_to.
Trait Implementations§
Source§impl Ord for SegmentId
impl Ord for SegmentId
Source§impl PartialOrd for SegmentId
impl PartialOrd for SegmentId
impl Copy for SegmentId
impl Eq for SegmentId
impl StructuralPartialEq for SegmentId
Auto Trait Implementations§
impl Freeze for SegmentId
impl RefUnwindSafe for SegmentId
impl Send for SegmentId
impl Sync for SegmentId
impl Unpin for SegmentId
impl UnsafeUnpin for SegmentId
impl UnwindSafe for SegmentId
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