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
1eec61df
Commit
1eec61df
authored
Jan 25, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make code-climate happier
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
8fcf235b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
blockservice.go
blockservice.go
+10
-4
No files found.
blockservice.go
View file @
1eec61df
...
@@ -22,6 +22,8 @@ var log = logging.Logger("blockservice")
...
@@ -22,6 +22,8 @@ var log = logging.Logger("blockservice")
var
ErrNotFound
=
errors
.
New
(
"blockservice: key not found"
)
var
ErrNotFound
=
errors
.
New
(
"blockservice: key not found"
)
// BlockGetter is the common interface shared between blockservice sessions and
// the blockservice.
type
BlockGetter
interface
{
type
BlockGetter
interface
{
// GetBlock gets the requested block.
// GetBlock gets the requested block.
GetBlock
(
ctx
context
.
Context
,
c
*
cid
.
Cid
)
(
blocks
.
Block
,
error
)
GetBlock
(
ctx
context
.
Context
,
c
*
cid
.
Cid
)
(
blocks
.
Block
,
error
)
...
@@ -95,12 +97,14 @@ func NewWriteThrough(bs blockstore.Blockstore, rem exchange.Interface) BlockServ
...
@@ -95,12 +97,14 @@ func NewWriteThrough(bs blockstore.Blockstore, rem exchange.Interface) BlockServ
}
}
}
}
func
(
bs
*
blockService
)
Blockstore
()
blockstore
.
Blockstore
{
// Blockstore returns the blockstore behind this blockservice.
return
bs
.
blockstore
func
(
s
*
blockService
)
Blockstore
()
blockstore
.
Blockstore
{
return
s
.
blockstore
}
}
func
(
bs
*
blockService
)
Exchange
()
exchange
.
Interface
{
// Exchange returns the exchange behind this blockservice.
return
bs
.
exchange
func
(
s
*
blockService
)
Exchange
()
exchange
.
Interface
{
return
s
.
exchange
}
}
// NewSession creates a bitswap session that allows for controlled exchange of
// NewSession creates a bitswap session that allows for controlled exchange of
...
@@ -286,3 +290,5 @@ func (s *Session) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block, error
...
@@ -286,3 +290,5 @@ func (s *Session) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block, error
func
(
s
*
Session
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
{
func
(
s
*
Session
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
{
return
getBlocks
(
ctx
,
ks
,
s
.
bs
,
s
.
ses
)
return
getBlocks
(
ctx
,
ks
,
s
.
bs
,
s
.
ses
)
}
}
var
_
BlockGetter
=
(
*
Session
)(
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