forked from TrueCloudLab/frostfs-node
[#647] objsvc/search: Wrap in uniqueIDWriter during parameter setting
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
966ad22abf
commit
4db2cbc927
4 changed files with 6 additions and 11 deletions
|
@ -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"),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue