chore: dedup datastore import
This commit is contained in:
parent
d1a68df21a
commit
14754f1b18
@ -31,7 +31,6 @@ import (
|
|||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
block "github.com/ipfs/go-block-format"
|
block "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/ipfs/go-datastore"
|
|
||||||
dstore "github.com/ipfs/go-datastore"
|
dstore "github.com/ipfs/go-datastore"
|
||||||
"github.com/ipfs/go-datastore/query"
|
"github.com/ipfs/go-datastore/query"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
@ -642,7 +641,7 @@ func (cs *ChainStore) FlushValidationCache() error {
|
|||||||
return FlushValidationCache(cs.metadataDs)
|
return FlushValidationCache(cs.metadataDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func FlushValidationCache(ds datastore.Batching) error {
|
func FlushValidationCache(ds dstore.Batching) error {
|
||||||
log.Infof("clearing block validation cache...")
|
log.Infof("clearing block validation cache...")
|
||||||
|
|
||||||
dsWalk, err := ds.Query(query.Query{
|
dsWalk, err := ds.Query(query.Query{
|
||||||
@ -674,7 +673,7 @@ func FlushValidationCache(ds datastore.Batching) error {
|
|||||||
for _, k := range allKeys {
|
for _, k := range allKeys {
|
||||||
if strings.HasPrefix(k.Key, blockValidationCacheKeyPrefix.String()) {
|
if strings.HasPrefix(k.Key, blockValidationCacheKeyPrefix.String()) {
|
||||||
delCnt++
|
delCnt++
|
||||||
batch.Delete(datastore.RawKey(k.Key)) // nolint:errcheck
|
batch.Delete(dstore.RawKey(k.Key)) // nolint:errcheck
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user