mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
Merge pull request #703 from rustic-rs/refactor-prune
move prune into rustic_core
This commit is contained in:
commit
be4022ed0a
@ -1,3 +1,4 @@
|
||||
pub mod cat;
|
||||
pub mod check;
|
||||
pub mod prune;
|
||||
pub mod repoinfo;
|
||||
|
||||
1056
crates/rustic_core/src/commands/prune.rs
Normal file
1056
crates/rustic_core/src/commands/prune.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -144,6 +144,24 @@ pub enum RusticErrorKind {
|
||||
pub enum CommandErrorKind {
|
||||
/// path is no dir: `{0:?}`
|
||||
PathIsNoDir(String),
|
||||
/// used blobs are missing: blob {0} doesn't existing
|
||||
BlobsMissing(Id),
|
||||
/// packs_to_delete doesn't contain `time`.
|
||||
NoTimeInPacksToDelete,
|
||||
/// used pack {0}: size does not match! Expected size: {1}, real size: {2}
|
||||
PackSizeNotMatching(Id, u32, u32),
|
||||
/// "used pack {0} does not exist!
|
||||
PackNotExisting(Id),
|
||||
/// pack {0} got no decicion what to do
|
||||
NoDecicion(Id),
|
||||
/// {0:?}
|
||||
FromParseIntError(#[from] ParseIntError),
|
||||
/// {0}
|
||||
FromByteSizeParser(String),
|
||||
/// --repack-uncompressed makes no sense for v1 repo!
|
||||
RepackUncompressedRepoV1,
|
||||
/// datetime out of range: `{0:?}`
|
||||
FromOutOfRangeError(#[from] OutOfRangeError),
|
||||
}
|
||||
|
||||
/// [`CryptoErrorKind`] describes the errors that can happen while dealing with Cryptographic functions
|
||||
|
||||
@ -122,6 +122,7 @@ pub use crate::{
|
||||
chunker::random_poly,
|
||||
commands::{
|
||||
check::CheckOpts,
|
||||
prune::{PruneOpts, PrunePlan, PruneStats},
|
||||
repoinfo::{BlobInfo, IndexInfos, PackInfo, RepoFileInfo, RepoFileInfos},
|
||||
},
|
||||
crypto::{aespoly1305::Key, hasher::hash},
|
||||
|
||||
@ -36,7 +36,8 @@ use crate::{
|
||||
crypto::aespoly1305::Key,
|
||||
error::RepositoryErrorKind,
|
||||
repofile::{configfile::ConfigFile, keyfile::find_key_in_backend},
|
||||
BlobType, IndexBackend, NoProgressBars, ProgressBars, RusticResult, SnapshotFile,
|
||||
BlobType, IndexBackend, NoProgressBars, ProgressBars, PruneOpts, PrunePlan, RusticResult,
|
||||
SnapshotFile,
|
||||
};
|
||||
|
||||
pub(super) mod constants {
|
||||
@ -380,6 +381,10 @@ impl<P: ProgressBars> OpenRepository<P> {
|
||||
opts.run(self)
|
||||
}
|
||||
|
||||
pub fn prune_plan(&self, opts: &PruneOpts) -> RusticResult<PrunePlan> {
|
||||
opts.get_plan(self)
|
||||
}
|
||||
|
||||
pub fn to_indexed(self) -> RusticResult<IndexedRepository<P>> {
|
||||
let index = IndexBackend::new(&self.dbe, &self.pb.progress_counter(""))?;
|
||||
Ok(IndexedRepository { repo: self, index })
|
||||
|
||||
@ -201,7 +201,7 @@ impl ForgetCmd {
|
||||
|
||||
if self.config.prune {
|
||||
let mut prune_opts = self.prune_opts.clone();
|
||||
prune_opts.ignore_snaps = forget_snaps;
|
||||
prune_opts.opts.ignore_snaps = forget_snaps;
|
||||
prune_opts.run();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user