pub struct Cache { /* private fields */ }
Expand description
Stores the mapping of nodes to their chunks.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn get(&self, index: NodeIndex) -> Option<&Vec<u8>>
pub fn get(&self, index: NodeIndex) -> Option<&Vec<u8>>
Gets a reference to the chunk coresponding to the node index.
Sourcepub fn insert(&mut self, index: NodeIndex, chunk: Vec<u8>) -> Option<Vec<u8>>
pub fn insert(&mut self, index: NodeIndex, chunk: Vec<u8>) -> Option<Vec<u8>>
Sets the chunk for the node index and returns the old value.
Sourcepub fn contains_node(&self, index: NodeIndex) -> bool
pub fn contains_node(&self, index: NodeIndex) -> bool
Returns true
if the cache contains a chunk for the specified node index.
Sourcepub fn fill(&mut self) -> Result<(), Error>
pub fn fill(&mut self) -> Result<(), Error>
Inserts missing nodes into the merkle tree that can be generated from existing nodes.
pub fn refresh(&mut self) -> Result<(), Error>
Trait Implementations§
impl StructuralPartialEq for Cache
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more