split the namespace out of BackupGroup/Dir api types
We decided to go this route because it'll most likely be safer in the API as we need to explicitly add namespaces support to the various API endpoints this way. For example, 'pull' should have 2 namespaces: local and remote, and the GroupFilter (which would otherwise contain exactly *one* namespace parameter) needs to be applied for both sides (to decide what to pull from the remote, and what to *remove* locally as cleanup). The *datastore* types still contain the namespace and have a `.backup_ns()` getter. Note that the datastore's `Display` implementations are no longer safe to use as a deserializable string. Additionally, some datastore based methods now have been exposed via the BackupGroup/BackupDir types to avoid a "round trip" in code. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
1baf9030ad
commit
133d718fe4
@ -8,13 +8,14 @@ use nix::dir::Dir;
|
||||
|
||||
use proxmox_sys::fs::lock_dir_noblock_shared;
|
||||
|
||||
use pbs_api_types::{BackupNamespace, Operation};
|
||||
|
||||
use crate::backup_info::BackupDir;
|
||||
use crate::dynamic_index::DynamicIndexReader;
|
||||
use crate::fixed_index::FixedIndexReader;
|
||||
use crate::index::IndexFile;
|
||||
use crate::manifest::{archive_type, ArchiveType, CLIENT_LOG_BLOB_NAME, MANIFEST_BLOB_NAME};
|
||||
use crate::DataStore;
|
||||
use pbs_api_types::Operation;
|
||||
|
||||
/// Helper to access the contents of a datastore backup snapshot
|
||||
///
|
||||
@ -30,10 +31,14 @@ impl SnapshotReader {
|
||||
/// Lock snapshot, reads the manifest and returns a new instance
|
||||
pub fn new(
|
||||
datastore: Arc<DataStore>,
|
||||
ns: BackupNamespace,
|
||||
snapshot: pbs_api_types::BackupDir,
|
||||
) -> Result<Self, Error> {
|
||||
let snapshot = datastore.backup_dir(snapshot)?;
|
||||
Self::new_do(datastore.backup_dir(ns, snapshot)?)
|
||||
}
|
||||
|
||||
pub(crate) fn new_do(snapshot: BackupDir) -> Result<Self, Error> {
|
||||
let datastore = snapshot.datastore();
|
||||
let snapshot_path = snapshot.full_path();
|
||||
|
||||
let locked_dir =
|
||||
|
Reference in New Issue
Block a user