mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-05 11:30:46 +00:00
datastore: move BackupGroupDeleteStats
to api types
In preparation for the delete stats to be exposed as return type to the backup group delete api endpoint. Also, rename the private field `unremoved_protected` to a better fitting `protected_snapshots` to be in line with the method names. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
92b652935b
commit
62270f8fef
@ -1580,3 +1580,33 @@ pub fn print_store_and_ns(store: &str, ns: &BackupNamespace) -> String {
|
||||
format!("datastore '{}', namespace '{}'", store, ns)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BackupGroupDeleteStats {
|
||||
// Count of protected snapshots, therefore not removed
|
||||
protected_snapshots: usize,
|
||||
// Count of deleted snapshots
|
||||
removed_snapshots: usize,
|
||||
}
|
||||
|
||||
impl BackupGroupDeleteStats {
|
||||
pub fn all_removed(&self) -> bool {
|
||||
self.protected_snapshots == 0
|
||||
}
|
||||
|
||||
pub fn removed_snapshots(&self) -> usize {
|
||||
self.removed_snapshots
|
||||
}
|
||||
|
||||
pub fn protected_snapshots(&self) -> usize {
|
||||
self.protected_snapshots
|
||||
}
|
||||
|
||||
pub fn increment_removed_snapshots(&mut self) {
|
||||
self.removed_snapshots += 1;
|
||||
}
|
||||
|
||||
pub fn increment_protected_snapshots(&mut self) {
|
||||
self.protected_snapshots += 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user