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
418787d0
Commit
418787d0
authored
Aug 28, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dont need blockservice workers anymore
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
99499a8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
24 deletions
+4
-24
blockservice.go
blockservice.go
+4
-24
No files found.
blockservice.go
View file @
418787d0
...
...
@@ -10,29 +10,12 @@ import (
blocks
"github.com/ipfs/go-ipfs/blocks"
"github.com/ipfs/go-ipfs/blocks/blockstore"
key
"github.com/ipfs/go-ipfs/blocks/key"
worker
"github.com/ipfs/go-ipfs/blockservice/worker"
exchange
"github.com/ipfs/go-ipfs/exchange"
logging
"github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var
wc
=
worker
.
Config
{
// When running on a single core, NumWorkers has a harsh negative effect on
// throughput. (-80% when < 25)
// Running a lot more workers appears to have very little effect on both
// single and multicore configurations.
NumWorkers
:
25
,
// These have no effect on when running on multiple cores, but harsh
// negative effect on throughput when running on a single core
// On multicore configurations these buffers have little effect on
// throughput.
// On single core configurations, larger buffers have severe adverse
// effects on throughput.
ClientBufferSize
:
0
,
WorkerBufferSize
:
0
,
}
var
log
=
logging
.
Logger
(
"blockservice"
)
var
ErrNotFound
=
errors
.
New
(
"blockservice: key not found"
)
// BlockService is a hybrid block datastore. It stores data in a local
...
...
@@ -42,8 +25,6 @@ type BlockService struct {
// TODO don't expose underlying impl details
Blockstore
blockstore
.
Blockstore
Exchange
exchange
.
Interface
worker
*
worker
.
Worker
}
// NewBlockService creates a BlockService with given datastore instance.
...
...
@@ -55,7 +36,6 @@ func New(bs blockstore.Blockstore, rem exchange.Interface) *BlockService {
return
&
BlockService
{
Blockstore
:
bs
,
Exchange
:
rem
,
worker
:
worker
.
NewWorker
(
rem
,
wc
),
}
}
...
...
@@ -67,7 +47,7 @@ func (s *BlockService) AddBlock(b *blocks.Block) (key.Key, error) {
if
err
!=
nil
{
return
k
,
err
}
if
err
:=
s
.
worker
.
HasBlock
(
b
);
err
!=
nil
{
if
err
:=
s
.
Exchange
.
HasBlock
(
context
.
TODO
(),
b
);
err
!=
nil
{
return
""
,
errors
.
New
(
"blockservice is closed"
)
}
return
k
,
nil
...
...
@@ -81,7 +61,7 @@ func (s *BlockService) AddBlocks(bs []*blocks.Block) ([]key.Key, error) {
var
ks
[]
key
.
Key
for
_
,
b
:=
range
bs
{
if
err
:=
s
.
worker
.
HasBlock
(
b
);
err
!=
nil
{
if
err
:=
s
.
Exchange
.
HasBlock
(
context
.
TODO
(),
b
);
err
!=
nil
{
return
nil
,
errors
.
New
(
"blockservice is closed"
)
}
ks
=
append
(
ks
,
b
.
Key
())
...
...
@@ -166,5 +146,5 @@ func (s *BlockService) DeleteBlock(k key.Key) error {
func
(
s
*
BlockService
)
Close
()
error
{
log
.
Debug
(
"blockservice is shutting down..."
)
return
s
.
worker
.
Close
()
return
s
.
Exchange
.
Close
()
}
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