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-blockservice
Commits
a1355947
Commit
a1355947
authored
Nov 21, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start working getBlocks up the call chain
parent
88d8c40c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
blockservice.go
blockservice.go
+23
-3
No files found.
blockservice.go
View file @
a1355947
...
@@ -96,9 +96,29 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
...
@@ -96,9 +96,29 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
}
}
}
}
func
(
s
*
BlockService
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
u
.
Key
)
(
<-
chan
blocks
.
Block
,
error
)
{
func
(
s
*
BlockService
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
u
.
Key
)
<-
chan
*
blocks
.
Block
{
// TODO:
out
:=
make
(
chan
*
blocks
.
Block
,
32
)
return
nil
,
nil
go
func
()
{
var
toFetch
[]
u
.
Key
for
_
,
k
:=
range
ks
{
datai
,
err
:=
s
.
Datastore
.
Get
(
k
.
DsKey
())
if
err
==
nil
{
log
.
Debug
(
"Blockservice: Got data in datastore."
)
bdata
,
ok
:=
datai
.
([]
byte
)
if
!
ok
{
log
.
Criticalf
(
"data associated with %s is not a []byte"
,
k
)
continue
}
out
<-
&
blocks
.
Block
{
Multihash
:
mh
.
Multihash
(
k
),
Data
:
bdata
,
}
}
else
{
toFetch
=
append
(
toFetch
,
k
)
}
}
}()
return
out
}
}
// DeleteBlock deletes a block in the blockservice from the datastore
// DeleteBlock deletes a block in the blockservice from the datastore
...
...
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