address code review, add comments

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy 2017-05-12 22:04:12 -07:00
parent 8f97786e49
commit 0d3a86e8fc
4 changed files with 9 additions and 7 deletions

View File

@ -7,8 +7,8 @@ import (
dag "github.com/ipfs/go-ipfs/merkledag"
node "github.com/ipfs/go-ipld-node"
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
)
const (

View File

@ -6,8 +6,8 @@ import (
mdag "github.com/ipfs/go-ipfs/merkledag"
node "github.com/ipfs/go-ipld-node"
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
@ -55,13 +55,15 @@ func DiffEnumerate(ctx context.Context, dserv node.NodeGetter, from, to *cid.Cid
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 {
bef, aft *cid.Cid
}
// getLinkDiff returns a changset (minimum edit distance style) between nodes
// 'a' and 'b'. Currently does not log deletions as our usecase doesnt call for
// this.
// getLinkDiff returns a changeset between nodes 'a' and 'b'. Currently does
// not log deletions as our usecase doesnt call for this.
func getLinkDiff(a, b node.Node) []diffpair {
have := make(map[string]*node.Link)
names := make(map[string]*node.Link)

View File

@ -8,8 +8,8 @@ import (
dag "github.com/ipfs/go-ipfs/merkledag"
mdtest "github.com/ipfs/go-ipfs/merkledag/test"
node "github.com/ipfs/go-ipld-node"
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 {

View File

@ -90,7 +90,7 @@ type Pinner interface {
// Update updates a recursive pin from one cid to another
// this is more efficient than simply pinning the new one and unpinning the
// old one
Update(context.Context, *cid.Cid, *cid.Cid, bool) error
Update(ctx context.Context, from, to *cid.Cid, unpin bool) error
// Check if a set of keys are pinned, more efficient than
// calling IsPinned for each key