2020-12-02 23:45:25 +00:00
|
|
|
package object
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
|
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|