PrunePlan

Struct PrunePlan 

Source
pub struct PrunePlan {
    time: DateTime<Local>,
    used_ids: BTreeMap<BlobId, u8>,
    existing_packs: BTreeMap<PackId, u32>,
    repack_candidates: Vec<(PackInfo, EnumSet<PackStatus>, RepackReason, usize, usize)>,
    index_files: Vec<PruneIndex>,
    pub stats: PruneStats,
}
Expand description

A plan what should be repacked or removed by a prune run

Fields§

§time: DateTime<Local>

The time the plan was created

§used_ids: BTreeMap<BlobId, u8>

The ids of the blobs which are used

§existing_packs: BTreeMap<PackId, u32>

The ids of the existing packs

§repack_candidates: Vec<(PackInfo, EnumSet<PackStatus>, RepackReason, usize, usize)>

The packs which should be repacked

§index_files: Vec<PruneIndex>

The index files

§stats: PruneStats

prune statistics

Implementations§

Source§

impl PrunePlan

Source

fn new( used_ids: BTreeMap<BlobId, u8>, existing_packs: BTreeMap<PackId, u32>, index_files: Vec<(IndexId, IndexFile)>, ) -> Self

Create a new PrunePlan

§Arguments
  • used_ids - The ids of the blobs which are used
  • existing_packs - The ids of the existing packs
  • index_files - The index files
Source

pub fn from_prune_options<P: ProgressBars, S: Open>( repo: &Repository<P, S>, opts: &PruneOptions, ) -> RusticResult<Self>

Get a PrunePlan from the given PruneOptions.

§Type Parameters
  • P - The progress bar type
  • S - The state the repository is in
§Arguments
  • repo - The repository to get the PrunePlan for
  • opts - The PruneOptions to use
§Errors
  • If repack_uncompressed is set and the repository is a version 1 repository
  • If keep_pack or keep_delete is out of range
Source

fn count_used_blobs(&mut self)

This function counts the number of times a blob is used in the index files.

Source

fn check(&self) -> RusticResult<()>

This function checks whether all used blobs are present in the index files.

§Errors
  • If a blob is missing
Source

fn decide_packs( &mut self, keep_pack: Duration, keep_delete: Duration, repack_cacheable_only: bool, repack_uncompressed: bool, repack_all: bool, pack_sizer: &EnumMap<BlobType, PackSizer>, ) -> RusticResult<()>

Decides what to do with the packs

§Arguments
  • keep_pack - The minimum duration to keep packs before repacking or removing
  • keep_delete - The minimum duration to keep packs marked for deletion
  • repack_cacheable_only - Whether to only repack cacheable packs
  • repack_uncompressed - Whether to repack packs containing uncompressed blobs
  • repack_all - Whether to repack all packs
  • pack_sizer - The PackSizer for the packs
§Errors
Source

fn decide_repack( &mut self, max_repack: &LimitOption, max_unused: &LimitOption, repack_uncompressed: bool, no_resize: bool, pack_sizer: &EnumMap<BlobType, PackSizer>, )

Decides if packs should be repacked

§Arguments
  • max_repack - The maximum size of packs to repack
  • max_unused - The maximum size of unused blobs
  • repack_uncompressed - Whether to repack packs containing uncompressed blobs
  • no_resize - Whether to resize packs
  • pack_sizer - The PackSizer for the packs
§Errors
Source

fn check_existing_packs(&mut self) -> RusticResult<()>

Checks if the existing packs are ok

§Errors
  • If a pack is undecided
  • If the size of a pack does not match
  • If a pack does not exist
Source

fn filter_index_files(&mut self, instant_delete: bool)

Filter out index files which do not need processing

§Arguments
  • instant_delete - Whether to instantly delete unreferenced packs
Source

pub fn repack_packs(&self) -> Vec<PackId>

Get the list of packs-to-repack from the PrunePlan.

Source

pub fn do_prune<P: ProgressBars, S: Open>( self, repo: &Repository<P, S>, opts: &PruneOptions, ) -> RusticResult<()>

👎Deprecated since 0.5.2: Use Repository::prune() instead.

Perform the pruning on the given repository.

§Arguments
  • repo - The repository to prune
  • opts - The options for the pruning
§Errors
  • If the repository is in append-only mode
  • If a pack has no decision
§Returns
  • Ok(()) - If the pruning was successful
§Panics

TODO! In weird circumstances, should be fixed.

Trait Implementations§

Source§

impl Debug for PrunePlan

Source§

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

Formats the value using the given formatter. 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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V