forked from TrueCloudLab/frostfs-node
[#1085] fstree: allow to ignore errors during iteration
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e53ad2f468
commit
c954f0e71b
5 changed files with 87 additions and 16 deletions
|
@ -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)
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
@ -34,12 +35,12 @@ func (c *cache) Iterate(f func([]byte) error) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return c.fsTree.Iterate(func(addr *object.Address, data []byte) error {
|
||||
return c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *object.Address, data []byte) error {
|
||||
if _, ok := c.flushed.Peek(addr.String()); ok {
|
||||
return nil
|
||||
}
|
||||
return f(data)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
// IterateDB iterates over all objects stored in bbolt.DB instance and passes them to f until error return.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue