VerityGenerator

Struct VerityGenerator 

Source
pub struct VerityGenerator { /* private fields */ }
Expand description

Merkle tree generator for data integrity verification.

Implementations§

Source§

impl VerityGenerator

Source

pub fn new(file: File, offset: u64, data_pages: u32) -> Result<Self>

Create a new instance VerityGenerator.

Source

pub fn initialize(&mut self) -> Result<()>

Initialize all digest values.

Source

pub fn set_digest( &mut self, level: u32, index: u32, digest: &[u8], ) -> Result<()>

Set digest value for Merkle entry at level with index.

Digests for data pages must be set by calling this method. It can also be used to set digest values for intermediate digest pages.

Source

pub fn generate_level_digests(&mut self, level: u32) -> Result<()>

Generate digest values from lower level digest pages.

Source

pub fn generate_root_digest(&mut self) -> Result<RafsDigest>

Generate Merkle root digest.

The returned Merkle tree root digest will be:

  • NON_EXIST_ENTRY_DIGEST if there’s no data page
  • digest of the data page if there’s only one data page
  • digest of the intermediate digest page if there’s more than one data pages
Source

pub fn generate_all_digests(&mut self) -> Result<RafsDigest>

Generate all intermediate and root digests for the Merkle tree.

Digests for data pages at level 1 must be set up by calling [set_digest()] before this function to generate intermediate and root digests.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.