Alexander Chuprov
033eaf77e1
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m52s
Build / Build Components (1.19) (pull_request) Successful in 4m1s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m55s
Tests and linters / Lint (pull_request) Successful in 14m40s
Tests and linters / Tests (1.19) (pull_request) Successful in 15m29s
ci/woodpecker/push/pre-commit Pipeline was successful
Standardize the alias of the import frostfs-sdk-go/object as objectSDK. Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package searchsvc
|
|
|
|
import (
|
|
"context"
|
|
|
|
coreclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
|
)
|
|
|
|
// Prm groups parameters of Get service call.
|
|
type Prm struct {
|
|
writer IDListWriter
|
|
|
|
common *util.CommonPrm
|
|
|
|
cnr cid.ID
|
|
|
|
filters objectSDK.SearchFilters
|
|
|
|
forwarder RequestForwarder
|
|
}
|
|
|
|
// IDListWriter is an interface of target component
|
|
// to write list of object identifiers.
|
|
type IDListWriter interface {
|
|
WriteIDs([]oid.ID) error
|
|
}
|
|
|
|
// RequestForwarder is a callback for forwarding of the
|
|
// original Search requests.
|
|
type RequestForwarder func(context.Context, coreclient.NodeInfo, coreclient.MultiAddressClient) ([]oid.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.cnr = id
|
|
}
|
|
|
|
// WithSearchFilters sets search filters.
|
|
func (p *Prm) WithSearchFilters(fs objectSDK.SearchFilters) {
|
|
p.filters = fs
|
|
}
|