tape/pool_writer: give proper types to 'contains_snapshot'
instead of a string. The underlying catalog implementation has to care about how this is formatted, not the external caller Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
789e22d905
commit
8bec3ff691
@ -496,7 +496,11 @@ fn backup_worker(
|
||||
if let Some(info) = snapshot_list.pop() {
|
||||
let rel_path =
|
||||
print_ns_and_snapshot(info.backup_dir.backup_ns(), info.backup_dir.as_ref());
|
||||
if pool_writer.contains_snapshot(datastore_name, &rel_path) {
|
||||
if pool_writer.contains_snapshot(
|
||||
datastore_name,
|
||||
&info.backup_dir.backup_ns(),
|
||||
info.backup_dir.as_ref(),
|
||||
) {
|
||||
task_log!(worker, "skip snapshot {}", rel_path);
|
||||
continue;
|
||||
}
|
||||
@ -517,7 +521,11 @@ fn backup_worker(
|
||||
let rel_path =
|
||||
print_ns_and_snapshot(info.backup_dir.backup_ns(), info.backup_dir.as_ref());
|
||||
|
||||
if pool_writer.contains_snapshot(datastore_name, &rel_path) {
|
||||
if pool_writer.contains_snapshot(
|
||||
datastore_name,
|
||||
&info.backup_dir.backup_ns(),
|
||||
info.backup_dir.as_ref(),
|
||||
) {
|
||||
task_log!(worker, "skip snapshot {}", rel_path);
|
||||
continue;
|
||||
}
|
||||
|
@ -411,10 +411,16 @@ impl MediaCatalog {
|
||||
}
|
||||
|
||||
/// Test if the catalog already contain a snapshot
|
||||
pub fn contains_snapshot(&self, store: &str, snapshot: &str) -> bool {
|
||||
pub fn contains_snapshot(
|
||||
&self,
|
||||
store: &str,
|
||||
ns: &BackupNamespace,
|
||||
snapshot: &BackupDir,
|
||||
) -> bool {
|
||||
let path = print_ns_and_snapshot(ns, snapshot);
|
||||
match self.content.get(store) {
|
||||
None => false,
|
||||
Some(content) => content.snapshot_index.contains_key(snapshot),
|
||||
Some(content) => content.snapshot_index.contains_key(&path),
|
||||
}
|
||||
}
|
||||
|
||||
@ -960,9 +966,14 @@ impl MediaSetCatalog {
|
||||
}
|
||||
|
||||
/// Test if the catalog already contain a snapshot
|
||||
pub fn contains_snapshot(&self, store: &str, snapshot: &str) -> bool {
|
||||
pub fn contains_snapshot(
|
||||
&self,
|
||||
store: &str,
|
||||
ns: &BackupNamespace,
|
||||
snapshot: &BackupDir,
|
||||
) -> bool {
|
||||
for catalog in self.catalog_list.values() {
|
||||
if catalog.contains_snapshot(store, snapshot) {
|
||||
if catalog.contains_snapshot(store, ns, snapshot) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,19 @@ impl CatalogSet {
|
||||
}
|
||||
|
||||
/// Test if the catalog already contains a snapshot
|
||||
pub fn contains_snapshot(&self, store: &str, snapshot: &str) -> bool {
|
||||
pub fn contains_snapshot(
|
||||
&self,
|
||||
store: &str,
|
||||
ns: &pbs_api_types::BackupNamespace,
|
||||
snapshot: &pbs_api_types::BackupDir,
|
||||
) -> bool {
|
||||
if let Some(ref catalog) = self.catalog {
|
||||
if catalog.contains_snapshot(store, snapshot) {
|
||||
if catalog.contains_snapshot(store, ns, snapshot) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.media_set_catalog.contains_snapshot(store, snapshot)
|
||||
self.media_set_catalog
|
||||
.contains_snapshot(store, ns, snapshot)
|
||||
}
|
||||
|
||||
/// Test if the catalog already contains a chunk
|
||||
|
@ -100,11 +100,16 @@ impl PoolWriter {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn contains_snapshot(&self, store: &str, snapshot: &str) -> bool {
|
||||
pub fn contains_snapshot(
|
||||
&self,
|
||||
store: &str,
|
||||
ns: &pbs_api_types::BackupNamespace,
|
||||
snapshot: &pbs_api_types::BackupDir,
|
||||
) -> bool {
|
||||
self.catalog_set
|
||||
.lock()
|
||||
.unwrap()
|
||||
.contains_snapshot(store, snapshot)
|
||||
.contains_snapshot(store, ns, snapshot)
|
||||
}
|
||||
|
||||
/// Eject media and drop PoolWriterState (close drive)
|
||||
|
Loading…
Reference in New Issue
Block a user