[#211] blobstor: Define Iterate operation

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-25 12:53:17 +03:00 committed by Alex Vanin
parent 3c0ef270f4
commit 1ba556f5e7

View file

@ -0,0 +1,33 @@
package blobstor
import (
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
)
// IterationHandler represents the action to be performed on each iteration.
type IterationHandler func(*objectSDK.Address, *blobovnicza.ID) error
// IteratePrm groups the parameters of Iterate operation.
type IteratePrm struct {
handler IterationHandler
}
// IterateRes groups resulting values of Iterate operation.
type IterateRes struct{}
// SetIterationHandler sets the action to be performed on each iteration.
func (i *IteratePrm) SetIterationHandler(h IterationHandler) {
i.handler = h
}
// Iterate traverses the storage over the stored objects and calls the handler
// on each element.
//
// Returns any error encountered that
// did not allow to completely iterate over the storage.
//
// If handler returns an error, method returns it immediately.
func (b *BlobStor) Iterate(prm *IteratePrm) (*IterateRes, error) {
panic("implement me")
}