frostfs-node/pkg/services/object/search/search.go
Dmitrii Stepanov 44b86bac5a
Some checks failed
ci/woodpecker/push/full-pre-commit Pipeline failed
ci/woodpecker/push/pre-commit Pipeline was successful
[#148] linter: Add contextcheck linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-03-21 09:54:41 +03:00

51 lines
848 B
Go

package searchsvc
import (
"context"
"go.uber.org/zap"
)
// Search serves a request to select the objects.
func (s *Service) Search(ctx context.Context, prm Prm) error {
exec := &execCtx{
svc: s,
ctx: ctx,
prm: prm,
}
exec.prepare()
exec.setLogger(s.log)
//nolint: contextcheck
exec.execute()
return exec.statusError.err
}
func (exec *execCtx) execute() {
exec.log.Debug("serving request...")
// perform local operation
exec.executeLocal()
exec.analyzeStatus(true)
}
func (exec *execCtx) analyzeStatus(execCnr bool) {
// analyze local result
switch exec.status {
default:
exec.log.Debug("operation finished with error",
zap.String("error", exec.err.Error()),
)
case statusOK:
exec.log.Debug("operation finished successfully")
}
if execCnr {
exec.executeOnContainer()
exec.analyzeStatus(false)
}
}