From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry
Date: Mon, 30 Nov 2026 11:03:00 +0100 [thread overview]
Message-ID: <20261130100300.79179-1-dietmar@proxmox.com> (raw)
A graphical client wants to show which file a running backup is at.
Byte counts alone can mislead: a sparse file, such as a core dump,
can be read for a long time while the counter climbs far beyond the
data size on disk.
The archiver already calls a per-entry callback, but the stream
hardwired it to a debug log line. Callers can now pass their own
callback, which runs in addition to the log line. The command line
client passes none, so its behavior is unchanged.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pbs-client/src/pxar_backup_stream.rs | 17 ++++++++++++++++-
proxmox-backup-client/src/main.rs | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/pbs-client/src/pxar_backup_stream.rs b/pbs-client/src/pxar_backup_stream.rs
index 430eee01f..ed179bddf 100644
--- a/pbs-client/src/pxar_backup_stream.rs
+++ b/pbs-client/src/pxar_backup_stream.rs
@@ -22,6 +22,9 @@ use pbs_datastore::catalog::{BackupCatalogWriter, CatalogWriter};
use crate::inject_reused_chunks::InjectChunks;
use crate::pxar::create::PxarWriters;
+/// Called with the archive-relative path of each entry before it is encoded.
+pub type PxarEntryCallback = Box<dyn FnMut(&Path) + Send>;
+
/// Stream implementation to encode and upload .pxar archives.
///
/// The hyper client needs an async Stream for file upload, so we
@@ -50,6 +53,7 @@ impl PxarBackupStream {
options: crate::pxar::PxarCreateOptions,
boundaries: Option<mpsc::Sender<InjectChunks>>,
separate_payload_stream: bool,
+ mut on_entry: Option<PxarEntryCallback>,
) -> Result<(Self, Option<Self>), Error> {
let buffer_size = 256 * 1024;
@@ -97,6 +101,9 @@ impl PxarBackupStream {
crate::pxar::Flags::DEFAULT,
move |path| {
debug!("{:?}", path);
+ if let Some(on_entry) = on_entry.as_mut() {
+ on_entry(path);
+ }
Ok(())
},
options,
@@ -145,10 +152,18 @@ impl PxarBackupStream {
options: crate::pxar::PxarCreateOptions,
boundaries: Option<mpsc::Sender<InjectChunks>>,
separate_payload_stream: bool,
+ on_entry: Option<PxarEntryCallback>,
) -> Result<(Self, Option<Self>), Error> {
let dir = nix::dir::Dir::open(dirname, OFlag::O_DIRECTORY, Mode::empty())?;
- Self::new(dir, catalog, options, boundaries, separate_payload_stream)
+ Self::new(
+ dir,
+ catalog,
+ options,
+ boundaries,
+ separate_payload_stream,
+ on_entry,
+ )
}
}
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 5238a75ea..156e457de 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -281,6 +281,7 @@ async fn backup_directory<P: AsRef<Path>>(
pxar_create_options,
Some(payload_boundaries_tx),
payload_target.is_some(),
+ None,
)?;
let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size, None, None);
--
2.47.3
next reply other threads:[~2026-11-30 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:03 Dietmar Maurer [this message]
2026-12-01 2:27 ` applied: [PATCH proxmox-backup] client: pxar: let backup stream callers see each archived entry Thomas Lamprecht
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=20261130100300.79179-1-dietmar@proxmox.com \
--to=dietmar@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