From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 81B02B8D02 for ; Mon, 11 Mar 2024 15:59:02 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 61CD5B733 for ; Mon, 11 Mar 2024 15:58:32 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 11 Mar 2024 15:58:30 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A1F65403EC for ; Mon, 11 Mar 2024 15:58:30 +0100 (CET) Date: Mon, 11 Mar 2024 15:58:24 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20240305092703.126906-1-c.ebner@proxmox.com> <20240305092703.126906-19-c.ebner@proxmox.com> In-Reply-To: <20240305092703.126906-19-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1710166801.ikylurtnd5.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [RFC v2 proxmox-backup 18/36] client: mount: make split pxar archives mountable X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2024 14:59:02 -0000 On March 5, 2024 10:26 am, Christian Ebner wrote: > Cover the cases where the pxar archive was uploaded as split payload > data and metadata streams. Instantiate the required reader and > decoder instances to access the metadata and payload data archives. >=20 > Signed-off-by: Christian Ebner > --- > changes since version 1: > - no changes >=20 > proxmox-backup-client/src/mount.rs | 56 ++++++++++++++++++++++-------- > 1 file changed, 41 insertions(+), 15 deletions(-) >=20 > diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/s= rc/mount.rs > index 4a2f8335..c955a7da 100644 > --- a/proxmox-backup-client/src/mount.rs > +++ b/proxmox-backup-client/src/mount.rs > @@ -219,19 +219,22 @@ async fn mount_do(param: Value, pipe: Option) -> Result { > } > }; > =20 > - let server_archive_name =3D if archive_name.ends_with(".pxar") { > - if target.is_none() { > - bail!("use the 'mount' command to mount pxar archives"); > - } > - format!("{}.didx", archive_name) > - } else if archive_name.ends_with(".img") { > - if target.is_some() { > - bail!("use the 'map' command to map drive images"); > - } > - format!("{}.fidx", archive_name) > - } else { > - bail!("Can only mount/map pxar archives and drive images."); > - }; > + let server_archive_name =3D > + if archive_name.ends_with(".pxar") || archive_name.ends_with(".p= xar.meta") { > + if target.is_none() { > + bail!("use the 'mount' command to mount pxar archives"); > + } > + format!("{}.didx", archive_name) > + } else if archive_name.ends_with(".img") { > + if target.is_some() { > + bail!("use the 'map' command to map drive images"); > + } > + format!("{}.fidx", archive_name) > + } else if archive_name.ends_with(".pxar.pld") { > + bail!("Use corresponding pxar.meta archive to mount."); couldn't this just be mapped for convenience' sake? > + } else { > + bail!("Can only mount/map pxar archives and drive images."); > + }; > =20 > let client =3D BackupReader::start( > &client, > @@ -289,14 +292,37 @@ async fn mount_do(param: Value, pipe: Option) -> Result { > let most_used =3D index.find_most_used_chunks(8); > let chunk_reader =3D RemoteChunkReader::new( > client.clone(), > - crypt_config, > + crypt_config.clone(), > file_info.chunk_crypt_mode(), > most_used, > ); > let reader =3D BufferedDynamicReader::new(index, chunk_reader); > + > let archive_size =3D reader.archive_size(); > let reader: pbs_pxar_fuse::Reader =3D Arc::new(BufferedDynamicRe= adAt::new(reader)); > - let decoder =3D pbs_pxar_fuse::Accessor::new(reader, archive_siz= e).await?; > + > + let mut decoder =3D pbs_pxar_fuse::Accessor::new(reader, archive= _size).await?; > + > + if let Some(archive_base_name) =3D server_archive_name.strip_suf= fix(".pxar.meta.didx") { > + let payload_archive_name =3D format!("{archive_base_name}.px= ar.pld.didx"); > + let payload_index =3D client > + .download_dynamic_index(&manifest, &payload_archive_name= ) > + .await?; > + > + let payload_most_used =3D payload_index.find_most_used_chunk= s(8); > + let payload_chunk_reader =3D RemoteChunkReader::new( > + client.clone(), > + crypt_config, > + file_info.chunk_crypt_mode(), > + payload_most_used, > + ); > + > + let payload_reader =3D BufferedDynamicReader::new(payload_in= dex, payload_chunk_reader); > + let payload_reader: pbs_pxar_fuse::Reader =3D > + Arc::new(BufferedDynamicReadAt::new(payload_reader)); > + > + decoder =3D decoder.redirect_payload_input(payload_reader); > + } this code now exists twice, and will be introduced a third time for the catalog shell (somewhat factored out there). I think we'd just want a get_decoder helper somewhere that takes care of all of that? > =20 > let session =3D > pbs_pxar_fuse::Session::mount(decoder, options, false, Path:= :new(target.unwrap())) > --=20 > 2.39.2 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20