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
846 B
Go
32 lines
846 B
Go
package object
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc"
|
|
)
|
|
|
|
type searchStreamerV2 struct {
|
|
objectGRPC.ObjectService_SearchServer
|
|
}
|
|
|
|
func (s *searchStreamerV2) Send(resp *object.SearchResponse) error {
|
|
return s.ObjectService_SearchServer.Send(
|
|
resp.ToGRPCMessage().(*objectGRPC.SearchResponse),
|
|
)
|
|
}
|
|
|
|
// Search converts gRPC SearchRequest message and server-side stream and overtakes its data
|
|
// to gRPC stream.
|
|
func (s *Server) Search(req *objectGRPC.SearchRequest, gStream objectGRPC.ObjectService_SearchServer) error {
|
|
searchReq := new(object.SearchRequest)
|
|
if err := searchReq.FromGRPCMessage(req); err != nil {
|
|
return err
|
|
}
|
|
|
|
return s.srv.Search(
|
|
searchReq,
|
|
&searchStreamerV2{
|
|
ObjectService_SearchServer: gStream,
|
|
},
|
|
)
|
|
}
|