greet.pb.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. // Code generated by protoc-gen-go.
  2. // source: greet.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package stream is a generated protocol buffer package.
  6. It is generated from these files:
  7. greet.proto
  8. It has these top-level messages:
  9. StreamReq
  10. StreamResp
  11. */
  12. package stream
  13. import (
  14. "fmt"
  15. "math"
  16. "github.com/golang/protobuf/proto"
  17. "golang.org/x/net/context"
  18. "google.golang.org/grpc"
  19. )
  20. // Reference imports to suppress errors if they are not otherwise used.
  21. var _ = proto.Marshal
  22. var _ = fmt.Errorf
  23. var _ = math.Inf
  24. // This is a compile-time assertion to ensure that this generated file
  25. // is compatible with the proto package it is being compiled against.
  26. // A compilation error at this line likely means your copy of the
  27. // proto package needs to be updated.
  28. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  29. type StreamReq struct {
  30. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
  31. }
  32. func (m *StreamReq) Reset() { *m = StreamReq{} }
  33. func (m *StreamReq) String() string { return proto.CompactTextString(m) }
  34. func (*StreamReq) ProtoMessage() {}
  35. func (*StreamReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
  36. func (m *StreamReq) GetName() string {
  37. if m != nil {
  38. return m.Name
  39. }
  40. return ""
  41. }
  42. type StreamResp struct {
  43. Greet string `protobuf:"bytes,1,opt,name=greet" json:"greet,omitempty"`
  44. }
  45. func (m *StreamResp) Reset() { *m = StreamResp{} }
  46. func (m *StreamResp) String() string { return proto.CompactTextString(m) }
  47. func (*StreamResp) ProtoMessage() {}
  48. func (*StreamResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
  49. func (m *StreamResp) GetGreet() string {
  50. if m != nil {
  51. return m.Greet
  52. }
  53. return ""
  54. }
  55. func init() {
  56. proto.RegisterType((*StreamReq)(nil), "stream.StreamReq")
  57. proto.RegisterType((*StreamResp)(nil), "stream.StreamResp")
  58. }
  59. // Reference imports to suppress errors if they are not otherwise used.
  60. var _ context.Context
  61. var _ grpc.ClientConn
  62. // This is a compile-time assertion to ensure that this generated file
  63. // is compatible with the grpc package it is being compiled against.
  64. const _ = grpc.SupportPackageIsVersion4
  65. // Client API for StreamGreeter service
  66. type StreamGreeterClient interface {
  67. Greet(ctx context.Context, opts ...grpc.CallOption) (StreamGreeter_GreetClient, error)
  68. }
  69. type streamGreeterClient struct {
  70. cc *grpc.ClientConn
  71. }
  72. func NewStreamGreeterClient(cc *grpc.ClientConn) StreamGreeterClient {
  73. return &streamGreeterClient{cc}
  74. }
  75. func (c *streamGreeterClient) Greet(ctx context.Context, opts ...grpc.CallOption) (StreamGreeter_GreetClient, error) {
  76. stream, err := grpc.NewClientStream(ctx, &_StreamGreeter_serviceDesc.Streams[0], c.cc, "/stream.StreamGreeter/greet", opts...)
  77. if err != nil {
  78. return nil, err
  79. }
  80. x := &streamGreeterGreetClient{stream}
  81. return x, nil
  82. }
  83. type StreamGreeter_GreetClient interface {
  84. Send(*StreamReq) error
  85. Recv() (*StreamResp, error)
  86. grpc.ClientStream
  87. }
  88. type streamGreeterGreetClient struct {
  89. grpc.ClientStream
  90. }
  91. func (x *streamGreeterGreetClient) Send(m *StreamReq) error {
  92. return x.ClientStream.SendMsg(m)
  93. }
  94. func (x *streamGreeterGreetClient) Recv() (*StreamResp, error) {
  95. m := new(StreamResp)
  96. if err := x.ClientStream.RecvMsg(m); err != nil {
  97. return nil, err
  98. }
  99. return m, nil
  100. }
  101. // Server API for StreamGreeter service
  102. type StreamGreeterServer interface {
  103. Greet(StreamGreeter_GreetServer) error
  104. }
  105. func RegisterStreamGreeterServer(s *grpc.Server, srv StreamGreeterServer) {
  106. s.RegisterService(&_StreamGreeter_serviceDesc, srv)
  107. }
  108. func _StreamGreeter_Greet_Handler(srv interface{}, stream grpc.ServerStream) error {
  109. return srv.(StreamGreeterServer).Greet(&streamGreeterGreetServer{stream})
  110. }
  111. type StreamGreeter_GreetServer interface {
  112. Send(*StreamResp) error
  113. Recv() (*StreamReq, error)
  114. grpc.ServerStream
  115. }
  116. type streamGreeterGreetServer struct {
  117. grpc.ServerStream
  118. }
  119. func (x *streamGreeterGreetServer) Send(m *StreamResp) error {
  120. return x.ServerStream.SendMsg(m)
  121. }
  122. func (x *streamGreeterGreetServer) Recv() (*StreamReq, error) {
  123. m := new(StreamReq)
  124. if err := x.ServerStream.RecvMsg(m); err != nil {
  125. return nil, err
  126. }
  127. return m, nil
  128. }
  129. var _StreamGreeter_serviceDesc = grpc.ServiceDesc{
  130. ServiceName: "stream.StreamGreeter",
  131. HandlerType: (*StreamGreeterServer)(nil),
  132. Methods: []grpc.MethodDesc{},
  133. Streams: []grpc.StreamDesc{
  134. {
  135. StreamName: "greet",
  136. Handler: _StreamGreeter_Greet_Handler,
  137. ServerStreams: true,
  138. ClientStreams: true,
  139. },
  140. },
  141. Metadata: "greet.proto",
  142. }
  143. func init() { proto.RegisterFile("greet.proto", fileDescriptor0) }
  144. var fileDescriptor0 = []byte{
  145. // 128 bytes of a gzipped FileDescriptorProto
  146. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0x2f, 0x4a, 0x4d,
  147. 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2b, 0x2e, 0x29, 0x4a, 0x4d, 0xcc, 0x55,
  148. 0x92, 0xe7, 0xe2, 0x0c, 0x06, 0xb3, 0x82, 0x52, 0x0b, 0x85, 0x84, 0xb8, 0x58, 0xf2, 0x12, 0x73,
  149. 0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x25, 0x25, 0x2e, 0x2e, 0x98, 0x82,
  150. 0xe2, 0x02, 0x21, 0x11, 0x2e, 0x56, 0xb0, 0x29, 0x50, 0x25, 0x10, 0x8e, 0x91, 0x33, 0x17, 0x2f,
  151. 0x44, 0x8d, 0x3b, 0x88, 0x9b, 0x5a, 0x24, 0x64, 0x04, 0x55, 0x26, 0x24, 0xa8, 0x07, 0xb1, 0x47,
  152. 0x0f, 0x6e, 0x89, 0x94, 0x10, 0xba, 0x50, 0x71, 0x81, 0x06, 0xa3, 0x01, 0x63, 0x12, 0x1b, 0xd8,
  153. 0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x34, 0x15, 0xe8, 0xa7, 0x00, 0x00, 0x00,
  154. }