@cryptotaxi247 / kubo / commits / 8f8020e86

merkledag: Remove cached Node.node

License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>

Mildred Ki'Lya committed Feb 28, 2016 at 11:40 UTC 8f8020e86f0dcbf4cb43d74db8df84cbbce60618
1 file changed -10
merkledag/node.go
-10
@@ -48,9 +48,6 @@ type Link struct {
48
49 // multihash of the target object
50 Hash mh.Multihash
51 -
52 - // a ptr to the actual node for graph manipulation
53 - node *Node
51 }
52
53 type LinkSlice []*Link
@@ -78,10 +75,6 @@ func MakeLink(n *Node) (*Link, error) {
75
76 // GetNode returns the MDAG Node that this link points to
77 func (l *Link) GetNode(ctx context.Context, serv DAGService) (*Node, error) {
81 - if l.node != nil {
82 - return l.node, nil
83 - }
84 -
78 return serv.Get(ctx, key.Key(l.Hash))
79 }
80
@@ -92,7 +85,6 @@ func (n *Node) AddNodeLink(name string, that *Node) error {
85 lnk, err := MakeLink(that)
86
87 lnk.Name = name
95 - lnk.node = that
88 if err != nil {
89 return err
90 }
@@ -122,7 +114,6 @@ func (n *Node) AddRawLink(name string, l *Link) error {
114 Name: name,
115 Size: l.Size,
116 Hash: l.Hash,
125 - node: l.node,
117 })
118
119 return nil
@@ -158,7 +149,6 @@ func (n *Node) GetNodeLink(name string) (*Link, error) {
149 Name: l.Name,
150 Size: l.Size,
151 Hash: l.Hash,
161 - node: l.node,
152 }, nil
153 }
154 }