From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id BB31B1FF0B7 for ; Mon, 30 Nov 2026 11:03:07 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0A0B5209A7; Mon, 30 Nov 2026 11:03:07 +0100 (CET) From: Dietmar Maurer 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 Message-ID: <20261130100300.79179-1-dietmar@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.485 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: FM2CHTCGEYT63UF57JKLLPZ4EQOM4F6N X-Message-ID-Hash: FM2CHTCGEYT63UF57JKLLPZ4EQOM4F6N X-MailFrom: dietmar@zilli.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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; + /// 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>, separate_payload_stream: bool, + mut on_entry: Option, ) -> Result<(Self, Option), 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>, separate_payload_stream: bool, + on_entry: Option, ) -> Result<(Self, Option), 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>( 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