@@ -10,28 +10,10 @@ import (
10
10
blocks "github.com/ipfs/go-ipfs/blocks"
11
11
"github.com/ipfs/go-ipfs/blocks/blockstore"
12
12
key "github.com/ipfs/go-ipfs/blocks/key"
13
- worker "github.com/ipfs/go-ipfs/blockservice/worker"
14
13
exchange "github.com/ipfs/go-ipfs/exchange"
15
14
u "github.com/ipfs/go-ipfs/util"
16
15
)
17
16
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
-
35
17
var log = u .Logger ("blockservice" )
36
18
var ErrNotFound = errors .New ("blockservice: key not found" )
37
19
@@ -42,8 +24,6 @@ type BlockService struct {
42
24
// TODO don't expose underlying impl details
43
25
Blockstore blockstore.Blockstore
44
26
Exchange exchange.Interface
45
-
46
- worker * worker.Worker
47
27
}
48
28
49
29
// NewBlockService creates a BlockService with given datastore instance.
@@ -55,7 +35,6 @@ func New(bs blockstore.Blockstore, rem exchange.Interface) *BlockService {
55
35
return & BlockService {
56
36
Blockstore : bs ,
57
37
Exchange : rem ,
58
- worker : worker .NewWorker (rem , wc ),
59
38
}
60
39
}
61
40
@@ -67,7 +46,7 @@ func (s *BlockService) AddBlock(b *blocks.Block) (key.Key, error) {
67
46
if err != nil {
68
47
return k , err
69
48
}
70
- if err := s .worker .HasBlock (b ); err != nil {
49
+ if err := s .Exchange .HasBlock (context . TODO (), b ); err != nil {
71
50
return "" , errors .New ("blockservice is closed" )
72
51
}
73
52
return k , nil
@@ -81,7 +60,7 @@ func (s *BlockService) AddBlocks(bs []*blocks.Block) ([]key.Key, error) {
81
60
82
61
var ks []key.Key
83
62
for _ , b := range bs {
84
- if err := s .worker .HasBlock (b ); err != nil {
63
+ if err := s .Exchange .HasBlock (context . TODO (), b ); err != nil {
85
64
return nil , errors .New ("blockservice is closed" )
86
65
}
87
66
ks = append (ks , b .Key ())
@@ -157,5 +136,5 @@ func (s *BlockService) DeleteBlock(k key.Key) error {
157
136
158
137
func (s * BlockService ) Close () error {
159
138
log .Debug ("blockservice is shutting down..." )
160
- return s .worker .Close ()
139
+ return s .Exchange .Close ()
161
140
}
0 commit comments