260 lines
8.4 KiB
Go
260 lines
8.4 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: helloworld.proto
|
|
|
|
/*
|
|
Package helloworld is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
helloworld.proto
|
|
|
|
It has these top-level messages:
|
|
HelloRequest
|
|
HelloReply
|
|
StreamExampleRequest
|
|
StreamExampleReply
|
|
*/
|
|
package helloworld
|
|
|
|
import proto "github.com/golang/protobuf/proto"
|
|
import fmt "fmt"
|
|
import math "math"
|
|
|
|
import (
|
|
context "context"
|
|
|
|
grpc "google.golang.org/grpc"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
|
|
|
// The request message containing the user's name.
|
|
type HelloRequest struct {
|
|
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
|
}
|
|
|
|
func (m *HelloRequest) Reset() { *m = HelloRequest{} }
|
|
func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*HelloRequest) ProtoMessage() {}
|
|
func (*HelloRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
|
|
|
func (m *HelloRequest) GetName() string {
|
|
if m != nil {
|
|
return m.Name
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// The response message containing the greetings
|
|
type HelloReply struct {
|
|
Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
|
|
}
|
|
|
|
func (m *HelloReply) Reset() { *m = HelloReply{} }
|
|
func (m *HelloReply) String() string { return proto.CompactTextString(m) }
|
|
func (*HelloReply) ProtoMessage() {}
|
|
func (*HelloReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
|
|
|
func (m *HelloReply) GetMessage() string {
|
|
if m != nil {
|
|
return m.Message
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type StreamExampleRequest struct {
|
|
}
|
|
|
|
func (m *StreamExampleRequest) Reset() { *m = StreamExampleRequest{} }
|
|
func (m *StreamExampleRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*StreamExampleRequest) ProtoMessage() {}
|
|
func (*StreamExampleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
|
|
|
type StreamExampleReply struct {
|
|
Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
|
|
}
|
|
|
|
func (m *StreamExampleReply) Reset() { *m = StreamExampleReply{} }
|
|
func (m *StreamExampleReply) String() string { return proto.CompactTextString(m) }
|
|
func (*StreamExampleReply) ProtoMessage() {}
|
|
func (*StreamExampleReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
|
|
|
func (m *StreamExampleReply) GetData() string {
|
|
if m != nil {
|
|
return m.Data
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterType((*HelloRequest)(nil), "helloworld.HelloRequest")
|
|
proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply")
|
|
proto.RegisterType((*StreamExampleRequest)(nil), "helloworld.StreamExampleRequest")
|
|
proto.RegisterType((*StreamExampleReply)(nil), "helloworld.StreamExampleReply")
|
|
}
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ context.Context
|
|
var _ grpc.ClientConn
|
|
|
|
// 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.SupportPackageIsVersion4
|
|
|
|
// Client API for Greeter service
|
|
|
|
type GreeterClient interface {
|
|
// Sends a greeting
|
|
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
|
// Tick me
|
|
StreamExample(ctx context.Context, in *StreamExampleRequest, opts ...grpc.CallOption) (Greeter_StreamExampleClient, error)
|
|
}
|
|
|
|
type greeterClient struct {
|
|
cc *grpc.ClientConn
|
|
}
|
|
|
|
func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
|
|
return &greeterClient{cc}
|
|
}
|
|
|
|
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
|
out := new(HelloReply)
|
|
err := grpc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, c.cc, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *greeterClient) StreamExample(ctx context.Context, in *StreamExampleRequest, opts ...grpc.CallOption) (Greeter_StreamExampleClient, error) {
|
|
stream, err := grpc.NewClientStream(ctx, &_Greeter_serviceDesc.Streams[0], c.cc, "/helloworld.Greeter/StreamExample", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &greeterStreamExampleClient{stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type Greeter_StreamExampleClient interface {
|
|
Recv() (*StreamExampleReply, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type greeterStreamExampleClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *greeterStreamExampleClient) Recv() (*StreamExampleReply, error) {
|
|
m := new(StreamExampleReply)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// Server API for Greeter service
|
|
|
|
type GreeterServer interface {
|
|
// Sends a greeting
|
|
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
|
|
// Tick me
|
|
StreamExample(*StreamExampleRequest, Greeter_StreamExampleServer) error
|
|
}
|
|
|
|
func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
|
|
s.RegisterService(&_Greeter_serviceDesc, srv)
|
|
}
|
|
|
|
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HelloRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(GreeterServer).SayHello(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/helloworld.Greeter/SayHello",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Greeter_StreamExample_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(StreamExampleRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(GreeterServer).StreamExample(m, &greeterStreamExampleServer{stream})
|
|
}
|
|
|
|
type Greeter_StreamExampleServer interface {
|
|
Send(*StreamExampleReply) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type greeterStreamExampleServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *greeterStreamExampleServer) Send(m *StreamExampleReply) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
var _Greeter_serviceDesc = grpc.ServiceDesc{
|
|
ServiceName: "helloworld.Greeter",
|
|
HandlerType: (*GreeterServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "SayHello",
|
|
Handler: _Greeter_SayHello_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "StreamExample",
|
|
Handler: _Greeter_StreamExample_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "helloworld.proto",
|
|
}
|
|
|
|
func init() { proto.RegisterFile("helloworld.proto", fileDescriptor0) }
|
|
|
|
var fileDescriptor0 = []byte{
|
|
// 231 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x50, 0xc1, 0x4a, 0xc4, 0x30,
|
|
0x10, 0x35, 0xb0, 0xb8, 0x3a, 0x28, 0xca, 0x20, 0x4b, 0x59, 0x41, 0x96, 0x1c, 0x64, 0x4f, 0xa1,
|
|
0xe8, 0xdd, 0x43, 0x41, 0xf4, 0x58, 0x5a, 0xc4, 0x73, 0xb4, 0x43, 0x15, 0x12, 0x13, 0x93, 0x88,
|
|
0xf6, 0x6f, 0xfc, 0x54, 0x49, 0x6c, 0x31, 0x4a, 0xf1, 0xf6, 0x66, 0xe6, 0xe5, 0xbd, 0x97, 0x07,
|
|
0xc7, 0x4f, 0xa4, 0x94, 0x79, 0x37, 0x4e, 0x75, 0xc2, 0x3a, 0x13, 0x0c, 0xc2, 0xcf, 0x86, 0x73,
|
|
0x38, 0xb8, 0x8d, 0x53, 0x43, 0xaf, 0x6f, 0xe4, 0x03, 0x22, 0x2c, 0x5e, 0xa4, 0xa6, 0x82, 0x6d,
|
|
0xd8, 0x76, 0xbf, 0x49, 0x98, 0x9f, 0x03, 0x8c, 0x1c, 0xab, 0x06, 0x2c, 0x60, 0xa9, 0xc9, 0x7b,
|
|
0xd9, 0x4f, 0xa4, 0x69, 0xe4, 0x2b, 0x38, 0x69, 0x83, 0x23, 0xa9, 0xaf, 0x3f, 0xa4, 0xb6, 0x8a,
|
|
0x46, 0x4d, 0xbe, 0x05, 0xfc, 0xb3, 0x8f, 0x3a, 0x08, 0x8b, 0x4e, 0x06, 0x39, 0x39, 0x45, 0x7c,
|
|
0xf1, 0xc9, 0x60, 0x79, 0xe3, 0x88, 0x02, 0x39, 0xbc, 0x82, 0xbd, 0x56, 0x0e, 0xc9, 0x18, 0x0b,
|
|
0x91, 0x7d, 0x22, 0xcf, 0xbb, 0x5e, 0xcd, 0x5c, 0xac, 0x1a, 0xf8, 0x0e, 0xde, 0xc1, 0xe1, 0x2f,
|
|
0x57, 0xdc, 0xe4, 0xd4, 0xb9, 0xa0, 0xeb, 0xb3, 0x7f, 0x18, 0x49, 0xb4, 0x64, 0x55, 0x09, 0xa7,
|
|
0xcf, 0x46, 0xf4, 0xce, 0x3e, 0x0a, 0xfa, 0xbe, 0xf9, 0xec, 0x55, 0x75, 0x94, 0x32, 0xdc, 0x47,
|
|
0x5c, 0xc7, 0xb2, 0x6b, 0xf6, 0xb0, 0x9b, 0x5a, 0xbf, 0xfc, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x6f,
|
|
0x5f, 0xae, 0xb8, 0x89, 0x01, 0x00, 0x00,
|
|
}
|