[pbs-devel] [PATCH v2 pxar 2/5] format: add helper type ContentRange

Christian Ebner c.ebner at proxmox.com
Tue Jun 11 15:29:43 CEST 2024


The new `ContentRange` type will be used to store content ranges to
be used when accessing a pxar archive via the decoder, but with
additional payload reference information in order to be able to
perfom additional consistency checks on these entires.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 1:
- not present in previous version

 src/format/mod.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/format/mod.rs b/src/format/mod.rs
index 746f39d..91ca9ea 100644
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -43,6 +43,7 @@ use std::fmt;
 use std::fmt::Display;
 use std::io;
 use std::mem::size_of;
+use std::ops::Range;
 use std::os::unix::ffi::OsStrExt;
 use std::path::Path;
 use std::time::{Duration, SystemTime};
@@ -844,3 +845,13 @@ pub fn check_payload_header_and_size(header: &Header, size: u64) -> io::Result<(
 
     Ok(())
 }
+
+/// Stores a content range to be accessed via the `Accessor` as well as the payload reference to
+/// perform consistency checks on payload references for archives accessed via split variant input.
+#[derive(Clone)]
+pub struct ContentRange {
+    // Range of the content
+    pub content: Range<u64>,
+    // Optional payload ref
+    pub payload_ref: Option<PayloadRef>,
+}
-- 
2.39.2





More information about the pbs-devel mailing list