[pbs-devel] [RFC v2 proxmox-backup 13/36] client: backup: early check for fixed index type

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Mar 11 15:57:31 CET 2024


On March 5, 2024 10:26 am, 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 1:
> - no changes
> 
>  proxmox-backup-client/src/main.rs | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
> index e3445b7b..256080be 100644
> --- a/proxmox-backup-client/src/main.rs
> +++ b/proxmox-backup-client/src/main.rs
> @@ -194,6 +194,9 @@ async fn backup_directory<P: AsRef<Path>>(
>  ) -> Result<BackupStats, Error> {
>      let pxar_stream = PxarBackupStream::open(dir_path.as_ref(), catalog, pxar_create_options)?;
>      let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size);
> +    if upload_options.fixed_size.is_some() {
> +        bail!("cannot backup directory with fixed chunk size!");
> +    }

nit: while we're at it - why not do it first thing here before creating
the streams? it does happen piece by piece later in the series, but
could just happen here already.

>  
>      let (tx, rx) = mpsc::channel(10); // allow to buffer 10 chunks
>  
> @@ -206,9 +209,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