123 lines
3.3 KiB
Go
123 lines
3.3 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
|
|
package go_micro_transport_grpc
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
const _ = grpc.SupportPackageIsVersion6
|
|
|
|
// TransportClient is the client API for Transport service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
type TransportClient interface {
|
|
Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error)
|
|
}
|
|
|
|
type transportClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewTransportClient(cc grpc.ClientConnInterface) TransportClient {
|
|
return &transportClient{cc}
|
|
}
|
|
|
|
func (c *transportClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &_Transport_serviceDesc.Streams[0], "/go.micro.transport.grpc.Transport/Stream", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &transportStreamClient{stream}
|
|
return x, nil
|
|
}
|
|
|
|
type Transport_StreamClient interface {
|
|
Send(*Message) error
|
|
Recv() (*Message, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type transportStreamClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *transportStreamClient) Send(m *Message) error {
|
|
return x.ClientStream.SendMsg(m)
|
|
}
|
|
|
|
func (x *transportStreamClient) Recv() (*Message, error) {
|
|
m := new(Message)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// TransportServer is the server API for Transport service.
|
|
// All implementations must embed UnimplementedTransportServer
|
|
// for forward compatibility
|
|
type TransportServer interface {
|
|
Stream(Transport_StreamServer) error
|
|
mustEmbedUnimplementedTransportServer()
|
|
}
|
|
|
|
// UnimplementedTransportServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedTransportServer struct {
|
|
}
|
|
|
|
func (*UnimplementedTransportServer) Stream(Transport_StreamServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method Stream not implemented")
|
|
}
|
|
func (*UnimplementedTransportServer) mustEmbedUnimplementedTransportServer() {}
|
|
|
|
func RegisterTransportServer(s *grpc.Server, srv TransportServer) {
|
|
s.RegisterService(&_Transport_serviceDesc, srv)
|
|
}
|
|
|
|
func _Transport_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(TransportServer).Stream(&transportStreamServer{stream})
|
|
}
|
|
|
|
type Transport_StreamServer interface {
|
|
Send(*Message) error
|
|
Recv() (*Message, error)
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type transportStreamServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *transportStreamServer) Send(m *Message) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
func (x *transportStreamServer) Recv() (*Message, error) {
|
|
m := new(Message)
|
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
var _Transport_serviceDesc = grpc.ServiceDesc{
|
|
ServiceName: "go.micro.transport.grpc.Transport",
|
|
HandlerType: (*TransportServer)(nil),
|
|
Methods: []grpc.MethodDesc{},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "Stream",
|
|
Handler: _Transport_Stream_Handler,
|
|
ServerStreams: true,
|
|
ClientStreams: true,
|
|
},
|
|
},
|
|
Metadata: "transport.proto",
|
|
}
|