frostfs-node/pkg/network/transport/object/grpc/get.go
Pavel Karpy 923f84722a Move to frostfs-node
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
2022-12-28 15:04:29 +03:00

32 lines
778 B
Go

package object
import (
"github.com/TrueCloudLab/frostfs-api-go/v2/object"
objectGRPC "github.com/TrueCloudLab/frostfs-api-go/v2/object/grpc"
)
type getStreamerV2 struct {
objectGRPC.ObjectService_GetServer
}
func (s *getStreamerV2) Send(resp *object.GetResponse) error {
return s.ObjectService_GetServer.Send(
resp.ToGRPCMessage().(*objectGRPC.GetResponse),
)
}
// 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 {
getReq := new(object.GetRequest)
if err := getReq.FromGRPCMessage(req); err != nil {
return err
}
return s.srv.Get(
getReq,
&getStreamerV2{
ObjectService_GetServer: gStream,
},
)
}