e6b30aed36
In previous implementation node's Object Search V2 service handler created a new request for each RPC. Now original requests are re-signed according to API specification. Logical handler abstracts from this version-dependent logic through `RequestForwarder` callback. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package searchsvc
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
|
)
|
|
|
|
// Prm groups parameters of Get service call.
|
|
type Prm struct {
|
|
writer IDListWriter
|
|
|
|
common *util.CommonPrm
|
|
|
|
client.SearchObjectParams
|
|
|
|
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(client.Client) ([]*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
|
|
}
|