2020-12-07 17:49:47 +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-07 17:49:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type getRangeStreamerV2 struct {
|
|
|
|
objectGRPC.ObjectService_GetRangeServer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *getRangeStreamerV2) Send(resp *object.GetRangeResponse) error {
|
|
|
|
return s.ObjectService_GetRangeServer.Send(
|
2021-03-15 10:59:28 +00:00
|
|
|
resp.ToGRPCMessage().(*objectGRPC.GetRangeResponse),
|
2020-12-07 17:49:47 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetRange converts gRPC GetRangeRequest message and server-side stream and overtakes its data
|
|
|
|
// to gRPC stream.
|
|
|
|
func (s *Server) GetRange(req *objectGRPC.GetRangeRequest, gStream objectGRPC.ObjectService_GetRangeServer) error {
|
2021-03-15 10:59:28 +00:00
|
|
|
getRngReq := new(object.GetRangeRequest)
|
|
|
|
if err := getRngReq.FromGRPCMessage(req); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-12-07 17:49:47 +00:00
|
|
|
return s.srv.GetRange(
|
2021-03-15 10:59:28 +00:00
|
|
|
getRngReq,
|
2020-12-07 17:49:47 +00:00
|
|
|
&getRangeStreamerV2{
|
|
|
|
ObjectService_GetRangeServer: gStream,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|