From 005f6d2a84984de8187fe6ad70429fc3dd088eed Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 7 Apr 2020 19:01:48 +0200 Subject: [PATCH 1/2] Use ipld.ErrNotFound for NotFound errors --- arc_cache.go | 19 ++++++++++--------- arc_cache_test.go | 7 ++++--- blockstore.go | 12 +++++------- blockstore_test.go | 3 ++- bloom_cache.go | 7 ++++--- bloom_cache_test.go | 3 ++- go.mod | 1 + go.sum | 12 ++++++++++++ 8 files changed, 40 insertions(+), 24 deletions(-) diff --git a/arc_cache.go b/arc_cache.go index 5dc7c6e..14d6bd4 100644 --- a/arc_cache.go +++ b/arc_cache.go @@ -8,6 +8,7 @@ import ( lru "github.com/hashicorp/golang-lru" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" + ipld "github.com/ipfs/go-ipld-format" metrics "github.com/ipfs/go-metrics-interface" ) @@ -135,7 +136,7 @@ func (b *arccache) Has(ctx context.Context, k cid.Cid) (bool, error) { func (b *arccache) GetSize(ctx context.Context, k cid.Cid) (int, error) { if !k.Defined() { - return -1, ErrNotFound + return -1, ipld.ErrNotFound{Cid: k} } key := cacheKey(k) @@ -143,7 +144,7 @@ func (b *arccache) GetSize(ctx context.Context, k cid.Cid) (int, error) { if has, blockSize, ok := b.queryCache(key); ok { if !has { // don't have it, return - return -1, ErrNotFound + return -1, ipld.ErrNotFound{Cid: k} } if blockSize >= 0 { // have it and we know the size @@ -156,7 +157,7 @@ func (b *arccache) GetSize(ctx context.Context, k cid.Cid) (int, error) { defer b.unlock(key, false) blockSize, err := b.blockstore.GetSize(ctx, k) - if err == ErrNotFound { + if ipld.IsNotFound(err) { b.cacheHave(key, false) } else if err == nil { b.cacheSize(key, blockSize) @@ -176,7 +177,7 @@ func (b *arccache) View(ctx context.Context, k cid.Cid, callback func([]byte) er } if !k.Defined() { - return ErrNotFound + return ipld.ErrNotFound{Cid: k} } key := cacheKey(k) @@ -184,7 +185,7 @@ func (b *arccache) View(ctx context.Context, k cid.Cid, callback func([]byte) er if has, _, ok := b.queryCache(key); ok && !has { // short circuit if the cache deterministically tells us the item // doesn't exist. - return ErrNotFound + return ipld.ErrNotFound{Cid: k} } b.lock(key, false) @@ -197,7 +198,7 @@ func (b *arccache) View(ctx context.Context, k cid.Cid, callback func([]byte) er cberr = callback(buf) return nil }); err != nil { - if err == ErrNotFound { + if ipld.IsNotFound(err) { b.cacheHave(key, false) } return err @@ -210,20 +211,20 @@ func (b *arccache) View(ctx context.Context, k cid.Cid, callback func([]byte) er func (b *arccache) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { if !k.Defined() { - return nil, ErrNotFound + return nil, ipld.ErrNotFound{Cid: k} } key := cacheKey(k) if has, _, ok := b.queryCache(key); ok && !has { - return nil, ErrNotFound + return nil, ipld.ErrNotFound{Cid: k} } b.lock(key, false) defer b.unlock(key, false) bl, err := b.blockstore.Get(ctx, k) - if bl == nil && err == ErrNotFound { + if bl == nil && ipld.IsNotFound(err) { b.cacheHave(key, false) } else if bl != nil { b.cacheSize(key, len(bl.RawData())) diff --git a/arc_cache_test.go b/arc_cache_test.go index 992cd26..164457d 100644 --- a/arc_cache_test.go +++ b/arc_cache_test.go @@ -12,6 +12,7 @@ import ( cid "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" syncds "github.com/ipfs/go-datastore/sync" + ipld "github.com/ipfs/go-ipld-format" ) var exampleBlock = blocks.NewBlock([]byte("foo")) @@ -111,7 +112,7 @@ func TestGetFillsCache(t *testing.T) { if has, err := arc.Has(bg, exampleBlock.Cid()); has || err != nil { t.Fatal("has was true but there is no such block") } - if _, err := arc.GetSize(bg, exampleBlock.Cid()); err != ErrNotFound { + if _, err := arc.GetSize(bg, exampleBlock.Cid()); !ipld.IsNotFound(err) { t.Fatal("getsize was true but there is no such block") } @@ -139,7 +140,7 @@ func TestGetAndDeleteFalseShortCircuit(t *testing.T) { trap("get hit datastore", cd, t) - if bl, err := arc.Get(bg, exampleBlock.Cid()); bl != nil || err != ErrNotFound { + if bl, err := arc.Get(bg, exampleBlock.Cid()); bl != nil || !ipld.IsNotFound(err) { t.Fatal("get returned invalid result") } @@ -226,7 +227,7 @@ func TestGetSizeMissingZeroSizeBlock(t *testing.T) { arc.Get(bg, missingBlock.Cid()) trap("has hit datastore", cd, t) - if _, err := arc.GetSize(bg, missingBlock.Cid()); err != ErrNotFound { + if _, err := arc.GetSize(bg, missingBlock.Cid()); !ipld.IsNotFound(err) { t.Fatal("getsize returned invalid result") } } diff --git a/blockstore.go b/blockstore.go index 9572f76..b0a50e2 100644 --- a/blockstore.go +++ b/blockstore.go @@ -14,6 +14,7 @@ import ( dsns "github.com/ipfs/go-datastore/namespace" dsq "github.com/ipfs/go-datastore/query" dshelp "github.com/ipfs/go-ipfs-ds-help" + ipld "github.com/ipfs/go-ipld-format" logging "github.com/ipfs/go-log" uatomic "go.uber.org/atomic" ) @@ -27,9 +28,6 @@ var BlockPrefix = ds.NewKey("blocks") // is different than expected. var ErrHashMismatch = errors.New("block in storage has different hash than requested") -// ErrNotFound is an error returned when a block is not found. -var ErrNotFound = errors.New("blockstore: block not found") - // Blockstore wraps a Datastore block-centered methods and provides a layer // of abstraction which allows to add different caching strategies. type Blockstore interface { @@ -143,12 +141,12 @@ func (bs *blockstore) HashOnRead(enabled bool) { func (bs *blockstore) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { if !k.Defined() { - log.Error("undefined cid in blockstore") - return nil, ErrNotFound + logger.Error("undefined cid in blockstore") + return nil, ipld.ErrNotFound{Cid: k} } bdata, err := bs.datastore.Get(ctx, dshelp.MultihashToDsKey(k.Hash())) if err == ds.ErrNotFound { - return nil, ErrNotFound + return nil, ipld.ErrNotFound{Cid: k} } if err != nil { return nil, err @@ -206,7 +204,7 @@ func (bs *blockstore) Has(ctx context.Context, k cid.Cid) (bool, error) { func (bs *blockstore) GetSize(ctx context.Context, k cid.Cid) (int, error) { size, err := bs.datastore.GetSize(ctx, dshelp.MultihashToDsKey(k.Hash())) if err == ds.ErrNotFound { - return -1, ErrNotFound + return -1, ipld.ErrNotFound{Cid: k} } return size, err } diff --git a/blockstore_test.go b/blockstore_test.go index 1ee3341..522ed95 100644 --- a/blockstore_test.go +++ b/blockstore_test.go @@ -12,6 +12,7 @@ import ( dsq "github.com/ipfs/go-datastore/query" ds_sync "github.com/ipfs/go-datastore/sync" u "github.com/ipfs/go-ipfs-util" + ipld "github.com/ipfs/go-ipld-format" ) func TestGetWhenKeyNotPresent(t *testing.T) { @@ -30,7 +31,7 @@ func TestGetWhenKeyNotPresent(t *testing.T) { func TestGetWhenKeyIsNil(t *testing.T) { bs := NewBlockstore(ds_sync.MutexWrap(ds.NewMapDatastore())) _, err := bs.Get(bg, cid.Cid{}) - if err != ErrNotFound { + if !ipld.IsNotFound(err) { t.Fail() } } diff --git a/bloom_cache.go b/bloom_cache.go index e3332ef..64092f5 100644 --- a/bloom_cache.go +++ b/bloom_cache.go @@ -9,6 +9,7 @@ import ( bloom "github.com/ipfs/bbloom" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" + ipld "github.com/ipfs/go-ipld-format" metrics "github.com/ipfs/go-metrics-interface" ) @@ -156,7 +157,7 @@ func (b *bloomcache) Has(ctx context.Context, k cid.Cid) (bool, error) { func (b *bloomcache) GetSize(ctx context.Context, k cid.Cid) (int, error) { if has, ok := b.hasCached(k); ok && !has { - return -1, ErrNotFound + return -1, ipld.ErrNotFound{Cid: k} } return b.blockstore.GetSize(ctx, k) @@ -172,14 +173,14 @@ func (b *bloomcache) View(ctx context.Context, k cid.Cid, callback func([]byte) } if has, ok := b.hasCached(k); ok && !has { - return ErrNotFound + return ipld.ErrNotFound{Cid: k} } return b.viewer.View(ctx, k, callback) } func (b *bloomcache) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { if has, ok := b.hasCached(k); ok && !has { - return nil, ErrNotFound + return nil, ipld.ErrNotFound{Cid: k} } return b.blockstore.Get(ctx, k) diff --git a/bloom_cache_test.go b/bloom_cache_test.go index 43f747d..3c998c5 100644 --- a/bloom_cache_test.go +++ b/bloom_cache_test.go @@ -11,6 +11,7 @@ import ( ds "github.com/ipfs/go-datastore" dsq "github.com/ipfs/go-datastore/query" syncds "github.com/ipfs/go-datastore/sync" + ipld "github.com/ipfs/go-ipld-format" ) var bg = context.Background() @@ -65,7 +66,7 @@ func TestPutManyAddsToBloom(t *testing.T) { t.Fatal(err) } blockSize, err = cachedbs.GetSize(bg, block2.Cid()) - if err != nil && err != ErrNotFound { + if err != nil && !ipld.IsNotFound(err) { t.Fatal(err) } if blockSize > -1 || has { diff --git a/go.mod b/go.mod index 3c2825c..0cde90c 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/ipfs/go-datastore v0.5.0 github.com/ipfs/go-ipfs-ds-help v1.1.0 github.com/ipfs/go-ipfs-util v0.0.2 + github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65 github.com/ipfs/go-log v0.0.1 github.com/ipfs/go-metrics-interface v0.0.1 github.com/multiformats/go-multihash v0.0.14 diff --git a/go.sum b/go.sum index 66654ee..3ecf913 100644 --- a/go.sum +++ b/go.sum @@ -7,12 +7,17 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= +github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= +github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc= github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= @@ -23,8 +28,11 @@ github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46U github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR994w4Q= github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU= +github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= +github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65 h1:xxnD+fUS7hziDAnfrn3qsl0ql18DOjq4rwvzBTCr1iA= +github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= @@ -46,6 +54,7 @@ github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= @@ -58,6 +67,7 @@ github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoR github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.0.14 h1:QoBceQYQQtNUuf6s7wHxnE2c8bhbMqhfGzNI032se/I= github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= @@ -79,6 +89,7 @@ go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= @@ -93,6 +104,7 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From af197de1c3da262e90dc3ac2291c7c866ca1c028 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 7 Apr 2020 19:05:18 +0200 Subject: [PATCH 2/2] s/log/logger --- arc_cache.go | 3 +++ blockstore.go | 6 +++--- bloom_cache.go | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arc_cache.go b/arc_cache.go index 14d6bd4..2733dfc 100644 --- a/arc_cache.go +++ b/arc_cache.go @@ -114,6 +114,9 @@ func (b *arccache) DeleteBlock(ctx context.Context, k cid.Cid) error { func (b *arccache) Has(ctx context.Context, k cid.Cid) (bool, error) { if !k.Defined() { + logger.Error("undefined cid in arccache") + // Return cache invalid so the call to blockstore happens + // in case of invalid key and correct error is created. return false, nil } diff --git a/blockstore.go b/blockstore.go index b0a50e2..61cb780 100644 --- a/blockstore.go +++ b/blockstore.go @@ -19,7 +19,7 @@ import ( uatomic "go.uber.org/atomic" ) -var log = logging.Logger("blockstore") +var logger = logging.Logger("blockstore") // BlockPrefix namespaces blockstore datastores var BlockPrefix = ds.NewKey("blocks") @@ -239,14 +239,14 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { return } if e.Error != nil { - log.Errorf("blockstore.AllKeysChan got err: %s", e.Error) + logger.Errorf("blockstore.AllKeysChan got err: %s", e.Error) return } // need to convert to key.Key using key.KeyFromDsKey. bk, err := dshelp.BinaryFromDsKey(ds.RawKey(e.Key)) if err != nil { - log.Warningf("error parsing key from binary: %s", err) + logger.Warningf("error parsing key from binary: %s", err) continue } k := cid.NewCidV1(cid.Raw, bk) diff --git a/bloom_cache.go b/bloom_cache.go index 64092f5..23d1483 100644 --- a/bloom_cache.go +++ b/bloom_cache.go @@ -38,9 +38,9 @@ func bloomCached(ctx context.Context, bs Blockstore, bloomSize, hashCount int) ( if err != nil { select { case <-ctx.Done(): - log.Warning("Cache rebuild closed by context finishing: ", err) + logger.Warning("Cache rebuild closed by context finishing: ", err) default: - log.Error(err) + logger.Error(err) } return } @@ -95,7 +95,7 @@ func (b *bloomcache) Wait(ctx context.Context) error { } func (b *bloomcache) build(ctx context.Context) error { - evt := log.EventBegin(ctx, "bloomcache.build") + evt := logger.EventBegin(ctx, "bloomcache.build") defer evt.Done() defer close(b.buildChan) @@ -132,7 +132,7 @@ func (b *bloomcache) DeleteBlock(ctx context.Context, k cid.Cid) error { func (b *bloomcache) hasCached(k cid.Cid) (has bool, ok bool) { b.total.Inc() if !k.Defined() { - log.Error("undefined in bloom cache") + logger.Error("undefined in bloom cache") // Return cache invalid so call to blockstore // in case of invalid key is forwarded deeper return false, false