[#9999] object: Fix IO tag adjustment for Put/Patch
There was no tag adjustment for CloseAndRecv. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
2d4749c73a
commit
f380fcafee
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