diff --git a/pkg/services/object/search/exec.go b/pkg/services/object/search/exec.go index 62ef5827..2e0d4877 100644 --- a/pkg/services/object/search/exec.go +++ b/pkg/services/object/search/exec.go @@ -18,12 +18,6 @@ type execCtx struct { curProcEpoch uint64 } -func (exec *execCtx) prepare() { - if _, ok := exec.prm.writer.(*uniqueIDWriter); !ok { - exec.prm.writer = newUniqueAddressWriter(exec.prm.writer) - } -} - func (exec *execCtx) setLogger(l *logger.Logger) { exec.log = &logger.Logger{Logger: l.With( zap.String("request", "SEARCH"), diff --git a/pkg/services/object/search/prm.go b/pkg/services/object/search/prm.go index d2918d6e..95fe82e2 100644 --- a/pkg/services/object/search/prm.go +++ b/pkg/services/object/search/prm.go @@ -12,7 +12,7 @@ import ( // Prm groups parameters of Get service call. type Prm struct { - writer IDListWriter + writer *uniqueIDWriter common *util.CommonPrm @@ -40,7 +40,7 @@ func (p *Prm) SetCommonParameters(common *util.CommonPrm) { // SetWriter sets target component to write list of object identifiers. func (p *Prm) SetWriter(w IDListWriter) { - p.writer = w + p.writer = newUniqueAddressWriter(w) } // SetRequestForwarder sets callback for forwarding diff --git a/pkg/services/object/search/search.go b/pkg/services/object/search/search.go index 2be6bb0e..4a5c414d 100644 --- a/pkg/services/object/search/search.go +++ b/pkg/services/object/search/search.go @@ -14,8 +14,6 @@ func (s *Service) Search(ctx context.Context, prm Prm) error { prm: prm, } - exec.prepare() - exec.setLogger(s.log) return exec.execute(ctx) diff --git a/pkg/services/object/search/util.go b/pkg/services/object/search/util.go index 37d21525..67b6c0d0 100644 --- a/pkg/services/object/search/util.go +++ b/pkg/services/object/search/util.go @@ -31,7 +31,10 @@ type storageEngineWrapper struct { storage *engine.StorageEngine } -func newUniqueAddressWriter(w IDListWriter) IDListWriter { +func newUniqueAddressWriter(w IDListWriter) *uniqueIDWriter { + if w, ok := w.(*uniqueIDWriter); ok { + return w + } return &uniqueIDWriter{ written: make(map[oid.ID]struct{}), writer: w,