[#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
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:
parent
519cf71a27
commit
6da33cd724
1 changed files with 14 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue