mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
merkledag: Remove cached Node.node
License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
This commit is contained in:

committed by
Shanti Bouchez-Mongardé

parent
b3c9922c7b
commit
8f8020e86f
@ -48,9 +48,6 @@ type Link struct {
|
|||||||
|
|
||||||
// multihash of the target object
|
// multihash of the target object
|
||||||
Hash mh.Multihash
|
Hash mh.Multihash
|
||||||
|
|
||||||
// a ptr to the actual node for graph manipulation
|
|
||||||
node *Node
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type LinkSlice []*Link
|
type LinkSlice []*Link
|
||||||
@ -78,10 +75,6 @@ func MakeLink(n *Node) (*Link, error) {
|
|||||||
|
|
||||||
// GetNode returns the MDAG Node that this link points to
|
// GetNode returns the MDAG Node that this link points to
|
||||||
func (l *Link) GetNode(ctx context.Context, serv DAGService) (*Node, error) {
|
func (l *Link) GetNode(ctx context.Context, serv DAGService) (*Node, error) {
|
||||||
if l.node != nil {
|
|
||||||
return l.node, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return serv.Get(ctx, key.Key(l.Hash))
|
return serv.Get(ctx, key.Key(l.Hash))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +85,6 @@ func (n *Node) AddNodeLink(name string, that *Node) error {
|
|||||||
lnk, err := MakeLink(that)
|
lnk, err := MakeLink(that)
|
||||||
|
|
||||||
lnk.Name = name
|
lnk.Name = name
|
||||||
lnk.node = that
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -122,7 +114,6 @@ func (n *Node) AddRawLink(name string, l *Link) error {
|
|||||||
Name: name,
|
Name: name,
|
||||||
Size: l.Size,
|
Size: l.Size,
|
||||||
Hash: l.Hash,
|
Hash: l.Hash,
|
||||||
node: l.node,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -158,7 +149,6 @@ func (n *Node) GetNodeLink(name string) (*Link, error) {
|
|||||||
Name: l.Name,
|
Name: l.Name,
|
||||||
Size: l.Size,
|
Size: l.Size,
|
||||||
Hash: l.Hash,
|
Hash: l.Hash,
|
||||||
node: l.node,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user