frostfs-node/pkg/services/object/search/prm.go
Pavel Karpy 923f84722a Move to frostfs-node
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
2022-12-28 15:04:29 +03:00

58 lines
1.5 KiB
Go

package searchsvc
import (
coreclient "github.com/TrueCloudLab/frostfs-node/pkg/core/client"
"github.com/TrueCloudLab/frostfs-node/pkg/services/object/util"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
oid "github.com/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 object.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(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 object.SearchFilters) {
p.filters = fs
}