[pbs-devel] [PATCH v9 proxmox-backup 10/58] api: datastore: attach split archive payload chunk reader

Christian Ebner c.ebner at proxmox.com
Wed Jun 5 12:53:28 CEST 2024


Attach the payload chunk reader for pxar archives which have been
uploaded using split streams for metadata and payload data.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 8:
- use get_pxar_archive_names helper

 src/api2/admin/datastore.rs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index af1c12cc0..34a9105dd 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1810,10 +1810,20 @@ pub fn pxar_file_download(
             }
         }
 
+        let (pxar_name, payload_archive_name) =
+            pbs_client::tools::get_pxar_archive_names(pxar_name, &manifest)?;
         let (reader, archive_size) =
-            get_local_pxar_reader(datastore.clone(), &manifest, &backup_dir, pxar_name)?;
+            get_local_pxar_reader(datastore.clone(), &manifest, &backup_dir, &pxar_name)?;
+
+        let reader = if let Some(payload_archive_name) = payload_archive_name {
+            let payload_input =
+                get_local_pxar_reader(datastore, &manifest, &backup_dir, &payload_archive_name)?;
+            pxar::PxarVariant::Split(reader, payload_input)
+        } else {
+            pxar::PxarVariant::Unified(reader)
+        };
+        let decoder = Accessor::new(reader, archive_size).await?;
 
-        let decoder = Accessor::new(pxar::PxarVariant::Unified(reader), archive_size).await?;
         let root = decoder.open_root().await?;
         let path = OsStr::from_bytes(file_path).to_os_string();
         let file = root
-- 
2.39.2





More information about the pbs-devel mailing list