Struct PruneOptions

Source
pub struct PruneOptions {
    pub repository: String,
    pub passphrase: Option<String>,
    pub keep_within: Option<PruneWithin>,
    pub keep_secondly: Option<NonZeroU16>,
    pub keep_minutely: Option<NonZeroU16>,
    pub keep_hourly: Option<NonZeroU16>,
    pub keep_daily: Option<NonZeroU16>,
    pub keep_weekly: Option<NonZeroU16>,
    pub keep_monthly: Option<NonZeroU16>,
    pub keep_yearly: Option<NonZeroU16>,
    pub checkpoint_interval: Option<NonZeroU16>,
    pub glob_archives: Option<String>,
}
Expand description

Options for crate::sync::prune

A good procedure is to thin out more and more the older your backups get. As an example, keep_daily 7 means to keep the latest backup on each day, up to 7 most recent days with backups (days without backups do not count). The rules are applied from secondly to yearly, and backups selected by previous rules do not count towards those of later rules. The time that each backup starts is used for pruning purposes. Dates and times are interpreted in the local timezone, and weeks go from Monday to Sunday. Specifying a negative number of archives to keep means that there is no limit.

As of borg 1.2.0, borg will retain the oldest archive if any of the secondly, minutely, hourly, daily, weekly, monthly, or yearly rules was not otherwise able to meet its retention target. This enables the first chronological archive to continue aging until it is replaced by a newer archive that meets the retention criteria.

Fields§

§repository: String

Path to the repository

Example values:

  • /tmp/foo
  • user@example.com:/opt/repo
  • ssh://user@example.com:2323:/opt/repo
§passphrase: Option<String>

The passphrase for the repository

If using a repository with EncryptionMode::None, you can leave this option empty

§keep_within: Option<PruneWithin>

The archives kept with this option do not count towards the totals specified by any other options.

§keep_secondly: Option<NonZeroU16>

number of secondly archives to keep

§keep_minutely: Option<NonZeroU16>

number of minutely archives to keep

§keep_hourly: Option<NonZeroU16>

number of hourly archives to keep

§keep_daily: Option<NonZeroU16>

number of daily archives to keep

§keep_weekly: Option<NonZeroU16>

number of weekly archives to keep

§keep_monthly: Option<NonZeroU16>

number of monthly archives to keep

§keep_yearly: Option<NonZeroU16>

number of yearly archives to keep

§checkpoint_interval: Option<NonZeroU16>

write checkpoint every SECONDS seconds (Default: 1800)

§glob_archives: Option<String>

only consider archive names matching the glob.

The pattern can use Pattern::Shell

Implementations§

Source§

impl PruneOptions

Source

pub fn new(repository: String) -> Self

Create an new PruneOptions

Trait Implementations§

Source§

impl Clone for PruneOptions

Source§

fn clone(&self) -> PruneOptions

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PruneOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PruneOptions

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PruneOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,