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: PruneStatsprune statistics
Implementations§
Source§impl PrunePlan
impl PrunePlan
Sourcefn new(
used_ids: BTreeMap<BlobId, u8>,
existing_packs: BTreeMap<PackId, u32>,
index_files: Vec<(IndexId, IndexFile)>,
) -> Self
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 usedexisting_packs- The ids of the existing packsindex_files- The index files
Sourcepub fn from_prune_options<P: ProgressBars, S: Open>(
repo: &Repository<P, S>,
opts: &PruneOptions,
) -> RusticResult<Self>
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 typeS- The state the repository is in
§Arguments
repo- The repository to get thePrunePlanforopts- ThePruneOptionsto use
§Errors
- If
repack_uncompressedis set and the repository is a version 1 repository - If
keep_packorkeep_deleteis out of range
Sourcefn count_used_blobs(&mut self)
fn count_used_blobs(&mut self)
This function counts the number of times a blob is used in the index files.
Sourcefn check(&self) -> RusticResult<()>
fn check(&self) -> RusticResult<()>
This function checks whether all used blobs are present in the index files.
§Errors
- If a blob is missing
Sourcefn 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<()>
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 removingkeep_delete- The minimum duration to keep packs marked for deletionrepack_cacheable_only- Whether to only repack cacheable packsrepack_uncompressed- Whether to repack packs containing uncompressed blobsrepack_all- Whether to repack all packspack_sizer- ThePackSizerfor the packs
§Errors
Sourcefn decide_repack(
&mut self,
max_repack: &LimitOption,
max_unused: &LimitOption,
repack_uncompressed: bool,
no_resize: bool,
pack_sizer: &EnumMap<BlobType, PackSizer>,
)
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 repackmax_unused- The maximum size of unused blobsrepack_uncompressed- Whether to repack packs containing uncompressed blobsno_resize- Whether to resize packspack_sizer- ThePackSizerfor the packs
§Errors
Sourcefn check_existing_packs(&mut self) -> RusticResult<()>
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
Sourcefn filter_index_files(&mut self, instant_delete: bool)
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
Sourcepub fn repack_packs(&self) -> Vec<PackId>
pub fn repack_packs(&self) -> Vec<PackId>
Get the list of packs-to-repack from the PrunePlan.
Sourcepub fn do_prune<P: ProgressBars, S: Open>(
self,
repo: &Repository<P, S>,
opts: &PruneOptions,
) -> RusticResult<()>
👎Deprecated since 0.5.2: Use Repository::prune() instead.
pub fn do_prune<P: ProgressBars, S: Open>( self, repo: &Repository<P, S>, opts: &PruneOptions, ) -> RusticResult<()>
Repository::prune() instead.Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrunePlan
impl RefUnwindSafe for PrunePlan
impl Send for PrunePlan
impl Sync for PrunePlan
impl Unpin for PrunePlan
impl UnwindSafe for PrunePlan
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
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