address code review, add comments
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
May 12, 2017 at 22:04 UTC
0d3a86e8fc3aaa4a96954aca2cc6d7b552a6d016
4 files changed
+9
-7
merkledag/utils/diff.go
+1
-1
@@ -7,8 +7,8 @@ import (
7
8
dag "github.com/ipfs/go-ipfs/merkledag"
9
10
- node "github.com/ipfs/go-ipld-node"
10
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
11
+ node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
12
)
13
14
const (
merkledag/utils/diffenum.go
+6
-4
@@ -6,8 +6,8 @@ import (
6
7
mdag "github.com/ipfs/go-ipfs/merkledag"
8
9
- node "github.com/ipfs/go-ipld-node"
9
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
10
+ node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
11
)
12
13
// 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
55
return nil
56
}
57
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
61
type diffpair struct {
62
bef, aft *cid.Cid
63
}
64
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.
67
func getLinkDiff(a, b node.Node) []diffpair {
68
have := make(map[string]*node.Link)
69
names := make(map[string]*node.Link)
merkledag/utils/diffenum_test.go
+1
-1
@@ -8,8 +8,8 @@ import (
8
dag "github.com/ipfs/go-ipfs/merkledag"
9
mdtest "github.com/ipfs/go-ipfs/merkledag/test"
10
11
- node "github.com/ipfs/go-ipld-node"
11
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
12
+ node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
13
)
14
15
func buildNode(name string, desc map[string]ndesc, out map[string]node.Node) node.Node {
pin/pin.go
+1
-1
@@ -90,7 +90,7 @@ type Pinner interface {
90
// Update updates a recursive pin from one cid to another
91
// this is more efficient than simply pinning the new one and unpinning the
92
// old one
93
- Update(context.Context, *cid.Cid, *cid.Cid, bool) error
93
+ Update(ctx context.Context, from, to *cid.Cid, unpin bool) error
94
95
// Check if a set of keys are pinned, more efficient than
96
// calling IsPinned for each key