mirror of
https://github.com/zaphar/merkle-dag.git
synced 2025-07-21 18:19:58 -04:00
Fill in more documentation
This commit is contained in:
parent
3f2ddf308b
commit
4e18982d0c
@ -16,6 +16,7 @@ use std::hash::Hasher;
|
||||
|
||||
/// Utility Trait to specify that payloads must be serializable into bytes.
|
||||
pub trait ByteEncoder {
|
||||
/// Serialize self into bytes.
|
||||
fn bytes(&self) -> Vec<u8>;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ use node::Node;
|
||||
mod hash;
|
||||
mod node;
|
||||
|
||||
/// Node comparison values. In a given Merkle DAG a Node can come `After`, `Before`, be `Equivalent`, or `Uncomparable`.
|
||||
/// If the two nodes have the same id they are eqivalent. If two nodes are not part of the same sub graph within the DAG
|
||||
/// then they are Uncomparable. If one node is an ancestor of another DAG then that node comes before the other. If the
|
||||
/// reverse is true then that node comes after the other.
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum NodeCompare {
|
||||
After,
|
||||
@ -96,10 +100,12 @@ where
|
||||
self.nodes.get(id)
|
||||
}
|
||||
|
||||
/// Get the set of root node ids.
|
||||
pub fn get_roots(&self) -> &BTreeSet<[u8; HASH_LEN]> {
|
||||
&self.roots
|
||||
}
|
||||
|
||||
/// Get the map of all nodes in the DAG.
|
||||
pub fn get_nodes(&self) -> &BTreeMap<[u8; HASH_LEN], Node<N, HW, HASH_LEN>> {
|
||||
&self.nodes
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user