[pbs-devel] [PATCH v6 proxmox-backup 27/65] api: datastore: attach optional payload chunk reader

Christian Ebner c.ebner at proxmox.com
Fri May 24 08:48:49 CEST 2024


On 5/21/24 15:12, Dominik Csapak wrote:

> 
> nit: this could be a bit more readable (IMHO) with 'transpose' (not 
> tested):
> 
> let payload_input = 
> pxar_name.strip_suffix(".mpxar.didx").map(|archive_base_name| {
>      let payload_archive_name = ....
>      get_local_pxar_reader(....)
> }).transpose()?;
> 
> let decoder = Accessor::new(reader, archive_size, payload_input).await?;
> 
> I generally find it more readable not calling a function twice in the 
> code in such cases,
> but let only the parameter change

Since the introduction of the `PxarVariant` to distinguish the variant 
of the reader instance, this is now refactored differently, but will 
keep your advice in mind if it pops up in another place, thanks!






More information about the pbs-devel mailing list