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

Christian Ebner c.ebner at proxmox.com
Tue Mar 5 10:26:49 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>
---
changes since version 1:
- fix typo in payload archive name format string
- fix formatting issue

 proxmox-backup-client/src/catalog.rs | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
index bd7fcbbf..802518c0 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,
@@ -240,7 +243,19 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
     )
     .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