pub enum Strategy {
KeepMostRecent {
k: usize,
},
Classic,
}Expand description
Backups compaction strategy.
Determines if a backup can be kept (retainable) or purged (purgeable).
Variants§
KeepMostRecent
Keep the k most recent backups.
Classic
Classic backup strategy.
This is only useful if you save very often, probably in an automated manner. See
the method Strategy::plan for details.
Implementations§
Source§impl Strategy
impl Strategy
Sourcepub fn most_recent(k: usize) -> Self
pub fn most_recent(k: usize) -> Self
Return a new simple strategy.
Sourcepub fn plan<'a>(&self, backups: &'a [Backup]) -> Plan<'a>
pub fn plan<'a>(&self, backups: &'a [Backup]) -> Plan<'a>
Determine which backup files should be kept.
The backup_files are assumed to be sorted from oldest to newest.
§KeepMostRecent strategy
Simply splits the list of all backups into 2 lists: the k recent ones (or less if the
catalog does not contain as much) and the remaining ones are considered outdated
(purgeable).
§Classic strategy
Its goal is to keep
- the lastest backup per hour for the past 24 hours (max 23 backups - exclude the past hour),
- the lastest backup per day for the past 7 days (max 6 backups - exclude the past 24 hours),
- the lastest backup per week of the past 4 weeks (max 3 backups - exclude the past week),
- the lastest backup per month of this year (max 11 backups - exclude the past month).
The time windows above are a partition; they do not overlap. Within each partition, only the most recent backup is kept.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Strategy
impl RefUnwindSafe for Strategy
impl Send for Strategy
impl Sync for Strategy
impl Unpin for Strategy
impl UnwindSafe for Strategy
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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