[#1085] fstree: allow to ignore errors during iteration

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-01-20 18:53:29 +03:00 committed by LeL
parent e53ad2f468
commit c954f0e71b
5 changed files with 87 additions and 16 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
"go.etcd.io/bbolt"
@ -132,7 +133,7 @@ func (c *cache) flushBigObjects() {
}
evictNum := 0
_ = c.fsTree.Iterate(func(addr *objectSDK.Address, data []byte) error {
_ = c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error {
sAddr := addr.String()
if _, ok := c.store.flushed.Peek(sAddr); ok {
@ -160,7 +161,7 @@ func (c *cache) flushBigObjects() {
evictNum++
return nil
})
}))
// evict objects which were successfully written to BlobStor
c.evictObjects(evictNum)