[pbs-devel] [RFC pxar 1/20] fix #3174: encoder: impl fn new for LinkOffset

Christian Ebner c.ebner at proxmox.com
Fri Sep 22 09:16:02 CEST 2023


Allows to generate a new LinkOffset for storing the offset of regular
files in the backup catalog, based on the provided archiver position.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/encoder/mod.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs
index 0d342ec..710ed98 100644
--- a/src/encoder/mod.rs
+++ b/src/encoder/mod.rs
@@ -31,6 +31,12 @@ pub use sync::Encoder;
 pub struct LinkOffset(u64);
 
 impl LinkOffset {
+    /// Create a new link from the raw byte offset.
+    #[inline]
+    pub fn new(raw: u64) -> Self {
+        Self(raw)
+    }
+
     /// Get the raw byte offset of this link.
     #[inline]
     pub fn raw(self) -> u64 {
-- 
2.39.2






More information about the pbs-devel mailing list