From ba58144de14355680ec8347500c70bff33882639 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 24 Aug 2023 20:54:29 +0300 Subject: [PATCH] [#647] objsvc/search: Remove netmap.Source wrapper Signed-off-by: Evgenii Stratonikov --- pkg/services/object/search/exec.go | 2 +- pkg/services/object/search/search_test.go | 2 +- pkg/services/object/search/service.go | 10 ++++------ pkg/services/object/search/util.go | 9 --------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/pkg/services/object/search/exec.go b/pkg/services/object/search/exec.go index c1a9a0c1c..f471da20e 100644 --- a/pkg/services/object/search/exec.go +++ b/pkg/services/object/search/exec.go @@ -74,7 +74,7 @@ func (exec *execCtx) initEpoch() bool { return true } - e, err := exec.svc.currentEpochReceiver.currentEpoch() + e, err := exec.svc.currentEpochReceiver.Epoch() switch { default: diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 1eb32a29a..d8c5ad090 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -56,7 +56,7 @@ type simpleIDWriter struct { type testEpochReceiver uint64 -func (e testEpochReceiver) currentEpoch() (uint64, error) { +func (e testEpochReceiver) Epoch() (uint64, error) { return uint64(e), nil } diff --git a/pkg/services/object/search/service.go b/pkg/services/object/search/service.go index 16b82a620..fd3dbb07b 100644 --- a/pkg/services/object/search/service.go +++ b/pkg/services/object/search/service.go @@ -49,7 +49,7 @@ type cfg struct { } currentEpochReceiver interface { - currentEpoch() (uint64, error) + Epoch() (uint64, error) } keyStore *util.KeyStorage @@ -71,11 +71,9 @@ func New(e *engine.StorageEngine, localStorage: &storageEngineWrapper{ storage: e, }, - traverserGenerator: (*traverseGeneratorWrapper)(tg), - currentEpochReceiver: &nmSrcWrapper{ - nmSrc: ns, - }, - keyStore: ks, + traverserGenerator: (*traverseGeneratorWrapper)(tg), + currentEpochReceiver: ns, + keyStore: ks, } for i := range opts { diff --git a/pkg/services/object/search/util.go b/pkg/services/object/search/util.go index b5b351a3b..6ea8e3f14 100644 --- a/pkg/services/object/search/util.go +++ b/pkg/services/object/search/util.go @@ -5,7 +5,6 @@ import ( "sync" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/engine" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" @@ -36,10 +35,6 @@ type storageEngineWrapper struct { type traverseGeneratorWrapper util.TraverserGenerator -type nmSrcWrapper struct { - nmSrc netmap.Source -} - func newUniqueAddressWriter(w IDListWriter) IDListWriter { return &uniqueIDWriter{ written: make(map[oid.ID]struct{}), @@ -143,7 +138,3 @@ func idsFromAddresses(addrs []oid.Address) []oid.ID { func (e *traverseGeneratorWrapper) generateTraverser(cnr cid.ID, epoch uint64) (*placement.Traverser, error) { return (*util.TraverserGenerator)(e).GenerateTraverser(cnr, nil, epoch) } - -func (n *nmSrcWrapper) currentEpoch() (uint64, error) { - return n.nmSrc.Epoch() -}