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>
This commit is contained in:
Kevin Atkinson 2016-11-03 23:14:57 -04:00
parent 1ca2d42889
commit bfe7ad7ec3

View File

@ -114,6 +114,9 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
}
func (n *dagService) GetLinks(ctx context.Context, c *cid.Cid) ([]*node.Link, error) {
if c.Type() == cid.Raw {
return nil, nil
}
node, err := n.Get(ctx, c)
if err != nil {
return nil, err