Commit 32d30ab5 authored by Kevin Atkinson's avatar Kevin Atkinson

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: default avatarKevin Atkinson <k@kevina.org>
parent 43833d71
...@@ -114,6 +114,9 @@ func decodeBlock(b blocks.Block) (node.Node, error) { ...@@ -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) { 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) node, err := n.Get(ctx, c)
if err != nil { if err != nil {
return nil, err return nil, err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment