From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E043C786D5 for ; Fri, 30 Apr 2021 11:41:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DC5BD266C6 for ; Fri, 30 Apr 2021 11:41:36 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BDFA226217 for ; Fri, 30 Apr 2021 11:41:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8BCF5428B9 for ; Fri, 30 Apr 2021 11:41:35 +0200 (CEST) Date: Fri, 30 Apr 2021 11:41:34 +0200 From: Wolfgang Bumiller To: Hannes Laimer Cc: pbs-devel@lists.proxmox.com Message-ID: <20210430094134.2uu22su7wb3hklgk@wobu-vie.proxmox.com> References: <20210429110016.1467670-1-h.laimer@proxmox.com> <20210429110016.1467670-3-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210429110016.1467670-3-h.laimer@proxmox.com> User-Agent: NeoMutt/20180716 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.021 Adjusted score from AWL reputation of From: address 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [index.rs] Subject: [pbs-devel] applied: [PATCH v5 proxmox-backup 2/4] add ctime and size function to IndexFile trait 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: , X-List-Received-Date: Fri, 30 Apr 2021 09:41:36 -0000 On Thu, Apr 29, 2021 at 01:00:14PM +0200, Hannes Laimer wrote: > Signed-off-by: Hannes Laimer > --- > needed for next patch in order to avoid duplicating code for fixed and > dynamic indexes > > src/backup/dynamic_index.rs | 8 ++++++++ > src/backup/fixed_index.rs | 8 ++++++++ > src/backup/index.rs | 2 ++ > 3 files changed, 18 insertions(+) > > diff --git a/src/backup/dynamic_index.rs b/src/backup/dynamic_index.rs > index 1619d8db..8321b295 100644 > --- a/src/backup/dynamic_index.rs > +++ b/src/backup/dynamic_index.rs > @@ -233,6 +233,14 @@ impl IndexFile for DynamicIndexReader { > }) > } > > + fn index_ctime(&self) -> i64 { > + self.ctime > + } > + > + fn index_size(&self) -> usize { > + self.size as usize > + } > + > fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)> { > let end_idx = self.index.len() - 1; > let end = self.chunk_end(end_idx); > diff --git a/src/backup/fixed_index.rs b/src/backup/fixed_index.rs > index ceb6fe29..ebf64456 100644 > --- a/src/backup/fixed_index.rs > +++ b/src/backup/fixed_index.rs > @@ -193,6 +193,14 @@ impl IndexFile for FixedIndexReader { > }) > } > > + fn index_ctime(&self) -> i64 { > + self.ctime > + } > + > + fn index_size(&self) -> usize { > + self.size as usize > + } > + > fn compute_csum(&self) -> ([u8; 32], u64) { > let mut csum = openssl::sha::Sha256::new(); > let mut chunk_end = 0; > diff --git a/src/backup/index.rs b/src/backup/index.rs > index c6bab56e..69788f80 100644 > --- a/src/backup/index.rs > +++ b/src/backup/index.rs > @@ -22,6 +22,8 @@ pub trait IndexFile { > fn index_digest(&self, pos: usize) -> Option<&[u8; 32]>; > fn index_bytes(&self) -> u64; > fn chunk_info(&self, pos: usize) -> Option; > + fn index_ctime(&self) -> i64; > + fn index_size(&self) -> usize; > > /// Get the chunk index and the relative offset within it for a byte offset > fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)>; > -- > 2.20.1