merkledag: optimize DagService GetLinks for Raw Nodes.
A Raw Node can not possible have links, so there is no need to retrive the node. Once Raw Nodes are in common usage this can likely make a big difference in the GC and other places that just care about the Links. License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
Kevin Atkinson committed
Nov 3, 2016 at 23:14 UTC
bfe7ad7ec30ebf0e9914ed1cf58076ffca51d119
1 file changed
+3
merkledag/merkledag.go
+3
@@ -114,6 +114,9 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
114
}
115
116
func (n *dagService) GetLinks(ctx context.Context, c *cid.Cid) ([]*node.Link, error) {
117
+ if c.Type() == cid.Raw {
118
+ return nil, nil
119
+ }
120
node, err := n.Get(ctx, c)
121
if err != nil {
122
return nil, err