frostfs-node/pkg/services/object/put/prm.go
Pavel Karpy 7c02a2e251 [#1087] *: Adopt SDK changes
- Update `neofs-sdk-go`:
v0.0.0-20211230072947-1fe37df88f80 => v0.0.0-20220113123743-7f3162110659

- Add client interface that duplicates SDK's client behaviour and new
`MultiAddressClient` interface that has method that iterates over wrapped
clients.

- Also start using simple client mode that does not require parsing statuses
outside the SDK library.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-14 17:29:03 +03:00

62 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/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(client.NodeInfo, client.MultiAddressClient) 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(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
}