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-dms3-exchange-offline
Commits
9e9cf60b
Commit
9e9cf60b
authored
May 05, 2016
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make blocks.Block an interface.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
17a6633c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
offline.go
offline.go
+4
-4
No files found.
offline.go
View file @
9e9cf60b
...
@@ -23,12 +23,12 @@ type offlineExchange struct {
...
@@ -23,12 +23,12 @@ type offlineExchange struct {
// GetBlock returns nil to signal that a block could not be retrieved for the
// GetBlock returns nil to signal that a block could not be retrieved for the
// given key.
// given key.
// NB: This function may return before the timeout expires.
// NB: This function may return before the timeout expires.
func
(
e
*
offlineExchange
)
GetBlock
(
_
context
.
Context
,
k
key
.
Key
)
(
*
blocks
.
Block
,
error
)
{
func
(
e
*
offlineExchange
)
GetBlock
(
_
context
.
Context
,
k
key
.
Key
)
(
blocks
.
Block
,
error
)
{
return
e
.
bs
.
Get
(
k
)
return
e
.
bs
.
Get
(
k
)
}
}
// HasBlock always returns nil.
// HasBlock always returns nil.
func
(
e
*
offlineExchange
)
HasBlock
(
b
*
blocks
.
Block
)
error
{
func
(
e
*
offlineExchange
)
HasBlock
(
b
blocks
.
Block
)
error
{
return
e
.
bs
.
Put
(
b
)
return
e
.
bs
.
Put
(
b
)
}
}
...
@@ -39,8 +39,8 @@ func (_ *offlineExchange) Close() error {
...
@@ -39,8 +39,8 @@ func (_ *offlineExchange) Close() error {
return
nil
return
nil
}
}
func
(
e
*
offlineExchange
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
key
.
Key
)
(
<-
chan
*
blocks
.
Block
,
error
)
{
func
(
e
*
offlineExchange
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
key
.
Key
)
(
<-
chan
blocks
.
Block
,
error
)
{
out
:=
make
(
chan
*
blocks
.
Block
,
0
)
out
:=
make
(
chan
blocks
.
Block
,
0
)
go
func
()
{
go
func
()
{
defer
close
(
out
)
defer
close
(
out
)
var
misses
[]
key
.
Key
var
misses
[]
key
.
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