From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6003D1FF16B for ; Thu, 9 Jan 2025 15:07:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 13BBB10007; Thu, 9 Jan 2025 15:06:55 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 9 Jan 2025 15:06:20 +0100 Message-Id: <20250109140623.329770-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109140623.329770-1-c.ebner@proxmox.com> References: <20250109140623.329770-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [diff.rs] Subject: [pbs-devel] [PATCH v3 proxmox-backup 2/5] backup debug: diff: refactor backup reader creation 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" Move the backup reader instantiation code out of the corresponding helper function to its only call side. In preparation for adding the backup reader finish api call on termination. By moving this code, the backup reader can be handled more easily. No functional change intended. Signed-off-by: Christian Ebner --- changes since version 2: - not present in previous version src/bin/proxmox_backup_debug/diff.rs | 40 +++++++++++----------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/bin/proxmox_backup_debug/diff.rs b/src/bin/proxmox_backup_debug/diff.rs index 02389d0e5..fc65f3120 100644 --- a/src/bin/proxmox_backup_debug/diff.rs +++ b/src/bin/proxmox_backup_debug/diff.rs @@ -249,7 +249,22 @@ async fn open_dynamic_index( archive_name: &BackupArchiveName, params: &RepoParams, ) -> Result<(DynamicIndexReader, Accessor), Error> { - let backup_reader = create_backup_reader(snapshot, params).await?; + let backup_dir = match snapshot.parse::()? { + BackupPart::Dir(dir) => dir, + BackupPart::Group(_group) => { + bail!("A full snapshot path must be provided."); + } + }; + let client = connect(¶ms.repo)?; + let backup_reader = BackupReader::start( + &client, + params.crypt_config.clone(), + params.repo.store(), + ¶ms.namespace, + &backup_dir, + false, + ) + .await?; let (manifest, _) = backup_reader.download_manifest().await?; manifest.check_fingerprint(params.crypt_config.as_ref().map(Arc::as_ref))?; @@ -279,29 +294,6 @@ async fn open_dynamic_index( Ok((lookup_index, accessor)) } -async fn create_backup_reader( - snapshot: &str, - params: &RepoParams, -) -> Result, Error> { - let backup_dir = match snapshot.parse::()? { - BackupPart::Dir(dir) => dir, - BackupPart::Group(_group) => { - bail!("A full snapshot path must be provided."); - } - }; - let client = connect(¶ms.repo)?; - let backup_reader = BackupReader::start( - &client, - params.crypt_config.clone(), - params.repo.store(), - ¶ms.namespace, - &backup_dir, - false, - ) - .await?; - Ok(backup_reader) -} - /// Get a list of chunk digests for an index file. fn chunk_digests_for_index(index: &dyn IndexFile) -> Vec<&ChunkDigest> { let mut all_chunks = Vec::new(); -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel