[pbs-devel] [PATCH proxmox-backup v7 18/38] datastore: create namespace marker in s3 backend
Christian Ebner
c.ebner at proxmox.com
Thu Jul 10 19:07:08 CEST 2025
The S3 object store only allows to store objects, referenced by their
key. For backup namespaces datastores however use directories, so
they cannot be represented as one to one mapping.
Instead, create an empty marker file for each namespace and operate
based on that.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 6:
- no changes
pbs-datastore/src/datastore.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 90ab80005..0bc14e31d 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -42,6 +42,7 @@ static DATASTORE_MAP: LazyLock<Mutex<HashMap<String, Arc<DataStoreImpl>>>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
const GROUP_NOTES_FILE_NAME: &str = "notes";
+const NAMESPACE_MARKER_FILENAME: &str = ".namespace";
/// checks if auth_id is owner, or, if owner is a token, if
/// auth_id is the user of the token
@@ -607,6 +608,17 @@ impl DataStore {
// construct ns before mkdir to enforce max-depth and name validity
let ns = BackupNamespace::from_parent_ns(parent, name)?;
+ if let DatastoreBackend::S3(s3_client) = self.backend()? {
+ let object_key = crate::s3::object_key_from_path(&ns.path(), NAMESPACE_MARKER_FILENAME)
+ .context("invalid namespace marker object key")?;
+ let _is_duplicate = proxmox_async::runtime::block_on(s3_client.upload_with_retry(
+ object_key,
+ hyper::body::Bytes::from(""),
+ false,
+ ))
+ .context("failed to create namespace on s3 backend")?;
+ }
+
let mut ns_full_path = self.base_path();
ns_full_path.push(ns.path());
--
2.47.2
More information about the pbs-devel
mailing list