frostfs-node/pkg/services/object/put/prm.go
Dmitrii Stepanov 200fc8b882 [#242] put: Pass context to relay function
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-04-14 10:25:53 +00:00

59 lines
1.1 KiB
Go

package putsvc
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
)
type PutInitPrm struct {
common *util.CommonPrm
hdr *object.Object
cnr containerSDK.Container
traverseOpts []placement.Option
relay func(context.Context, client.NodeInfo, client.MultiAddressClient) error
}
type PutChunkPrm struct {
chunk []byte
}
func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm {
if p != nil {
p.common = v
}
return p
}
func (p *PutInitPrm) WithObject(v *object.Object) *PutInitPrm {
if p != nil {
p.hdr = v
}
return p
}
func (p *PutInitPrm) WithRelay(f func(context.Context, client.NodeInfo, client.MultiAddressClient) error) *PutInitPrm {
if p != nil {
p.relay = f
}
return p
}
func (p *PutChunkPrm) WithChunk(v []byte) *PutChunkPrm {
if p != nil {
p.chunk = v
}
return p
}