Struct BackupId
pub(super) struct BackupId {
pub(super) millis: u64,
pub(super) seq: u64,
}Available on crate feature
tokio only.Expand description
Identifies a .corrupt-<millis>-<seq> backup file, ordered by creation
time.
millis (wall clock) is the real ordering signal. It is correct across a
process restart. seq is a per-process counter that resets to 0 each run.
seq only breaks ties between backups created in the same millisecond. It
is not derived from which names already exist. Pruning can free up a small
seq and let a later backup reuse it. That backup would then sort as
older than it really is. Deriving Ord from the
field order (millis first, then seq) gives exactly that priority.
Fields§
§millis: u64§seq: u64Implementations§
§impl BackupId
impl BackupId
fn generate() -> Self
fn generate() -> Self
Allocates a fresh id from the wall clock and a per-process counter.
pub(super) fn parse(suffix: &str) -> Option<Self>
pub(super) fn parse(suffix: &str) -> Option<Self>
Parses the <millis>-<seq> suffix produced by
Display.
fn backup_path_for(self, original: &Path) -> PathBuf
fn backup_path_for(self, original: &Path) -> PathBuf
Backup path for original: its file name with a .corrupt-<id>
suffix.
Trait Implementations§
impl Copy for BackupId
impl Eq for BackupId
§impl Ord for BackupId
impl Ord for BackupId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
§impl PartialOrd for BackupId
impl PartialOrd for BackupId
impl StructuralPartialEq for BackupId
Auto Trait Implementations§
impl Freeze for BackupId
impl RefUnwindSafe for BackupId
impl Send for BackupId
impl Sync for BackupId
impl Unpin for BackupId
impl UnsafeUnpin for BackupId
impl UnwindSafe for BackupId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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