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
3a1aa2fa
Commit
3a1aa2fa
authored
Dec 01, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup, use a workgroup over channels
parent
f3ed34ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
merkledag.go
merkledag.go
+6
-3
No files found.
merkledag.go
View file @
3a1aa2fa
...
@@ -28,7 +28,10 @@ type DAGService interface {
...
@@ -28,7 +28,10 @@ type DAGService interface {
AddRecursive
(
*
Node
)
error
AddRecursive
(
*
Node
)
error
Get
(
u
.
Key
)
(
*
Node
,
error
)
Get
(
u
.
Key
)
(
*
Node
,
error
)
Remove
(
*
Node
)
error
Remove
(
*
Node
)
error
GetKeysAsync
(
context
.
Context
,
*
Node
)
<-
chan
*
Node
// GetDAG returns, in order, all the single leve child
// nodes of the passed in node.
GetDAG
(
context
.
Context
,
*
Node
)
<-
chan
*
Node
}
}
func
NewDAGService
(
bs
*
bserv
.
BlockService
)
DAGService
{
func
NewDAGService
(
bs
*
bserv
.
BlockService
)
DAGService
{
...
@@ -298,10 +301,10 @@ func FindLink(n *Node, k u.Key, found []*Node) (int, error) {
...
@@ -298,10 +301,10 @@ func FindLink(n *Node, k u.Key, found []*Node) (int, error) {
return
-
1
,
u
.
ErrNotFound
return
-
1
,
u
.
ErrNotFound
}
}
// Get
KeysAsync
will fill out all of the links of the given Node.
// Get
DAG
will fill out all of the links of the given Node.
// It returns a channel of nodes, which the caller can receive
// It returns a channel of nodes, which the caller can receive
// all the child nodes of 'root' on, in proper order.
// all the child nodes of 'root' on, in proper order.
func
(
ds
*
dagService
)
Get
KeysAsync
(
ctx
context
.
Context
,
root
*
Node
)
<-
chan
*
Node
{
func
(
ds
*
dagService
)
Get
DAG
(
ctx
context
.
Context
,
root
*
Node
)
<-
chan
*
Node
{
sig
:=
make
(
chan
*
Node
)
sig
:=
make
(
chan
*
Node
)
go
func
()
{
go
func
()
{
var
keys
[]
u
.
Key
var
keys
[]
u
.
Key
...
...
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