[pbs-devel] [RFC v2 proxmox-backup 22/36] catalog: shell: redirect payload reader for split streams
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Mar 11 15:58:47 CET 2024
On March 5, 2024 10:26 am, Christian Ebner wrote:
> 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");
same here, I think this could just be mapped to the pxar.meta variant..
> + } 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
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>
>
>
More information about the pbs-devel
mailing list