[pbs-devel] applied: [PATCH v3 proxmox-backup 18/58] client: backup: early check for fixed index type

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Apr 8 11:05:01 CEST 2024


same applies here - this makes sense even for the current code.

On March 28, 2024 1:36 pm, Christian Ebner wrote:
> Early return when the check fails, avoiding constuction of unused
> object instances.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> changes since version 2:
> - move to top of the function as intended
> 
>  proxmox-backup-client/src/main.rs | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
> index 74adf1b16..931c841c7 100644
> --- a/proxmox-backup-client/src/main.rs
> +++ b/proxmox-backup-client/src/main.rs
> @@ -192,6 +192,10 @@ async fn backup_directory<P: AsRef<Path>>(
>      pxar_create_options: pbs_client::pxar::PxarCreateOptions,
>      upload_options: UploadOptions,
>  ) -> Result<BackupStats, Error> {
> +    if upload_options.fixed_size.is_some() {
> +        bail!("cannot backup directory with fixed chunk size!");
> +    }
> +
>      let pxar_stream = PxarBackupStream::open(dir_path.as_ref(), catalog, pxar_create_options)?;
>      let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size);
>  
> @@ -206,9 +210,6 @@ async fn backup_directory<P: AsRef<Path>>(
>          }
>      });
>  
> -    if upload_options.fixed_size.is_some() {
> -        bail!("cannot backup directory with fixed chunk size!");
> -    }
>  
>      let stats = client
>          .upload_stream(archive_name, stream, upload_options)
> -- 
> 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