[pbs-devel] [RFC v2 proxmox-backup 20/36] api: datastore: attach optional payload chunk reader

Christian Ebner c.ebner at proxmox.com
Tue Mar 5 10:26:47 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 1:
- no changes

 src/api2/admin/datastore.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 843b9ce5..da10d543 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1723,9 +1723,15 @@ pub fn pxar_file_download(
         let (reader, archive_size) =
             get_local_pxar_reader(datastore.clone(), &manifest, &backup_dir, &pxar_name)?;
 
+        let mut decoder = Accessor::new(reader, archive_size).await?;
 
+        if let Some(archive_base_name) = pxar_name.strip_suffix(".pxar.meta.didx") {
+            let payload_archive_name = format!("{archive_base_name}.pxar.pld.didx");
+            let (payload_reader, _) =
+                get_local_pxar_reader(datastore, &manifest, &backup_dir, &payload_archive_name)?;
+            decoder = decoder.redirect_payload_input(payload_reader);
+        }
 
-        let decoder = Accessor::new(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