Skip to content

Commit 0d3a86e

Browse files
committed
address code review, add comments
License: MIT Signed-off-by: Jeromy <[email protected]>
1 parent 8f97786 commit 0d3a86e

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

merkledag/utils/diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77

88
dag "github.com/ipfs/go-ipfs/merkledag"
99

10-
node "github.com/ipfs/go-ipld-node"
1110
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
11+
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
1212
)
1313

1414
const (

merkledag/utils/diffenum.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
mdag "github.com/ipfs/go-ipfs/merkledag"
88

9-
node "github.com/ipfs/go-ipld-node"
109
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
10+
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
1111
)
1212

1313
// DiffEnumerate fetches every object in the graph pointed to by 'to' that is
@@ -55,13 +55,15 @@ func DiffEnumerate(ctx context.Context, dserv node.NodeGetter, from, to *cid.Cid
5555
return nil
5656
}
5757

58+
// if both bef and aft are not nil, then that signifies bef was replaces with aft.
59+
// if bef is nil and aft is not, that means aft was newly added
60+
// if aft is nil and bef is not, that means bef was deleted
5861
type diffpair struct {
5962
bef, aft *cid.Cid
6063
}
6164

62-
// getLinkDiff returns a changset (minimum edit distance style) between nodes
63-
// 'a' and 'b'. Currently does not log deletions as our usecase doesnt call for
64-
// this.
65+
// getLinkDiff returns a changeset between nodes 'a' and 'b'. Currently does
66+
// not log deletions as our usecase doesnt call for this.
6567
func getLinkDiff(a, b node.Node) []diffpair {
6668
have := make(map[string]*node.Link)
6769
names := make(map[string]*node.Link)

merkledag/utils/diffenum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
dag "github.com/ipfs/go-ipfs/merkledag"
99
mdtest "github.com/ipfs/go-ipfs/merkledag/test"
1010

11-
node "github.com/ipfs/go-ipld-node"
1211
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
12+
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
1313
)
1414

1515
func buildNode(name string, desc map[string]ndesc, out map[string]node.Node) node.Node {

pin/pin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type Pinner interface {
9090
// Update updates a recursive pin from one cid to another
9191
// this is more efficient than simply pinning the new one and unpinning the
9292
// old one
93-
Update(context.Context, *cid.Cid, *cid.Cid, bool) error
93+
Update(ctx context.Context, from, to *cid.Cid, unpin bool) error
9494

9595
// Check if a set of keys are pinned, more efficient than
9696
// calling IsPinned for each key

0 commit comments

Comments
 (0)