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-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"
|
2022-03-03 14:19:05 +00:00
|
|
|
"github.com/nspcc-dev/neofs-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
|
|
|
|
2022-03-03 14:19:05 +00:00
|
|
|
hdr *object.Object
|
2020-09-21 14:31:31 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2022-03-03 14:19:05 +00:00
|
|
|
func (p *PutInitPrm) WithObject(v *object.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
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|