[#9999] object: Fix IO tag adjustment for Put/Patch
Some checks failed
DCO action / DCO (pull_request) Successful in 44s
Vulncheck / Vulncheck (pull_request) Successful in 1m1s
Build / Build Components (pull_request) Successful in 1m33s
Pre-commit hooks / Pre-commit (pull_request) Failing after 1m34s
Tests and linters / gopls check (pull_request) Successful in 2m46s
Tests and linters / Tests with -race (pull_request) Successful in 3m9s
Tests and linters / Run gofumpt (pull_request) Successful in 4m27s
Tests and linters / Lint (pull_request) Successful in 4m45s
Tests and linters / Staticcheck (pull_request) Successful in 4m47s
Tests and linters / Tests (pull_request) Successful in 4m56s

There was no tag adjustment for CloseAndRecv.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-02-10 17:55:34 +03:00
parent 519cf71a27
commit 6da33cd724
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -3,6 +3,8 @@ package object
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
"git.frostfs.info/TrueCloudLab/frostfs-qos/tagging"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
)
@ -120,13 +122,24 @@ type qosSendRecv[TReq qosVerificationHeader, TResp any] interface {
type qosWriteStream[TReq qosVerificationHeader, TResp any] struct {
s qosSendRecv[TReq, TResp]
adj AdjustIOTag
ioTag string
ioTagDefined bool
}
func (q *qosWriteStream[TReq, TResp]) CloseAndRecv(ctx context.Context) (TResp, error) {
if q.ioTagDefined {
ctx = tagging.ContextWithIOTag(ctx, q.ioTag)
}
return q.s.CloseAndRecv(ctx)
}
func (q *qosWriteStream[TReq, TResp]) Send(ctx context.Context, req TReq) error {
ctx = q.adj.AdjustIncomingTag(ctx, req.GetVerificationHeader().GetBodySignature().GetKey())
if !q.ioTagDefined {
ctx = q.adj.AdjustIncomingTag(ctx, req.GetVerificationHeader().GetBodySignature().GetKey())
q.ioTag, q.ioTagDefined = tagging.IOTagFromContext(ctx)
}
assert.Cond(q.ioTagDefined, "io tag undefined after incoming tag adjustment")
ctx = tagging.ContextWithIOTag(ctx, q.ioTag)
return q.s.Send(ctx, req)
}