public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] encoder: merge create_file and create_file_do
Date: Mon, 01 Jul 2024 13:22:54 +0200	[thread overview]
Message-ID: <1719832960.zmdqlhmssn.astroid@yuna.none> (raw)
In-Reply-To: <20240312100926.62899-1-c.ebner@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


      parent reply	other threads:[~2024-07-01 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 10:09 Christian Ebner
2024-03-12 10:13 ` Christian Ebner
2024-07-01 11:22 ` Fabian Grünbichler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1719832960.zmdqlhmssn.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal