Skip to main content

ChunkDeduplicationMap

Struct ChunkDeduplicationMap 

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

The ChunkDeduplicationMap stores the chunk size of the appropriate chunk.

Trait Implementations§

Source§

impl ChunkMap for ChunkDeduplicationMap

Source§

fn new(object_number: u64, chunkmap: BTreeMap<u64, Self::Value>) -> Self

returns a new ChunkDeduplicationMap with the given values.

Source§

fn new_empty(object_number: u64) -> Self

returns a new, empty ChunkDeduplicationMap with the given values.

Source§

type Value = u64

The type of the value stored in the map.
Source§

fn flush(&mut self) -> BTreeMap<u64, Self::Value>

Returns the inner map and replaces it with an empty map.
Source§

fn current_size(&self) -> usize

The encoded size of this map.
Source§

fn chunkmap(&self) -> &BTreeMap<u64, Self::Value>

Returns a reference to the inner map
Source§

fn object_number(&self) -> u64

Returns the corresponding object number of the inner map
Source§

fn append(&mut self, map: Self)

Appends another chunkmap to this map
Source§

fn set_target_size(&mut self, target_size: usize)

Reset the target size to the given value.
Source§

fn set_object_number(&mut self, object_number: u64)

Sets the appropriate object number
Source§

fn add_chunk_entry(&mut self, chunk_no: u64, value: Self::Value) -> bool

Tries to add a chunk entry.
Returns true, if the chunk no / value pair was added to the map.
Returns false, if the map is full (in this case, the pair was not added to the map).
Source§

fn is_full(&self) -> bool

Checks if the map is full (returns true if, returns false if not).
Source§

fn is_empty(&self) -> bool

Checks if the inner map is empty
Source§

fn decrypt_and_decode<K, A, D>( key: K, encryption_algorithm: A, data: &mut D, chunk_no: u64, ) -> Result<Self>
where K: AsRef<[u8]>, A: Borrow<EncryptionAlgorithm>, D: Read, Self: Sized,

Decrypts and decodes the chunk map by using the given key.
Source§

fn encode_map(&self) -> Vec<u8> ⓘ

Encodes the inner map
Source§

fn encrypt_encoded_map<K, A>( &self, key: K, encryption_algorithm: A, chunk_no: u64, ) -> Result<Vec<u8>>

Encrypts the inner encoded map
Source§

fn inner_structure_data<D: Read>( data: &mut D, ) -> Result<ChunkMapInnerStructureData>
where Self: HeaderCoding,

Returns the apprpropriate (encrypted) structure data
Source§

fn decrypt_and_decode_at<K, A, D>( key: K, encryption_algorithm: A, data: &D, chunk_no: u64, offset: u64, ) -> Result<Self>
where K: AsRef<[u8]>, A: Borrow<EncryptionAlgorithm>, D: ReadAt + ?Sized, Self: Sized + HeaderCoding,

Decrypts and decodes the chunk map by using the given key from given offset.
Source§

fn encode_and_encrypt<K, A>( &self, key: K, encryption_algorithm: A, chunk_no: u64, ) -> Result<Vec<u8>>

Encodes and encrypts the appropriate chunk map
Source§

impl Clone for ChunkDeduplicationMap

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChunkDeduplicationMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChunkDeduplicationMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ChunkDeduplicationMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Encryption for ChunkDeduplicationMap

Source§

fn crypto_nonce_padding() -> u8

The appropriate, type specific padding value for the nonce (see official zff documentation).
Source§

fn encrypt<K, M, A>( key: K, message: M, nonce_value: u64, algorithm: A, ) -> Result<Vec<u8>>
where K: AsRef<[u8]>, M: AsRef<[u8]>, A: Borrow<EncryptionAlgorithm>,

Encrypts the message, using the type specific nonce padding.
Source§

fn decrypt<K, M, A>( key: K, message: M, nonce_value: u64, algorithm: A, ) -> Result<Vec<u8>>
where K: AsRef<[u8]>, M: AsRef<[u8]>, A: Borrow<EncryptionAlgorithm>,

Decrypts the message, using the type specific nonce padding.
Source§

fn gen_crypto_nonce(nonce_value: u64) -> Result<Nonce<U12>>

Method to generate a 96-bit nonce for the appropriate message type (using the given value).
Source§

impl Eq for ChunkDeduplicationMap

Source§

impl HeaderCoding for ChunkDeduplicationMap

Source§

type Item = ChunkDeduplicationMap

the return value for decode_content(), decode_directly(), decode_for_key();
Source§

fn identifier() -> u32

returns the identifier (=Magic bytes) of the header.
Source§

fn version() -> u8

returns the version of the header. This reflects the default version of the appropriate header used in zff v3.
Source§

fn encode_content(&self) -> Vec<u8> ⓘ

encodes the (potentially encryptable) content of the struct.
Source§

fn encode_fixed_fields(&self) -> Vec<u8> ⓘ

encodes the (non-encryptable) content of the struct.
Source§

fn decode_content(data: &[u8]) -> Result<Self>

decodes the content of the header.
Source§

fn encode_header(&self) -> Vec<u8> ⓘ

encodes the header.
Source§

fn header_size(&self) -> usize

returns the size of the encoded header (in bytes)
Source§

fn encode_key<K: Into<String>>(key: K) -> Vec<u8> ⓘ

encodes a given key.
Source§

fn encode_directly(&self) -> Vec<u8> ⓘ

encodes the (header) value/object directly (= without key).
Source§

fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>

decodes the length of the header.
Source§

fn check_identifier<R: Read>(data: &mut R) -> bool

checks if the read identifier is valid for this header.
Source§

fn check_version<R: Read>(data: &mut R) -> Result<()>

checks if the read header / footer version is supported by this crate (only zff v3 headers / footers are supported).
Source§

fn decode_directly<R: Read>(data: &mut R) -> Result<Self::Item>

decodes the header directly.
Source§

fn decode_at<R: ReadAt + ?Sized>(data: &R, offset: u64) -> Result<Self::Item>

decodes the header at given offset.
Source§

fn struct_name() -> &'static str

Method to show the “name” of the appropriate struct (e.g. to use this with fmt::Display). This method is a helper method for fmt::Display and serde::ser::SerializeStruct (and for some debugging purposes).
Source§

impl PartialEq for ChunkDeduplicationMap

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ChunkDeduplicationMap

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V