2020-09-22 06:51:47 +00:00
|
|
|
package searchsvc
|
|
|
|
|
|
|
|
import (
|
2021-06-21 14:13:08 +00:00
|
|
|
coreclient "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"
|
2021-11-10 07:08:33 +00:00
|
|
|
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
|
|
|
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
2022-01-26 12:11:13 +00:00
|
|
|
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
2020-09-22 06:51:47 +00:00
|
|
|
)
|
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
// Prm groups parameters of Get service call.
|
2020-09-22 06:51:47 +00:00
|
|
|
type Prm struct {
|
2020-12-10 12:26:40 +00:00
|
|
|
writer IDListWriter
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
common *util.CommonPrm
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2021-11-01 08:35:33 +00:00
|
|
|
cid *cid.ID
|
|
|
|
|
|
|
|
filters objectSDK.SearchFilters
|
2021-04-29 08:54:40 +00:00
|
|
|
|
|
|
|
forwarder RequestForwarder
|
2020-12-10 12:26:40 +00:00
|
|
|
}
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
// IDListWriter is an interface of target component
|
|
|
|
// to write list of object identifiers.
|
|
|
|
type IDListWriter interface {
|
2022-01-26 12:11:13 +00:00
|
|
|
WriteIDs([]*oidSDK.ID) error
|
2020-09-22 06:51:47 +00:00
|
|
|
}
|
|
|
|
|
2021-04-29 08:54:40 +00:00
|
|
|
// RequestForwarder is a callback for forwarding of the
|
|
|
|
// original Search requests.
|
2022-01-26 12:11:13 +00:00
|
|
|
type RequestForwarder func(coreclient.NodeInfo, coreclient.MultiAddressClient) ([]*oidSDK.ID, error)
|
2021-04-29 08:54:40 +00:00
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
// SetCommonParameters sets common parameters of the operation.
|
|
|
|
func (p *Prm) SetCommonParameters(common *util.CommonPrm) {
|
|
|
|
p.common = common
|
|
|
|
}
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
// SetWriter sets target component to write list of object identifiers.
|
|
|
|
func (p *Prm) SetWriter(w IDListWriter) {
|
|
|
|
p.writer = w
|
2020-09-22 06:51:47 +00:00
|
|
|
}
|
2021-04-29 08:54:40 +00:00
|
|
|
|
|
|
|
// SetRequestForwarder sets callback for forwarding
|
|
|
|
// of the original request.
|
|
|
|
func (p *Prm) SetRequestForwarder(f RequestForwarder) {
|
|
|
|
p.forwarder = f
|
|
|
|
}
|
2021-11-01 08:35:33 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|