blob: 60b10d16da059265444bf88a5e7f3a28f61a2b23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#[derive(Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Node {
/// Version
v: String,
/// Parent Nodes, identified by cid
parents: Vec<crate::cid::Cid>,
/// The actual payload of the node, which is stored in another document identified by this cid
payload: crate::cid::Cid,
}
impl daglib::Node for Node {
type Id = crate::cid::Cid;
fn parent_ids(&self) -> Vec<Self::Id> {
self.parents.clone()
}
}
impl Node {
pub fn new(v: String, parents: Vec<crate::cid::Cid>, payload: crate::cid::Cid) -> Self {
Self { v, parents, payload }
}
}
|