Trait storage_proofs_core::drgraph::Graph

source ·
pub trait Graph<H: Hasher>: Debug + Clone + PartialEq + Eq {
    type Key: Debug;

    // Required methods
    fn parents(&self, node: usize, parents: &mut [u32]) -> Result<()>;
    fn size(&self) -> usize;
    fn degree(&self) -> usize;
    fn new(
        nodes: usize,
        base_degree: usize,
        expansion_degree: usize,
        porep_id: PoRepID,
        api_version: ApiVersion,
    ) -> Result<Self>;
    fn seed(&self) -> [u8; 28];
    fn create_key(
        &self,
        id: &H::Domain,
        node: usize,
        parents: &[u32],
        parents_data: &[u8],
        exp_parents_data: Option<&[u8]>,
    ) -> Result<Self::Key>;

    // Provided methods
    fn expected_size(&self) -> usize { ... }
    fn merkle_tree_depth<U: 'static + PoseidonArity>(&self) -> u64 { ... }
}
Expand description

A depth robust graph.

Required Associated Types§

Required Methods§

source

fn parents(&self, node: usize, parents: &mut [u32]) -> Result<()>

Returns a sorted list of all parents of this node. The parents may be repeated.

If a node doesn’t have any parents, then this vector needs to return a vector where the first element is the requested node. This will be used as indicator for nodes without parents.

The parents parameter is used to store the result. This is done fore performance reasons, so that the vector can be allocated outside this call.

source

fn size(&self) -> usize

Returns the size of the graph (number of nodes).

source

fn degree(&self) -> usize

Returns the number of parents of each node in the graph.

source

fn new( nodes: usize, base_degree: usize, expansion_degree: usize, porep_id: PoRepID, api_version: ApiVersion, ) -> Result<Self>

source

fn seed(&self) -> [u8; 28]

source

fn create_key( &self, id: &H::Domain, node: usize, parents: &[u32], parents_data: &[u8], exp_parents_data: Option<&[u8]>, ) -> Result<Self::Key>

Creates the encoding key. The algorithm for that is Sha256(id | encodedParentNode1 | encodedParentNode1 | ...).

Provided Methods§

source

fn expected_size(&self) -> usize

Returns the expected size of all nodes in the graph.

source

fn merkle_tree_depth<U: 'static + PoseidonArity>(&self) -> u64

Returns the merkle tree depth.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<H: Hasher> Graph<H> for BucketGraph<H>

§

type Key = <H as Hasher>::Domain