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:
committed by
Fabian Grünbichler
parent
789e22d905
commit
8bec3ff691
@ -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)
|
||||
|
Reference in New Issue
Block a user