From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 372E41FF2A7
	for <inbox@lore.proxmox.com>; Mon,  1 Jul 2024 13:23:17 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 3E14B344DA;
	Mon,  1 Jul 2024 13:23:32 +0200 (CEST)
Date: Mon, 01 Jul 2024 13:22:54 +0200
From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
References: <20240312100926.62899-1-c.ebner@proxmox.com>
In-Reply-To: <20240312100926.62899-1-c.ebner@proxmox.com>
MIME-Version: 1.0
User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid)
Message-Id: <1719832960.zmdqlhmssn.astroid@yuna.none>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.051 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
Subject: Re: [pbs-devel] [PATCH proxmox-backup] encoder: merge create_file
 and create_file_do
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>
Reply-To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>

doesn't apply anymore, if this should still be done, please rebase+resend!

On March 12, 2024 11:09 am, Christian Ebner wrote:
> `create_file` only transforms the path to bytes before calling
> `create_file_do` with it. Since this is the only caller and the latter
> method is private, this can be merged into one method to reduce code.
> 
> Suggested-by: Dietmar Maurer <dietmar@proxmox.com>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>  src/encoder/mod.rs | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs
> index 0d342ec..21eb78a 100644
> --- a/src/encoder/mod.rs
> +++ b/src/encoder/mod.rs
> @@ -340,25 +340,14 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> {
>          file_name: &Path,
>          file_size: u64,
>      ) -> io::Result<FileImpl<'b, T>>
> -    where
> -        'a: 'b,
> -    {
> -        self.create_file_do(metadata, file_name.as_os_str().as_bytes(), file_size)
> -            .await
> -    }
> -
> -    async fn create_file_do<'b>(
> -        &'b mut self,
> -        metadata: &Metadata,
> -        file_name: &[u8],
> -        file_size: u64,
> -    ) -> io::Result<FileImpl<'b, T>>
>      where
>          'a: 'b,
>      {
>          self.check()?;
>  
>          let file_offset = self.position();
> +        let file_name = file_name.as_os_str().as_bytes();
> +
>          self.start_file_do(Some(metadata), file_name).await?;
>  
>          let header = format::Header::with_content_size(format::PXAR_PAYLOAD, file_size);
> -- 
> 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