mirror of
https://github.com/zaphar/merkle-dag.git
synced 2025-07-22 18:50:13 -04:00
Documentation and naming for clarity
This commit is contained in:
parent
b12c92c9d4
commit
63fb67f7bf
@ -18,7 +18,8 @@ use crate::hash::HashWriter;
|
||||
use crate::node::Node;
|
||||
use crate::store::{Result, Store};
|
||||
|
||||
pub struct Gap<'dag, S, HW>
|
||||
/// An iterator over the missing nodes in a DAG given a set of root nodes.
|
||||
pub struct Missing<'dag, S, HW>
|
||||
where
|
||||
S: Store<HW>,
|
||||
HW: HashWriter,
|
||||
@ -27,15 +28,17 @@ where
|
||||
search_nodes: BTreeSet<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl<'dag, S, HW> Gap<'dag, S, HW>
|
||||
impl<'dag, S, HW> Missing<'dag, S, HW>
|
||||
where
|
||||
S: Store<HW>,
|
||||
HW: HashWriter,
|
||||
{
|
||||
/// Create an Iterator for the missing nodes given a set of root nodes.
|
||||
pub fn new(dag: &'dag Merkle<S, HW>, search_nodes: BTreeSet<Vec<u8>>) -> Self {
|
||||
Self { dag, search_nodes }
|
||||
}
|
||||
|
||||
/// Returns the next set of missing nodes in the iterator.
|
||||
pub fn next(&mut self) -> Result<Option<Vec<Node<HW>>>> {
|
||||
let nodes = self
|
||||
.dag
|
||||
|
@ -158,11 +158,11 @@ where
|
||||
pub fn gap_fill_iter<'dag, 'iter>(
|
||||
&'dag self,
|
||||
search_nodes: BTreeSet<Vec<u8>>,
|
||||
) -> Gap<'iter, S, HW>
|
||||
) -> Missing<'iter, S, HW>
|
||||
where
|
||||
'dag: 'iter,
|
||||
{
|
||||
Gap::new(self, search_nodes)
|
||||
Missing::new(self, search_nodes)
|
||||
}
|
||||
|
||||
/// Find the immediate next non descendant nodes in this graph for the given `search_nodes`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user