pub struct ChainBlock {
pub mutations: BTreeMap<TxnId, Vec<MutationRecord>>,
/* private fields */
}
Expand description
A single filesystem block belonging to a Chain
.
Fields§
§mutations: BTreeMap<TxnId, Vec<MutationRecord>>
Implementations§
Source§impl ChainBlock
impl ChainBlock
Sourcepub fn hash<'a, M, R>(last_hash: &'a [u8], mutations: M) -> Output<Sha256>where
M: IntoIterator<Item = (&'a TxnId, &'a R)> + 'a,
&'a R: IntoIterator<Item = &'a MutationRecord> + 'a,
pub fn hash<'a, M, R>(last_hash: &'a [u8], mutations: M) -> Output<Sha256>where
M: IntoIterator<Item = (&'a TxnId, &'a R)> + 'a,
&'a R: IntoIterator<Item = &'a MutationRecord> + 'a,
Compute the hash of a ChainBlock
with the given contents
Sourcepub fn pending_hash<'a, M, R, P>(
last_hash: &'a [u8],
mutations: M,
txn_id: &TxnId,
pending: P,
) -> Output<Sha256>where
M: IntoIterator<Item = (&'a TxnId, &'a R)> + 'a,
&'a R: IntoIterator<Item = &'a MutationRecord> + 'a,
P: IntoIterator<Item = &'a MutationRecord> + 'a,
pub fn pending_hash<'a, M, R, P>(
last_hash: &'a [u8],
mutations: M,
txn_id: &TxnId,
pending: P,
) -> Output<Sha256>where
M: IntoIterator<Item = (&'a TxnId, &'a R)> + 'a,
&'a R: IntoIterator<Item = &'a MutationRecord> + 'a,
P: IntoIterator<Item = &'a MutationRecord> + 'a,
Compute the hash of a ChainBlock
with the given contents and pending contents
Sourcepub fn with_txn<H: Into<Bytes>>(hash: H, txn_id: TxnId) -> Self
pub fn with_txn<H: Into<Bytes>>(hash: H, txn_id: TxnId) -> Self
Return a new, empty block with an empty mutation list for the given TxnId
.
Sourcepub fn with_mutations(
hash: Bytes,
mutations: BTreeMap<TxnId, Vec<MutationRecord>>,
) -> Self
pub fn with_mutations( hash: Bytes, mutations: BTreeMap<TxnId, Vec<MutationRecord>>, ) -> Self
Return a new, empty block with an the given mutation list for the given TxnId
.
Sourcepub fn append_delete(&mut self, txn_id: TxnId, key: Value)
pub fn append_delete(&mut self, txn_id: TxnId, key: Value)
Append a DELETE op to this ChainBlock
Sourcepub fn append_put(&mut self, txn_id: TxnId, key: Value, value: Scalar)
pub fn append_put(&mut self, txn_id: TxnId, key: Value, value: Scalar)
Append a PUT op to the this ChainBlock
Sourcepub fn current_hash(&self) -> Output<Sha256>
pub fn current_hash(&self) -> Output<Sha256>
The current hash of this block
Trait Implementations§
Source§impl Clone for ChainBlock
impl Clone for ChainBlock
Source§fn clone(&self) -> ChainBlock
fn clone(&self) -> ChainBlock
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ChainBlock
impl Debug for ChainBlock
Source§impl FromStream for ChainBlock
impl FromStream for ChainBlock
Source§impl GetSize for ChainBlock
impl GetSize for ChainBlock
Source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§impl<'en> IntoStream<'en> for ChainBlock
impl<'en> IntoStream<'en> for ChainBlock
Source§impl PartialEq for ChainBlock
impl PartialEq for ChainBlock
Source§impl<'en> ToStream<'en> for ChainBlock
impl<'en> ToStream<'en> for ChainBlock
impl Eq for ChainBlock
impl StructuralPartialEq for ChainBlock
Auto Trait Implementations§
impl !Freeze for ChainBlock
impl RefUnwindSafe for ChainBlock
impl Send for ChainBlock
impl Sync for ChainBlock
impl Unpin for ChainBlock
impl UnwindSafe for ChainBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> Match for F
impl<F> Match for F
Source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.Source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
Source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
Source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.Source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.Source§fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
Returns
Ok(T)
if self
can be cast into T
, otherwise calls on_err
.