From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D96461FF38F for ; Tue, 21 May 2024 12:21:48 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 108F716218; Tue, 21 May 2024 12:22:05 +0200 (CEST) Date: Tue, 21 May 2024 12:21:31 +0200 (CEST) From: Christian Ebner To: Dominik Csapak , Proxmox Backup Server development discussion Message-ID: <25568199.155.1716286891631@webmail.proxmox.com> In-Reply-To: <8e19f4c5-6d8d-4ff9-96d9-44342f6d25f4@proxmox.com> References: <20240514103421.289431-1-c.ebner@proxmox.com> <20240514103421.289431-5-c.ebner@proxmox.com> <8e19f4c5-6d8d-4ff9-96d9-44342f6d25f4@proxmox.com> MIME-Version: 1.0 X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev63 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 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 v6 pxar 04/14] encoder: add optional output writer for file payloads X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" > On 21.05.2024 12:06 CEST Dominik Csapak wrote: > > > one small comment inline > > On 5/14/24 12:33, Christian Ebner wrote: > [snip] > > diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs > > index da41733..99c3758 100644 > > --- a/src/encoder/mod.rs > > +++ b/src/encoder/mod.rs > > @@ -17,7 +17,7 @@ use endian_trait::Endian; > > > > use crate::binary_tree_array; > > use crate::decoder::{self, SeqRead}; > > -use crate::format::{self, GoodbyeItem}; > > +use crate::format::{self, GoodbyeItem, PayloadRef}; > > use crate::Metadata; > > > > pub mod aio; > > @@ -221,6 +221,9 @@ struct EncoderState { > > > > /// We need to keep track how much we have written to get offsets. > > write_position: u64, > > + > > + /// Track the bytes written to the payload writer > > + payload_write_position: u64, > > } > > > > impl EncoderState { > > @@ -278,6 +281,7 @@ impl<'a, T> std::convert::From<&'a mut T> for EncoderOutput<'a, T> { > > /// synchronous or `async` I/O objects in as output. > > pub(crate) struct EncoderImpl<'a, T: SeqWrite + 'a> { > > output: EncoderOutput<'a, T>, > > + payload_output: EncoderOutput<'a, Option>, > > state: EncoderState, > > parent: Option<&'a mut EncoderState>, > > finished: bool, > > @@ -306,12 +310,14 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { > > pub async fn new( > > output: EncoderOutput<'a, T>, > > metadata: &Metadata, > > + payload_output: Option, > > ) -> io::Result> { > > if !metadata.is_dir() { > > io_bail!("directory metadata must contain the directory mode flag"); > > } > > let mut this = Self { > > output, > > + payload_output: EncoderOutput::Owned(None), > > state: EncoderState::default(), > > parent: None, > > finished: false, > > @@ -323,6 +329,10 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { > > this.encode_metadata(metadata).await?; > > this.state.files_offset = this.position(); > > > > + if let Some(payload_output) = payload_output { > > + this.payload_output = EncoderOutput::Owned(Some(payload_output)); > > + } > > + > > you could do that above directly in the payload_output property > since you do change it to that anyway in patch 12/14 > > and should be semantically the same true, inlined this into the `EncoderImpl` instantiation, thanks! > > > Ok(this) > > } > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel