2020-09-21 14:31:31 +00:00
|
|
|
package putsvc
|
|
|
|
|
|
|
|
import (
|
2023-04-12 08:02:25 +00:00
|
|
|
"context"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"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"
|
2023-07-06 12:36:41 +00:00
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2020-09-21 14:31:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type PutInitPrm struct {
|
2020-09-29 15:05:22 +00:00
|
|
|
common *util.CommonPrm
|
2020-09-21 14:31:31 +00:00
|
|
|
|
2023-07-06 12:36:41 +00:00
|
|
|
hdr *objectSDK.Object
|
2020-09-21 14:31:31 +00:00
|
|
|
|
2022-04-29 18:44:00 +00:00
|
|
|
cnr containerSDK.Container
|
|
|
|
|
2020-09-21 14:31:31 +00:00
|
|
|
traverseOpts []placement.Option
|
2021-05-27 14:25:29 +00:00
|
|
|
|
2023-04-12 08:02:25 +00:00
|
|
|
relay func(context.Context, client.NodeInfo, client.MultiAddressClient) error
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PutChunkPrm struct {
|
|
|
|
chunk []byte
|
|
|
|
}
|
|
|
|
|
2020-09-29 15:05:22 +00:00
|
|
|
func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm {
|
2020-09-21 14:31:31 +00:00
|
|
|
if p != nil {
|
2020-09-29 15:05:22 +00:00
|
|
|
p.common = v
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2023-07-06 12:36:41 +00:00
|
|
|
func (p *PutInitPrm) WithObject(v *objectSDK.Object) *PutInitPrm {
|
2020-09-21 14:31:31 +00:00
|
|
|
if p != nil {
|
2020-09-29 15:05:22 +00:00
|
|
|
p.hdr = v
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2023-04-11 18:01:00 +00:00
|
|
|
func (p *PutInitPrm) WithCopyNumbers(v []uint32) *PutInitPrm {
|
|
|
|
if p != nil && len(v) > 0 {
|
|
|
|
p.traverseOpts = append(p.traverseOpts, placement.WithCopyNumbers(v))
|
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2023-04-12 08:02:25 +00:00
|
|
|
func (p *PutInitPrm) WithRelay(f func(context.Context, client.NodeInfo, client.MultiAddressClient) error) *PutInitPrm {
|
2021-05-27 14:25:29 +00:00
|
|
|
if p != nil {
|
|
|
|
p.relay = f
|
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2020-09-21 14:31:31 +00:00
|
|
|
func (p *PutChunkPrm) WithChunk(v []byte) *PutChunkPrm {
|
|
|
|
if p != nil {
|
|
|
|
p.chunk = v
|
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|