[pbs-devel] [RFC proxmox-backup 22/36] catalog: shell: redirect payload reader for split streams

Christian Ebner c.ebner at proxmox.com
Wed Feb 28 15:02:12 CET 2024


Allows to attach to pxar archives with split metadata and payload
streams, by redirecting the payload input to a dedicated reader
accessing the payload index.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 proxmox-backup-client/src/catalog.rs | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
index d6859be3..291c4184 100644
--- a/proxmox-backup-client/src/catalog.rs
+++ b/proxmox-backup-client/src/catalog.rs
@@ -207,11 +207,14 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
         }
     };
 
-    let server_archive_name = if archive_name.ends_with(".pxar") {
-        format!("{}.didx", archive_name)
-    } else {
-        bail!("Can only mount pxar archives.");
-    };
+    let server_archive_name =
+        if archive_name.ends_with(".pxar") || archive_name.ends_with(".pxar.meta") {
+            format!("{}.didx", archive_name)
+        } else if archive_name.ends_with(".pxar.pld") {
+            bail!("Cannot mount pxar pld, use pxar meta instead");
+        } else {
+            bail!("Can only mount pxar archives.");
+        };
 
     let client = BackupReader::start(
         &client,
@@ -239,7 +242,18 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
         crypt_config.clone(),
     ).await?;
 
-    let decoder = pbs_pxar_fuse::Accessor::new(reader, archive_size).await?;
+    let mut decoder = pbs_pxar_fuse::Accessor::new(reader, archive_size).await?;
+
+    if let Some(archive_base_name) = server_archive_name.strip_suffix(".pxar.meta.didx") {
+        let payload_archive_name = format!("{archive_base_name},pxar.pld.didx");
+        let (payload_reader, _) = get_pxar_fuse_reader(
+            &payload_archive_name,
+            client.clone(),
+            &manifest,
+            crypt_config.clone(),
+        ).await?;
+        decoder = decoder.redirect_payload_input(payload_reader);
+    }
 
     client.download(CATALOG_NAME, &mut tmpfile).await?;
     let index = DynamicIndexReader::new(tmpfile)
-- 
2.39.2





More information about the pbs-devel mailing list