HashChunkDict

Struct HashChunkDict 

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

An implementation of ChunkDict based on HashMap.

Implementations§

Source§

impl HashChunkDict

Source

pub fn new(digester: Algorithm) -> Self

Create a new instance of HashChunkDict.

Source

pub fn hashmap(&self) -> &HashMap<RafsDigest, (Arc<ChunkWrapper>, AtomicU32)>

Get an immutable reference to the internal HashMap.

Source

pub fn from_commandline_arg( arg: &str, config: Arc<ConfigV2>, rafs_config: &RafsSuperConfig, ) -> Result<Arc<dyn ChunkDict>>

Parse commandline argument for chunk dictionary and load chunks into the dictionary.

Source

pub fn from_bootstrap_file( path: &Path, config: Arc<ConfigV2>, rafs_config: &RafsSuperConfig, ) -> Result<Self>

Load chunks from the RAFS filesystem into the chunk dictionary.

Trait Implementations§

Source§

impl ChunkDict for HashChunkDict

Source§

fn add_chunk(&mut self, chunk: Arc<ChunkWrapper>, digester: Algorithm)

Add a chunk into the cache.
Source§

fn get_chunk( &self, digest: &RafsDigest, uncompressed_size: u32, ) -> Option<&Arc<ChunkWrapper>>

Get a cached chunk from the cache.
Source§

fn get_blobs(&self) -> Vec<Arc<BlobInfo>>

Get all BlobInfo objects referenced by cached chunks.
Source§

fn get_blob_by_inner_idx(&self, idx: u32) -> Option<&Arc<BlobInfo>>

Get the BlobInfo object with inner index idx.
Source§

fn set_real_blob_idx(&self, inner_idx: u32, out_idx: u32)

Associate an external index with the inner index.
Source§

fn get_real_blob_idx(&self, inner_idx: u32) -> Option<u32>

Get the external index associated with an inner index.
Source§

fn digester(&self) -> Algorithm

Get the digest algorithm used to generate chunk digest.

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.