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

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Sep 27 14:08:49 CEST 2023


On Fri, Sep 22, 2023 at 09:16:02AM +0200, Christian Ebner wrote:
> 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 {

Not very happy about that. It was meant to be an opaque type that you
can't just create easily.
But oh well... if we need it...
Better than using u64 directly.

> +        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