package searchsvc import ( "context" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "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, prm: prm, } exec.prepare() exec.setLogger(s.log) return exec.execute(ctx) } func (exec *execCtx) execute(ctx context.Context) error { exec.log.Debug(logs.ServingRequest) err := exec.executeLocal(ctx) exec.logResult(err) if exec.isLocal() { exec.log.Debug(logs.SearchReturnResultDirectly) return err } err = exec.executeOnContainer(ctx) exec.logResult(err) return err } func (exec *execCtx) logResult(err error) { switch { default: exec.log.Debug(logs.OperationFinishedWithError, zap.String("error", err.Error())) case err == nil: exec.log.Debug(logs.OperationFinishedSuccessfully) } }