Struct chain_storage::BlockInfo
source · pub struct BlockInfo {
id: Value,
parent_id: Value,
chain_length: u32,
parent_ref_count: u32,
tags_ref_count: u32,
}
Expand description
A structure that holds the information about a blocks, that is needed to maintain consistency of the storage. This include the ID of the blocks, the ID of its parent and the length of the block chain for the given block.
Fields§
§id: Value
§parent_id: Value
§chain_length: u32
§parent_ref_count: u32
Implementations§
source§impl BlockInfo
impl BlockInfo
pub fn new<A: Into<Value>, B: Into<Value>>( id: A, parent_id: B, chain_length: u32 ) -> Self
pub fn id(&self) -> &Value
pub fn parent_id(&self) -> &Value
pub fn chain_length(&self) -> u32
pub(crate) fn ref_count(&self) -> u32
pub(crate) fn parent_ref_count(&self) -> u32
pub(crate) fn add_parent_ref(&mut self)
pub(crate) fn remove_parent_ref(&mut self)
pub(crate) fn add_tag_ref(&mut self)
pub(crate) fn remove_tag_ref(&mut self)
pub(crate) fn serialize(&self) -> Result<Vec<u8>, Error>
pub(crate) fn deserialize<R: Read, T: Into<Value>>( r: R, id_size: usize, id: T ) -> Result<Self, Error>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for BlockInfo
impl Send for BlockInfo
impl Sync for BlockInfo
impl Unpin for BlockInfo
impl UnwindSafe for BlockInfo
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