[pbs-devel] [PATCH v3 pxar 3/6] format: add helper type ContentRange

Christian Ebner c.ebner at proxmox.com
Wed Jun 12 10:23:57 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
perform additional consistency checks on these entries.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 2:
- limit fields to be pub(crate) only

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

diff --git a/src/format/mod.rs b/src/format/mod.rs
index 0648924..37ba99f 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(crate) fn check_payload_header_and_size(header: &Header, size: u64) -> io::R
 
     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(crate) content: Range<u64>,
+    // Optional payload ref
+    pub(crate) payload_ref: Option<PayloadRef>,
+}
-- 
2.39.2





More information about the pbs-devel mailing list