forked from TrueCloudLab/frostfs-node
Airat Arifullin
9b13a18aac
* Update version within go.mod; * Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api instead. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
32 lines
950 B
Go
32 lines
950 B
Go
package searchsvc
|
|
|
|
import (
|
|
objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
|
|
searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search"
|
|
objutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
|
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
|
)
|
|
|
|
// Service implements Search operation of Object service v2.
|
|
type Service struct {
|
|
svc *searchsvc.Service
|
|
keyStorage *objutil.KeyStorage
|
|
}
|
|
|
|
// NewService constructs Service instance from provided options.
|
|
func NewService(s *searchsvc.Service, ks *objutil.KeyStorage) *Service {
|
|
return &Service{
|
|
svc: s,
|
|
keyStorage: ks,
|
|
}
|
|
}
|
|
|
|
// Search calls internal service and returns v2 object stream.
|
|
func (s *Service) Search(req *objectV2.SearchRequest, stream objectSvc.SearchStream) error {
|
|
p, err := s.toPrm(req, stream)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return s.svc.Search(stream.Context(), *p)
|
|
}
|