2020-12-02 23:45:25 +00:00
|
|
|
package object
|
|
|
|
|
|
|
|
import (
|
2024-11-07 14:32:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
|
|
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc"
|
2020-12-02 23:45:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type getStreamerV2 struct {
|
|
|
|
objectGRPC.ObjectService_GetServer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *getStreamerV2) Send(resp *object.GetResponse) error {
|
|
|
|
return s.ObjectService_GetServer.Send(
|
2021-03-15 10:59:28 +00:00
|
|
|
resp.ToGRPCMessage().(*objectGRPC.GetResponse),
|
2020-12-02 23:45:25 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get converts gRPC GetRequest message and server-side stream and overtakes its data
|
|
|
|
// to gRPC stream.
|
|
|
|
func (s *Server) Get(req *objectGRPC.GetRequest, gStream objectGRPC.ObjectService_GetServer) error {
|
2021-03-15 10:59:28 +00:00
|
|
|
getReq := new(object.GetRequest)
|
|
|
|
if err := getReq.FromGRPCMessage(req); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-12-02 23:45:25 +00:00
|
|
|
return s.srv.Get(
|
2021-03-15 10:59:28 +00:00
|
|
|
getReq,
|
2020-12-02 23:45:25 +00:00
|
|
|
&getStreamerV2{
|
|
|
|
ObjectService_GetServer: gStream,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|