frostfs-node/pkg/services/object/put/prm.go
Leonard Lyubich 8972f84672 [#607] object/put: Make client constructor to work with group address
Make Object Put service to work with `AddressGroup` instead of `Address` in
order to support multiple addresses of the storage node.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-28 15:52:50 +03:00

63 lines
1.1 KiB
Go

package putsvc
import (
"github.com/nspcc-dev/neofs-node/pkg/core/client"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
)
type PutInitPrm struct {
common *util.CommonPrm
hdr *object.RawObject
traverseOpts []placement.Option
relay func(network.AddressGroup, client.Client) 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) WithTraverseOption(opt placement.Option) *PutInitPrm {
if p != nil {
p.traverseOpts = append(p.traverseOpts, opt)
}
return p
}
func (p *PutInitPrm) WithObject(v *object.RawObject) *PutInitPrm {
if p != nil {
p.hdr = v
}
return p
}
func (p *PutInitPrm) WithRelay(f func(network.AddressGroup, client.Client) 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
}