Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 06c7063

Browse files
committedAug 28, 2015
dont need blockservice workers anymore
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent b55cf12 commit 06c7063

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed
 

‎blockservice/blockservice.go

+3-24
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,10 @@ import (
1010
blocks "github.com/ipfs/go-ipfs/blocks"
1111
"github.com/ipfs/go-ipfs/blocks/blockstore"
1212
key "github.com/ipfs/go-ipfs/blocks/key"
13-
worker "github.com/ipfs/go-ipfs/blockservice/worker"
1413
exchange "github.com/ipfs/go-ipfs/exchange"
1514
u "github.com/ipfs/go-ipfs/util"
1615
)
1716

18-
var wc = worker.Config{
19-
// When running on a single core, NumWorkers has a harsh negative effect on
20-
// throughput. (-80% when < 25)
21-
// Running a lot more workers appears to have very little effect on both
22-
// single and multicore configurations.
23-
NumWorkers: 25,
24-
25-
// These have no effect on when running on multiple cores, but harsh
26-
// negative effect on throughput when running on a single core
27-
// On multicore configurations these buffers have little effect on
28-
// throughput.
29-
// On single core configurations, larger buffers have severe adverse
30-
// effects on throughput.
31-
ClientBufferSize: 0,
32-
WorkerBufferSize: 0,
33-
}
34-
3517
var log = u.Logger("blockservice")
3618
var ErrNotFound = errors.New("blockservice: key not found")
3719

@@ -42,8 +24,6 @@ type BlockService struct {
4224
// TODO don't expose underlying impl details
4325
Blockstore blockstore.Blockstore
4426
Exchange exchange.Interface
45-
46-
worker *worker.Worker
4727
}
4828

4929
// NewBlockService creates a BlockService with given datastore instance.
@@ -55,7 +35,6 @@ func New(bs blockstore.Blockstore, rem exchange.Interface) *BlockService {
5535
return &BlockService{
5636
Blockstore: bs,
5737
Exchange: rem,
58-
worker: worker.NewWorker(rem, wc),
5938
}
6039
}
6140

@@ -67,7 +46,7 @@ func (s *BlockService) AddBlock(b *blocks.Block) (key.Key, error) {
6746
if err != nil {
6847
return k, err
6948
}
70-
if err := s.worker.HasBlock(b); err != nil {
49+
if err := s.Exchange.HasBlock(context.TODO(), b); err != nil {
7150
return "", errors.New("blockservice is closed")
7251
}
7352
return k, nil
@@ -81,7 +60,7 @@ func (s *BlockService) AddBlocks(bs []*blocks.Block) ([]key.Key, error) {
8160

8261
var ks []key.Key
8362
for _, b := range bs {
84-
if err := s.worker.HasBlock(b); err != nil {
63+
if err := s.Exchange.HasBlock(context.TODO(), b); err != nil {
8564
return nil, errors.New("blockservice is closed")
8665
}
8766
ks = append(ks, b.Key())
@@ -157,5 +136,5 @@ func (s *BlockService) DeleteBlock(k key.Key) error {
157136

158137
func (s *BlockService) Close() error {
159138
log.Debug("blockservice is shutting down...")
160-
return s.worker.Close()
139+
return s.Exchange.Close()
161140
}

0 commit comments

Comments
 (0)
Please sign in to comment.