frostfs-node/pkg/services/object/put/prm.go
Airat Arifullin e890f1b4b1 [#1307] object: Implement Patch method
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-08-16 14:13:09 +00:00

78 lines
1.5 KiB
Go

package putsvc
import (
"context"
"crypto/ecdsa"
"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"
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
)
type PutInitPrm struct {
common *util.CommonPrm
hdr *objectSDK.Object
cnr containerSDK.Container
traverseOpts []placement.Option
relay func(context.Context, client.NodeInfo, client.MultiAddressClient) error
privateKey *ecdsa.PrivateKey
}
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 *objectSDK.Object) *PutInitPrm {
if p != nil {
p.hdr = v
}
return p
}
func (p *PutInitPrm) WithCopyNumbers(v []uint32) *PutInitPrm {
if p != nil && len(v) > 0 {
p.traverseOpts = append(p.traverseOpts, placement.WithCopyNumbers(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
}
func (p *PutInitPrm) WithPrivateKey(v *ecdsa.PrivateKey) *PutInitPrm {
if p != nil {
p.privateKey = v
}
return p
}