Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit b3ee1d9

Browse files
hsanjuanJorropo
authored andcommittedMar 17, 2022
s/log/logger
1 parent b598a29 commit b3ee1d9

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
 

‎arc_cache.go

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ func (b *arccache) DeleteBlock(ctx context.Context, k cid.Cid) error {
114114

115115
func (b *arccache) Has(ctx context.Context, k cid.Cid) (bool, error) {
116116
if !k.Defined() {
117+
logger.Error("undefined cid in arccache")
118+
// Return cache invalid so the call to blockstore happens
119+
// in case of invalid key and correct error is created.
117120
return false, nil
118121
}
119122

‎blockstore.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
uatomic "go.uber.org/atomic"
2020
)
2121

22-
var log = logging.Logger("blockstore")
22+
var logger = logging.Logger("blockstore")
2323

2424
// BlockPrefix namespaces blockstore datastores
2525
var BlockPrefix = ds.NewKey("blocks")
@@ -239,14 +239,14 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
239239
return
240240
}
241241
if e.Error != nil {
242-
log.Errorf("blockstore.AllKeysChan got err: %s", e.Error)
242+
logger.Errorf("blockstore.AllKeysChan got err: %s", e.Error)
243243
return
244244
}
245245

246246
// need to convert to key.Key using key.KeyFromDsKey.
247247
bk, err := dshelp.BinaryFromDsKey(ds.RawKey(e.Key))
248248
if err != nil {
249-
log.Warningf("error parsing key from binary: %s", err)
249+
logger.Warningf("error parsing key from binary: %s", err)
250250
continue
251251
}
252252
k := cid.NewCidV1(cid.Raw, bk)

‎bloom_cache.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func bloomCached(ctx context.Context, bs Blockstore, bloomSize, hashCount int) (
3838
if err != nil {
3939
select {
4040
case <-ctx.Done():
41-
log.Warning("Cache rebuild closed by context finishing: ", err)
41+
logger.Warning("Cache rebuild closed by context finishing: ", err)
4242
default:
43-
log.Error(err)
43+
logger.Error(err)
4444
}
4545
return
4646
}
@@ -95,7 +95,7 @@ func (b *bloomcache) Wait(ctx context.Context) error {
9595
}
9696

9797
func (b *bloomcache) build(ctx context.Context) error {
98-
evt := log.EventBegin(ctx, "bloomcache.build")
98+
evt := logger.EventBegin(ctx, "bloomcache.build")
9999
defer evt.Done()
100100
defer close(b.buildChan)
101101

@@ -132,7 +132,7 @@ func (b *bloomcache) DeleteBlock(ctx context.Context, k cid.Cid) error {
132132
func (b *bloomcache) hasCached(k cid.Cid) (has bool, ok bool) {
133133
b.total.Inc()
134134
if !k.Defined() {
135-
log.Error("undefined in bloom cache")
135+
logger.Error("undefined in bloom cache")
136136
// Return cache invalid so call to blockstore
137137
// in case of invalid key is forwarded deeper
138138
return false, false

0 commit comments

Comments
 (0)