Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
9947834f
Commit
9947834f
authored
May 12, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address code review, add comments
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
73c413e3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
utils/diff.go
utils/diff.go
+1
-1
utils/diffenum.go
utils/diffenum.go
+6
-4
utils/diffenum_test.go
utils/diffenum_test.go
+1
-1
No files found.
utils/diff.go
View file @
9947834f
...
...
@@ -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
(
...
...
utils/diffenum.go
View file @
9947834f
...
...
@@ -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
)
...
...
utils/diffenum_test.go
View file @
9947834f
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment