[pbs-devel] [PATCH v3 proxmox-backup 28/58] api: datastore: attach optional payload chunk reader

Christian Ebner c.ebner at proxmox.com
Thu Mar 28 13:36:37 CET 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 2:
- use new mpxar and ppxar file extensions

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

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 555ab88ae..76cff0864 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1724,9 +1724,15 @@ pub fn pxar_file_download(
         let (reader, archive_size) =
             get_local_pxar_reader(datastore.clone(), &manifest, &backup_dir, pxar_name)?;
 
+        let decoder = if let Some(archive_base_name) = pxar_name.strip_suffix(".mpxar.didx") {
+            let payload_archive_name = format!("{archive_base_name}.ppxar.didx");
+            let (payload_reader, _) =
+                get_local_pxar_reader(datastore, &manifest, &backup_dir, &payload_archive_name)?;
+            Accessor::new(reader, archive_size, Some(payload_reader)).await?
+        } else {
+            Accessor::new(reader, archive_size, None).await?
+        };
 
-
-        let decoder = Accessor::new(reader, archive_size, None).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