@@ -25,7 +25,7 @@ var ErrNotFound = errors.New("blockservice: key not found")
25
25
// the blockservice.
26
26
type BlockGetter interface {
27
27
// GetBlock gets the requested block.
28
- GetBlock (ctx context.Context , c * cid.Cid ) (blocks.Block , error )
28
+ GetBlock (ctx context.Context , c cid.Cid ) (blocks.Block , error )
29
29
30
30
// GetBlocks does a batch request for the given cids, returning blocks as
31
31
// they are found, in no particular order.
@@ -34,7 +34,7 @@ type BlockGetter interface {
34
34
// be canceled). In that case, it will close the channel early. It is up
35
35
// to the consumer to detect this situation and keep track which blocks
36
36
// it has received and which it hasn't.
37
- GetBlocks (ctx context.Context , ks []* cid.Cid ) <- chan blocks.Block
37
+ GetBlocks (ctx context.Context , ks []cid.Cid ) <- chan blocks.Block
38
38
}
39
39
40
40
// BlockService is a hybrid block datastore. It stores data in a local
@@ -58,7 +58,7 @@ type BlockService interface {
58
58
AddBlocks (bs []blocks.Block ) error
59
59
60
60
// DeleteBlock deletes the given block from the blockservice.
61
- DeleteBlock (o * cid.Cid ) error
61
+ DeleteBlock (o cid.Cid ) error
62
62
}
63
63
64
64
type blockService struct {
@@ -196,7 +196,7 @@ func (s *blockService) AddBlocks(bs []blocks.Block) error {
196
196
197
197
// GetBlock retrieves a particular block from the service,
198
198
// Getting it from the datastore using the key (hash).
199
- func (s * blockService ) GetBlock (ctx context.Context , c * cid.Cid ) (blocks.Block , error ) {
199
+ func (s * blockService ) GetBlock (ctx context.Context , c cid.Cid ) (blocks.Block , error ) {
200
200
log .Debugf ("BlockService GetBlock: '%s'" , c )
201
201
202
202
var f exchange.Fetcher
@@ -207,7 +207,7 @@ func (s *blockService) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block,
207
207
return getBlock (ctx , c , s .blockstore , f ) // hash security
208
208
}
209
209
210
- func getBlock (ctx context.Context , c * cid.Cid , bs blockstore.Blockstore , f exchange.Fetcher ) (blocks.Block , error ) {
210
+ func getBlock (ctx context.Context , c cid.Cid , bs blockstore.Blockstore , f exchange.Fetcher ) (blocks.Block , error ) {
211
211
err := verifcid .ValidateCid (c ) // hash security
212
212
if err != nil {
213
213
return nil , err
@@ -244,11 +244,11 @@ func getBlock(ctx context.Context, c *cid.Cid, bs blockstore.Blockstore, f excha
244
244
// GetBlocks gets a list of blocks asynchronously and returns through
245
245
// the returned channel.
246
246
// NB: No guarantees are made about order.
247
- func (s * blockService ) GetBlocks (ctx context.Context , ks []* cid.Cid ) <- chan blocks.Block {
247
+ func (s * blockService ) GetBlocks (ctx context.Context , ks []cid.Cid ) <- chan blocks.Block {
248
248
return getBlocks (ctx , ks , s .blockstore , s .exchange ) // hash security
249
249
}
250
250
251
- func getBlocks (ctx context.Context , ks []* cid.Cid , bs blockstore.Blockstore , f exchange.Fetcher ) <- chan blocks.Block {
251
+ func getBlocks (ctx context.Context , ks []cid.Cid , bs blockstore.Blockstore , f exchange.Fetcher ) <- chan blocks.Block {
252
252
out := make (chan blocks.Block )
253
253
254
254
go func () {
@@ -266,7 +266,7 @@ func getBlocks(ctx context.Context, ks []*cid.Cid, bs blockstore.Blockstore, f e
266
266
}
267
267
ks = ks [:k ]
268
268
269
- var misses []* cid.Cid
269
+ var misses []cid.Cid
270
270
for _ , c := range ks {
271
271
hit , err := bs .Get (c )
272
272
if err != nil {
@@ -303,7 +303,7 @@ func getBlocks(ctx context.Context, ks []*cid.Cid, bs blockstore.Blockstore, f e
303
303
}
304
304
305
305
// DeleteBlock deletes a block in the blockservice from the datastore
306
- func (s * blockService ) DeleteBlock (c * cid.Cid ) error {
306
+ func (s * blockService ) DeleteBlock (c cid.Cid ) error {
307
307
err := s .blockstore .DeleteBlock (c )
308
308
if err == nil {
309
309
log .Event (context .TODO (), "BlockService.BlockDeleted" , c )
@@ -323,12 +323,12 @@ type Session struct {
323
323
}
324
324
325
325
// GetBlock gets a block in the context of a request session
326
- func (s * Session ) GetBlock (ctx context.Context , c * cid.Cid ) (blocks.Block , error ) {
326
+ func (s * Session ) GetBlock (ctx context.Context , c cid.Cid ) (blocks.Block , error ) {
327
327
return getBlock (ctx , c , s .bs , s .ses ) // hash security
328
328
}
329
329
330
330
// GetBlocks gets blocks in the context of a request session
331
- func (s * Session ) GetBlocks (ctx context.Context , ks []* cid.Cid ) <- chan blocks.Block {
331
+ func (s * Session ) GetBlocks (ctx context.Context , ks []cid.Cid ) <- chan blocks.Block {
332
332
return getBlocks (ctx , ks , s .bs , s .ses ) // hash security
333
333
}
334
334
0 commit comments