From 1ba556f5e721fb981dae27d4618ac197c645563f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 25 Nov 2020 12:53:17 +0300 Subject: [PATCH] [#211] blobstor: Define Iterate operation Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobstor/iterate.go | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pkg/local_object_storage/blobstor/iterate.go diff --git a/pkg/local_object_storage/blobstor/iterate.go b/pkg/local_object_storage/blobstor/iterate.go new file mode 100644 index 000000000..a50ccd32f --- /dev/null +++ b/pkg/local_object_storage/blobstor/iterate.go @@ -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") +}