Commit 9947834f authored by Jeromy's avatar Jeromy

address code review, add comments

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 73c413e3
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
dag "github.com/ipfs/go-ipfs/merkledag" dag "github.com/ipfs/go-ipfs/merkledag"
node "github.com/ipfs/go-ipld-node"
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid" cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
) )
const ( const (
......
...@@ -6,8 +6,8 @@ import ( ...@@ -6,8 +6,8 @@ import (
mdag "github.com/ipfs/go-ipfs/merkledag" mdag "github.com/ipfs/go-ipfs/merkledag"
node "github.com/ipfs/go-ipld-node"
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid" cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
) )
// DiffEnumerate fetches every object in the graph pointed to by 'to' that is // 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,13 +55,15 @@ func DiffEnumerate(ctx context.Context, dserv node.NodeGetter, from, to *cid.Cid
return nil return nil
} }
// if both bef and aft are not nil, then that signifies bef was replaces with aft.
// if bef is nil and aft is not, that means aft was newly added
// if aft is nil and bef is not, that means bef was deleted
type diffpair struct { type diffpair struct {
bef, aft *cid.Cid bef, aft *cid.Cid
} }
// getLinkDiff returns a changset (minimum edit distance style) between nodes // getLinkDiff returns a changeset between nodes 'a' and 'b'. Currently does
// 'a' and 'b'. Currently does not log deletions as our usecase doesnt call for // not log deletions as our usecase doesnt call for this.
// this.
func getLinkDiff(a, b node.Node) []diffpair { func getLinkDiff(a, b node.Node) []diffpair {
have := make(map[string]*node.Link) have := make(map[string]*node.Link)
names := make(map[string]*node.Link) names := make(map[string]*node.Link)
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
dag "github.com/ipfs/go-ipfs/merkledag" dag "github.com/ipfs/go-ipfs/merkledag"
mdtest "github.com/ipfs/go-ipfs/merkledag/test" mdtest "github.com/ipfs/go-ipfs/merkledag/test"
node "github.com/ipfs/go-ipld-node"
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid" cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
) )
func buildNode(name string, desc map[string]ndesc, out map[string]node.Node) node.Node { func buildNode(name string, desc map[string]ndesc, out map[string]node.Node) node.Node {
......
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