[#193] getsvc: Resolve context linters

Resolve containedctx and contextcheck linters.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-31 14:49:40 +03:00 committed by Gitea
parent 206458c841
commit 1bf21dbb47
9 changed files with 39 additions and 48 deletions

View file

@ -65,7 +65,6 @@ func (s *Service) Head(ctx context.Context, prm HeadPrm) error {
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) statusError {
exec := &execCtx{
svc: s,
ctx: ctx,
prm: RangePrm{
commonPrm: prm,
},
@ -78,22 +77,21 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
exec.setLogger(s.log)
//nolint: contextcheck
exec.execute()
exec.execute(ctx)
return exec.statusError
}
func (exec *execCtx) execute() {
func (exec *execCtx) execute(ctx context.Context) {
exec.log.Debug("serving request...")
// perform local operation
exec.executeLocal()
exec.executeLocal(ctx)
exec.analyzeStatus(true)
exec.analyzeStatus(ctx, true)
}
func (exec *execCtx) analyzeStatus(execCnr bool) {
func (exec *execCtx) analyzeStatus(ctx context.Context, execCnr bool) {
// analyze local result
switch exec.status {
case statusOK:
@ -102,7 +100,7 @@ func (exec *execCtx) analyzeStatus(execCnr bool) {
exec.log.Debug("requested object was marked as removed")
case statusVIRTUAL:
exec.log.Debug("requested object is virtual")
exec.assemble()
exec.assemble(ctx)
case statusOutOfRange:
exec.log.Debug("requested range is out of object bounds")
default:
@ -111,8 +109,8 @@ func (exec *execCtx) analyzeStatus(execCnr bool) {
)
if execCnr {
exec.executeOnContainer()
exec.analyzeStatus(false)
exec.executeOnContainer(ctx)
exec.analyzeStatus(ctx, false)
}
}
}