2020-09-21 14:31:31 +00:00
|
|
|
package putsvc
|
|
|
|
|
|
|
|
import (
|
2021-06-21 14:13:08 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/client"
|
2020-09-21 14:31:31 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
2020-09-29 15:05:22 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
2020-09-21 14:31:31 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
|
|
|
)
|
|
|
|
|
|
|
|
type PutInitPrm struct {
|
2020-09-29 15:05:22 +00:00
|
|
|
common *util.CommonPrm
|
2020-09-21 14:31:31 +00:00
|
|
|
|
|
|
|
hdr *object.RawObject
|
|
|
|
|
|
|
|
traverseOpts []placement.Option
|
2021-05-27 14:25:29 +00:00
|
|
|
|
2022-01-13 15:01:50 +00:00
|
|
|
relay func(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
|
|
|
|
}
|
|
|
|
|
2020-10-05 09:42:45 +00:00
|
|
|
func (p *PutInitPrm) WithTraverseOption(opt placement.Option) *PutInitPrm {
|
|
|
|
if p != nil {
|
|
|
|
p.traverseOpts = append(p.traverseOpts, opt)
|
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2020-09-29 15:05:22 +00:00
|
|
|
func (p *PutInitPrm) WithObject(v *object.RawObject) *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
|
|
|
|
}
|
|
|
|
|
2022-01-13 15:01:50 +00:00
|
|
|
func (p *PutInitPrm) WithRelay(f func(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
|
|
|
|
}
|