summaryrefslogtreecommitdiffstats
path: root/src/backend/node.rs
blob: 7a649ca6aca34c01c197c5ec220e2936294df29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[derive(Debug, Eq, PartialEq, libipld::DagCbor)]
pub struct Node {
    /// Version
    v: String,

    /// Parent Nodes, identified by cid
    parents: Vec<crate::backend::Id>,

    /// The actual payload of the node, which is stored in another document identified by this cid
    payload: cid::Cid,
}

impl daglib::Node for Node {
    type Id = crate::backend::Id;

    fn parent_ids(&self) -> Vec<Self::Id> {
        self.parents.clone()
    }
}