mirror of
https://github.com/zaphar/merkle-dag.git
synced 2025-07-21 18:19:58 -04:00
Add an out_degree method for nodes.
This commit is contained in:
parent
4f3f554285
commit
2683a7baab
@ -120,4 +120,8 @@ where
|
||||
pub fn dependency_ids(&self) -> &BTreeSet<Vec<u8>> {
|
||||
&self.dependency_ids
|
||||
}
|
||||
|
||||
pub fn out_degree(&self) -> usize {
|
||||
self.dependency_ids.len()
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//! The MerkleDag backing store trait.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::{collections::BTreeMap, hash::Hash};
|
||||
|
||||
use crate::{hash::HashWriter, node::Node};
|
||||
|
||||
@ -38,7 +38,9 @@ where
|
||||
fn store(&mut self, node: Node<HW>) -> Result<()>;
|
||||
}
|
||||
|
||||
impl<HW> Store<HW> for BTreeMap<Vec<u8>, Node<HW>>
|
||||
pub type BTreeStore<HW> = BTreeMap<Vec<u8>, Node<HW>>;
|
||||
|
||||
impl<HW> Store<HW> for BTreeStore<HW>
|
||||
where
|
||||
HW: HashWriter,
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user