From 9b32f131c029576c25e6c49c0a1a1494e8975d40 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 19 Nov 2020 11:27:40 +0300 Subject: [PATCH] [#186] object/rangehash: Use new storage engine for work Signed-off-by: Leonard Lyubich --- pkg/services/object/rangehash/local.go | 10 +++++++--- pkg/services/object/rangehash/service.go | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/services/object/rangehash/local.go b/pkg/services/object/rangehash/local.go index 813e7d460..2f3f7f1c8 100644 --- a/pkg/services/object/rangehash/local.go +++ b/pkg/services/object/rangehash/local.go @@ -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) } diff --git a/pkg/services/object/rangehash/service.go b/pkg/services/object/rangehash/service.go index 35bc389e5..c2dd9ef5f 100644 --- a/pkg/services/object/rangehash/service.go +++ b/pkg/services/object/rangehash/service.go @@ -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 }