From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <c.ebner@proxmox.com>
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 B4BDB91EC7
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 17:52:37 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9172762AD
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 17:52:37 +0200 (CEST)
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 <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 17:52:36 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9AF66451EA
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 17:52:36 +0200 (CEST)
Message-ID: <808c35a3-28d4-4328-b5bb-ed6d52734fbc@proxmox.com>
Date: Thu, 4 Apr 2024 17:52:35 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>,
 =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
References: <20240328123707.336951-1-c.ebner@proxmox.com>
 <20240328123707.336951-31-c.ebner@proxmox.com>
 <1712223826.oqotconz8r.astroid@yuna.none>
Content-Language: en-US, de-DE
From: Christian Ebner <c.ebner@proxmox.com>
In-Reply-To: <1712223826.oqotconz8r.astroid@yuna.none>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.370 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_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible
 spam tricks
 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
Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup 30/58] catalog: shell:
 redirect payload reader for split streams
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 04 Apr 2024 15:52:37 -0000

On 4/4/24 11:49, Fabian Grünbichler wrote:
> On March 28, 2024 1:36 pm, 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@proxmox.com>
>> ---
>> changes since version 2:
>> - use mpxar and ppxar file extensions
>> - use pxar fuse reader helper
>>
>>   proxmox-backup-client/src/catalog.rs | 18 ++++++++++++++++--
>>   1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
>> index 2073e058d..3e52880b9 100644
>> --- a/proxmox-backup-client/src/catalog.rs
>> +++ b/proxmox-backup-client/src/catalog.rs
>> @@ -181,7 +181,10 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
>>           }
>>       };
>>   
>> -    let server_archive_name = if archive_name.ends_with(".pxar") {
>> +    let server_archive_name = if archive_name.ends_with(".pxar")
>> +        || archive_name.ends_with(".mpxar")
>> +        || archive_name.ends_with(".ppxar")
>> +    {
> 
> as with mount - there is a call to get_pxar_archive_names betwee this
> hunk and the next one (introduced by the previous patch), shouldn't that
> just be moved up here?

But this just adds the `.didx` postfix to the filename, not creating the 
possible split archive names just yet. I left this in place as is.

> 
>>           format!("{}.didx", archive_name)
>>       } else {
>>           bail!("Can only mount pxar archives.");
>> @@ -216,7 +219,18 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
>>       )
>>       .await?;
>>   
>> -    let decoder = pbs_pxar_fuse::Accessor::new(reader, archive_size).await?;
>> +    let decoder = if let Some(payload_archive_name) = payload_archive_name {
>> +        let (payload_reader, _) = helper::get_pxar_fuse_reader(
>> +            &payload_archive_name,
>> +            client.clone(),
>> +            &manifest,
>> +            crypt_config.clone(),
>> +        )
>> +        .await?;
>> +        pbs_pxar_fuse::Accessor::new(reader, archive_size, Some(payload_reader)).await?
>> +    } else {
>> +        pbs_pxar_fuse::Accessor::new(reader, archive_size, None).await?
>> +    };
> 
> we have this exact pattern twice at least as well, once for mount, once
> for the catalog.. in fact, all four calls to helpers::get_pxar_fuse_reader
> are in those two call sites, so probably the helper should just be that
> whole sequence instead (or the existing helper made internal to a new
> helper for this sequence)? :)

Yes, I moved this and the same code for the mount part into a helper 
function and merged this now rather unspectacular patch with the 
previous one also touching the catalog shell restore functionality.
Didn't make sense anymore to keep them separate.

> 
>>   
>>       client.download(CATALOG_NAME, &mut tmpfile).await?;
>>       let index = DynamicIndexReader::new(tmpfile)
>> -- 
>> 2.39.2
>>
>>
>>
>> _______________________________________________
>> pbs-devel mailing list
>> pbs-devel@lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>>
>>
>>
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
>