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
ad36b640
Commit
ad36b640
authored
Nov 20, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove buffer timing in bitswap in favor of manual batching
parent
642e04c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
merkledag.go
merkledag.go
+20
-0
No files found.
merkledag.go
View file @
ad36b640
...
...
@@ -252,6 +252,7 @@ func (n *dagService) Remove(nd *Node) error {
// FetchGraph asynchronously fetches all nodes that are children of the given
// node, and returns a channel that may be waited upon for the fetch to complete
func
FetchGraph
(
ctx
context
.
Context
,
root
*
Node
,
serv
DAGService
)
chan
struct
{}
{
log
.
Warning
(
"Untested."
)
var
wg
sync
.
WaitGroup
done
:=
make
(
chan
struct
{})
...
...
@@ -284,3 +285,22 @@ func FetchGraph(ctx context.Context, root *Node, serv DAGService) chan struct{}
return
done
}
// Take advantage of blockservice/bitswap batched requests to fetch all
// child nodes of a given node
// TODO: finish this
func
(
ds
*
dagService
)
BatchFetch
(
ctx
context
.
Context
,
root
*
Node
)
error
{
var
keys
[]
u
.
Key
for
_
,
lnk
:=
range
root
.
Links
{
keys
=
append
(
keys
,
u
.
Key
(
lnk
.
Hash
))
}
blocks
,
err
:=
ds
.
Blocks
.
GetBlocks
(
keys
)
if
err
!=
nil
{
return
err
}
_
=
blocks
//what do i do with blocks?
return
nil
}
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