From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 06/10] bin: debug: refactore dynamic index reader opening logic into helper
Date: Tue, 17 Nov 2026 16:28:10 +0100 [thread overview]
Message-ID: <20261117152814.491323-7-c.ebner@proxmox.com> (raw)
In-Reply-To: <20261117152814.491323-1-c.ebner@proxmox.com>
Factor out the logic to open a buffered local dynamic index reader
into a reusable helper function.
In preparation for supporting diff'ing split pxar archives, where
both the metadata and payload archive index readers need to be
opened.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
src/bin/proxmox_backup_debug/diff.rs | 37 +++++++++++++++++++---------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/bin/proxmox_backup_debug/diff.rs b/src/bin/proxmox_backup_debug/diff.rs
index a6e12f3d8..caacea21e 100644
--- a/src/bin/proxmox_backup_debug/diff.rs
+++ b/src/bin/proxmox_backup_debug/diff.rs
@@ -23,6 +23,7 @@ use pbs_client::tools::{
optional_ns_param,
};
use pbs_client::{BackupReader, BackupRepository, BackupTargetArgs, RemoteChunkReader};
+use pbs_datastore::BackupManifest;
use pbs_datastore::dynamic_index::{BufferedDynamicReader, DynamicIndexReader, LocalDynamicReadAt};
use pbs_datastore::index::IndexFile;
use pbs_key_config::decrypt_key;
@@ -246,25 +247,19 @@ struct OutputParams {
color: ColorMode,
}
-async fn open_dynamic_index(
- snapshot: &str,
+async fn open_dynamic_index_reader(
+ backup_reader: &Arc<BackupReader>,
+ manifest: &BackupManifest,
archive_name: &BackupArchiveName,
params: &RepoParams,
-) -> Result<(DynamicIndexReader, Accessor), Error> {
- let backup_reader = create_backup_reader(snapshot, params).await?;
-
- let (manifest, _) = backup_reader
- .download_manifest(params.ignore_missing_signature)
- .await?;
- manifest.check_fingerprint(params.crypt_config.as_ref().map(Arc::as_ref))?;
-
+) -> Result<(DynamicIndexReader, Arc<dyn ReadAt + Send + Sync>, u64), Error> {
let index = backup_reader
- .download_dynamic_index(&manifest, archive_name)
+ .download_dynamic_index(manifest, archive_name)
.await?;
let most_used = index.find_most_used_chunks(8);
let lookup_index = backup_reader
- .download_dynamic_index(&manifest, archive_name)
+ .download_dynamic_index(manifest, archive_name)
.await?;
let file_info = manifest.lookup_file_info(archive_name)?;
@@ -278,6 +273,24 @@ async fn open_dynamic_index(
let reader = BufferedDynamicReader::new(index, chunk_reader);
let archive_size = reader.archive_size();
let reader: Arc<dyn ReadAt + Send + Sync> = Arc::new(LocalDynamicReadAt::new(reader));
+
+ Ok((lookup_index, reader, archive_size))
+}
+
+async fn open_dynamic_index(
+ snapshot: &str,
+ archive_name: &BackupArchiveName,
+ params: &RepoParams,
+) -> Result<(DynamicIndexReader, Accessor), Error> {
+ let backup_reader = create_backup_reader(snapshot, params).await?;
+
+ let (manifest, _) = backup_reader
+ .download_manifest(params.ignore_missing_signature)
+ .await?;
+ manifest.check_fingerprint(params.crypt_config.as_ref().map(Arc::as_ref))?;
+
+ let (lookup_index, reader, archive_size) =
+ open_dynamic_index_reader(&backup_reader, &manifest, archive_name, params).await?;
let accessor = Accessor::new(pxar::PxarVariant::Unified(reader), archive_size).await?;
Ok((lookup_index, accessor))
--
2.47.3
next prev parent reply other threads:[~2026-11-17 15:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 15:28 [PATCH proxmox-backup/pxar 00/10] fix #8319: support split pxar archives in proxmox-backup-debug diff Christian Ebner
2026-11-17 15:28 ` [PATCH pxar 01/10] encoder: record metadata-only goodbye size for split archive files Christian Ebner
2026-11-17 15:28 ` [PATCH pxar 02/10] accessor: limit split archive file entry ranges to payload reference Christian Ebner
2026-11-17 15:28 ` [PATCH pxar 03/10] accessor: add convenience helper to get content's byte range Christian Ebner
2026-11-17 15:28 ` [PATCH proxmox-backup 04/10] datastore: index: return dedicated type for chunk offset trait method Christian Ebner
2026-11-17 15:28 ` [PATCH proxmox-backup 05/10] bin: debug: fix off-by-one error in last chunk lookup Christian Ebner
2026-11-17 15:28 ` Christian Ebner [this message]
2026-11-17 15:28 ` [PATCH proxmox-backup 07/10] bin: debug: refactor and deduplicate chunk range difference check Christian Ebner
2026-11-17 15:28 ` [PATCH proxmox-backup 08/10] fix #8319: bin: debug: support split pxar archives via diff Christian Ebner
2026-11-17 15:28 ` [PATCH proxmox-backup 09/10] bin: debug: use pxar related archive name helpers for diff Christian Ebner
2026-11-17 15:28 ` [PATCH proxmox-backup 10/10] docs: debug: mention split pxar archives for diff subcommand Christian Ebner
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=20261117152814.491323-7-c.ebner@proxmox.com \
--to=c.ebner@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