Skip to content

Commit 2b4aa1a

Browse files
committed
fix json
License: MIT Signed-off-by: Hector Sanjuan <[email protected]>
1 parent 49051a3 commit 2b4aa1a

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

merkledag_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func TestFetchFailure(t *testing.T) {
340340
t.Fatal(err)
341341
}
342342

343-
err = top.AddNodeLinkClean(fmt.Sprintf("AA%d", i), nd)
343+
err = top.AddNodeLink(fmt.Sprintf("AA%d", i), nd)
344344
if err != nil {
345345
t.Fatal(err)
346346
}
@@ -353,7 +353,7 @@ func TestFetchFailure(t *testing.T) {
353353
t.Fatal(err)
354354
}
355355

356-
err = top.AddNodeLinkClean(fmt.Sprintf("BB%d", i), nd)
356+
err = top.AddNodeLink(fmt.Sprintf("BB%d", i), nd)
357357
if err != nil {
358358
t.Fatal(err)
359359
}
@@ -597,19 +597,19 @@ func TestEnumerateAsyncFailsNotFound(t *testing.T) {
597597
}
598598

599599
parent := new(ProtoNode)
600-
if err := parent.AddNodeLinkClean("a", a); err != nil {
600+
if err := parent.AddNodeLink("a", a); err != nil {
601601
t.Fatal(err)
602602
}
603603

604-
if err := parent.AddNodeLinkClean("b", b); err != nil {
604+
if err := parent.AddNodeLink("b", b); err != nil {
605605
t.Fatal(err)
606606
}
607607

608-
if err := parent.AddNodeLinkClean("c", c); err != nil {
608+
if err := parent.AddNodeLink("c", c); err != nil {
609609
t.Fatal(err)
610610
}
611611

612-
if err := parent.AddNodeLinkClean("d", d); err != nil {
612+
if err := parent.AddNodeLink("d", d); err != nil {
613613
t.Fatal(err)
614614
}
615615

@@ -696,7 +696,7 @@ func mkNodeWithChildren(getChild func() *ProtoNode, width int) *ProtoNode {
696696

697697
for i := 0; i < width; i++ {
698698
c := getChild()
699-
if err := cur.AddNodeLinkClean(fmt.Sprint(i), c); err != nil {
699+
if err := cur.AddNodeLink(fmt.Sprint(i), c); err != nil {
700700
panic(err)
701701
}
702702
}

node.go

-13
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@ func (n *ProtoNode) AddNodeLink(name string, that ipld.Node) error {
104104
return nil
105105
}
106106

107-
// AddNodeLinkClean adds a link to another node. without keeping a reference to
108-
// the child node
109-
func (n *ProtoNode) AddNodeLinkClean(name string, that ipld.Node) error {
110-
n.encoded = nil
111-
lnk, err := ipld.MakeLink(that)
112-
if err != nil {
113-
return err
114-
}
115-
n.AddRawLink(name, lnk)
116-
117-
return nil
118-
}
119-
120107
// AddRawLink adds a copy of a link to this node
121108
func (n *ProtoNode) AddRawLink(name string, l *ipld.Link) error {
122109
n.encoded = nil

utils/utils.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func addLink(ctx context.Context, ds ipld.DAGService, root *dag.ProtoNode, child
7575
// ensure no link with that name already exists
7676
_ = root.RemoveNodeLink(childname) // ignore error, only option is ErrNotFound
7777

78-
if err := root.AddNodeLinkClean(childname, childnd); err != nil {
78+
if err := root.AddNodeLink(childname, childnd); err != nil {
7979
return nil, err
8080
}
8181

@@ -127,7 +127,7 @@ func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.ProtoNode, path
127127
_ = e.tmp.Remove(ctx, root.Cid())
128128

129129
_ = root.RemoveNodeLink(path[0])
130-
err = root.AddNodeLinkClean(path[0], ndprime)
130+
err = root.AddNodeLink(path[0], ndprime)
131131
if err != nil {
132132
return nil, err
133133
}
@@ -186,7 +186,7 @@ func (e *Editor) rmLink(ctx context.Context, root *dag.ProtoNode, path []string)
186186
e.tmp.Remove(ctx, root.Cid())
187187

188188
_ = root.RemoveNodeLink(path[0])
189-
err = root.AddNodeLinkClean(path[0], nnode)
189+
err = root.AddNodeLink(path[0], nnode)
190190
if err != nil {
191191
return nil, err
192192
}

0 commit comments

Comments
 (0)