pub struct NodeBatch { /* private fields */ }
Expand description
Node batch that will be written into db atomically with other batches.
Implementations§
source§impl NodeBatch
impl NodeBatch
sourcepub fn new(
nodes: BTreeMap<NodeKey, Node>,
values: BTreeMap<(Version, KeyHash), Option<OwnedValue>>
) -> Self
pub fn new( nodes: BTreeMap<NodeKey, Node>, values: BTreeMap<(Version, KeyHash), Option<OwnedValue>> ) -> Self
Creates a new node batch
sourcepub fn nodes(&self) -> &BTreeMap<NodeKey, Node>
pub fn nodes(&self) -> &BTreeMap<NodeKey, Node>
Returns a reference to the current set of nodes.
sourcepub fn insert_node(&mut self, node_key: NodeKey, node: Node) -> Option<Node>
pub fn insert_node(&mut self, node_key: NodeKey, node: Node) -> Option<Node>
Insert a node into the batch.
sourcepub fn insert_value(
&mut self,
version: Version,
key_hash: KeyHash,
value: OwnedValue
)
pub fn insert_value( &mut self, version: Version, key_hash: KeyHash, value: OwnedValue )
Insert a node into the batch.
sourcepub fn values(&self) -> &BTreeMap<(Version, KeyHash), Option<Vec<u8>>>
pub fn values(&self) -> &BTreeMap<(Version, KeyHash), Option<Vec<u8>>>
Returns a reference to the current set of nodes.
sourcepub fn extend(
&mut self,
nodes: impl IntoIterator<Item = (NodeKey, Node)>,
values: impl IntoIterator<Item = ((Version, KeyHash), Option<OwnedValue>)>
)
pub fn extend( &mut self, nodes: impl IntoIterator<Item = (NodeKey, Node)>, values: impl IntoIterator<Item = ((Version, KeyHash), Option<OwnedValue>)> )
Extend a node batch.
Trait Implementations§
source§impl BorshDeserialize for NodeBatch
impl BorshDeserialize for NodeBatch
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl PartialEq for NodeBatch
impl PartialEq for NodeBatch
impl Eq for NodeBatch
impl StructuralPartialEq for NodeBatch
Auto Trait Implementations§
impl Freeze for NodeBatch
impl RefUnwindSafe for NodeBatch
impl Send for NodeBatch
impl Sync for NodeBatch
impl Unpin for NodeBatch
impl UnwindSafe for NodeBatch
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