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
876 B
Go
32 lines
876 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 getRangeStreamerV2 struct {
|
|
objectGRPC.ObjectService_GetRangeServer
|
|
}
|
|
|
|
func (s *getRangeStreamerV2) Send(resp *object.GetRangeResponse) error {
|
|
return s.ObjectService_GetRangeServer.Send(
|
|
resp.ToGRPCMessage().(*objectGRPC.GetRangeResponse),
|
|
)
|
|
}
|
|
|
|
// 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 {
|
|
getRngReq := new(object.GetRangeRequest)
|
|
if err := getRngReq.FromGRPCMessage(req); err != nil {
|
|
return err
|
|
}
|
|
|
|
return s.srv.GetRange(
|
|
getRngReq,
|
|
&getRangeStreamerV2{
|
|
ObjectService_GetRangeServer: gStream,
|
|
},
|
|
)
|
|
}
|