[#186] object/rangehash: Use new storage engine for work

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2020-11-19 11:27:40 +03:00 committed by Alex Vanin
parent 1bce2a4e55
commit 9b32f131c0
2 changed files with 10 additions and 6 deletions

View File

@ -7,18 +7,22 @@ import (
"hash"
"github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/localstore"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
"github.com/nspcc-dev/neofs-node/pkg/util"
"github.com/nspcc-dev/tzhash/tz"
"github.com/pkg/errors"
)
type localHasher struct {
storage *localstore.Storage
storage *engine.StorageEngine
}
func (h *localHasher) hashRange(ctx context.Context, prm *Prm, handler func([][]byte)) error {
obj, err := h.storage.Get(prm.addr)
// FIXME: get partial range instead of full object.
// Current solution is simple, but more loaded
// We can calculate left and right border between all ranges
// and request bordered range (look Service.GetRangeHash).
obj, err := engine.Get(h.storage, prm.addr)
if err != nil {
return errors.Wrapf(err, "(%T) could not get object from local storage", h)
}

View File

@ -11,7 +11,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/core/container"
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/localstore"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/network/cache"
headsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/head"
@ -32,7 +32,7 @@ type Option func(*cfg)
type cfg struct {
keyStorage *objutil.KeyStorage
localStore *localstore.Storage
localStore *engine.StorageEngine
cnrSrc container.Source
@ -234,7 +234,7 @@ func WithKeyStorage(v *objutil.KeyStorage) Option {
}
}
func WithLocalStorage(v *localstore.Storage) Option {
func WithLocalStorage(v *engine.StorageEngine) Option {
return func(c *cfg) {
c.localStore = v
}