public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 1/3] sync: return File in load_file_into
Date: Mon, 27 Apr 2026 10:49:47 +0200	[thread overview]
Message-ID: <20260427084952.303245-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20260427084952.303245-1-f.gruenbichler@proxmox.com>

since only manifests are valid blobs, indices are not. this also makes a
CRC error manifest itself as error, instead of masking as "snapshot
disappeared".

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/server/pull.rs |  5 ++++-
 src/server/sync.rs | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 42c34732f..020dbf508 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -653,7 +653,7 @@ async fn pull_snapshot<'a>(
 
     let mut tmp_manifest_name = manifest_name.clone();
     tmp_manifest_name.set_extension("tmp");
-    let Some(tmp_manifest_blob) = reader
+    let Some(mut tmp_manifest_file) = reader
         .load_file_into(MANIFEST_BLOB_NAME.as_ref(), &tmp_manifest_name)
         .await
         .with_context(|| prefix.clone())?
@@ -661,6 +661,9 @@ async fn pull_snapshot<'a>(
         return Ok(sync_stats);
     };
 
+    let tmp_manifest_blob =
+        DataBlob::load_from_reader(&mut tmp_manifest_file).with_context(|| prefix.clone())?;
+
     let backend = &params.target.backend;
 
     let fetch_log = async |crypt_config: Option<Arc<CryptConfig>>| {
diff --git a/src/server/sync.rs b/src/server/sync.rs
index 92449ff98..d0d3ab31a 100644
--- a/src/server/sync.rs
+++ b/src/server/sync.rs
@@ -106,7 +106,7 @@ pub(crate) trait SyncSourceReader: Send + Sync {
     /// Asynchronously loads a file from the source into a local file.
     /// `filename` is the name of the file to load from the source.
     /// `into` is the path of the local file to load the source file into.
-    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error>;
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error>;
 
     /// Tries to fetch the client log from the source and save it into a local file.
     async fn try_fetch_client_log(
@@ -146,7 +146,7 @@ impl SyncSourceReader for RemoteSourceReader {
         Ok(Arc::new(chunk_reader))
     }
 
-    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error> {
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error> {
         let mut tmp_file = std::fs::OpenOptions::new()
             .write(true)
             .create(true)
@@ -174,7 +174,7 @@ impl SyncSourceReader for RemoteSourceReader {
             };
         };
         tmp_file.rewind()?;
-        Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
+        Ok(Some(tmp_file))
     }
 
     async fn try_fetch_client_log(
@@ -245,7 +245,7 @@ impl SyncSourceReader for LocalSourceReader {
         Ok(Arc::new(chunk_reader))
     }
 
-    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<DataBlob>, Error> {
+    async fn load_file_into(&self, filename: &str, into: &Path) -> Result<Option<File>, Error> {
         let mut tmp_file = std::fs::OpenOptions::new()
             .write(true)
             .create(true)
@@ -256,7 +256,7 @@ impl SyncSourceReader for LocalSourceReader {
         from_path.push(filename);
         tmp_file.write_all(std::fs::read(from_path)?.as_slice())?;
         tmp_file.rewind()?;
-        Ok(DataBlob::load_from_reader(&mut tmp_file).ok())
+        Ok(Some(tmp_file))
     }
 
     async fn try_fetch_client_log(
-- 
2.47.3





  reply	other threads:[~2026-04-27  8:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  8:49 [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler
2026-04-27  8:49 ` Fabian Grünbichler [this message]
2026-04-27  8:49 ` [PATCH proxmox-backup 2/3] pull: do not allow archive fetching to return no archive Fabian Grünbichler
2026-04-27  8:49 ` [PATCH proxmox-backup 3/3] pull: move logging of disappeared snapshots Fabian Grünbichler
2026-04-27  9:04 ` [PATCH proxmox-backup 0/3] sync: clean up manifest/archive load handling Fabian Grünbichler

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=20260427084952.303245-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal