frostfs-node/pkg/services/object/search/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

57 lines
1.5 KiB
Go

package searchsvc
import (
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
)
// Prm groups parameters of Get service call.
type Prm struct {
writer IDListWriter
common *util.CommonPrm
cid *cid.ID
filters objectSDK.SearchFilters
forwarder RequestForwarder
}
// IDListWriter is an interface of target component
// to write list of object identifiers.
type IDListWriter interface {
WriteIDs([]*objectSDK.ID) error
}
// RequestForwarder is a callback for forwarding of the
// original Search requests.
type RequestForwarder func(coreclient.NodeInfo, coreclient.MultiAddressClient) ([]*objectSDK.ID, error)
// SetCommonParameters sets common parameters of the operation.
func (p *Prm) SetCommonParameters(common *util.CommonPrm) {
p.common = common
}
// SetWriter sets target component to write list of object identifiers.
func (p *Prm) SetWriter(w IDListWriter) {
p.writer = w
}
// SetRequestForwarder sets callback for forwarding
// of the original request.
func (p *Prm) SetRequestForwarder(f RequestForwarder) {
p.forwarder = f
}
// WithContainerID sets identifier of the container to search the objects.
func (p *Prm) WithContainerID(id *cid.ID) {
p.cid = id
}
// WithSearchFilters sets search filters.
func (p *Prm) WithSearchFilters(fs objectSDK.SearchFilters) {
p.filters = fs
}