echo.pb.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: echo.proto
  3. package echo // import "google.golang.org/grpc/examples/features/proto/echo"
  4. import proto "github.com/golang/protobuf/proto"
  5. import fmt "fmt"
  6. import math "math"
  7. import (
  8. context "golang.org/x/net/context"
  9. grpc "google.golang.org/grpc"
  10. )
  11. // Reference imports to suppress errors if they are not otherwise used.
  12. var _ = proto.Marshal
  13. var _ = fmt.Errorf
  14. var _ = math.Inf
  15. // This is a compile-time assertion to ensure that this generated file
  16. // is compatible with the proto package it is being compiled against.
  17. // A compilation error at this line likely means your copy of the
  18. // proto package needs to be updated.
  19. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  20. // EchoRequest is the request for echo.
  21. type EchoRequest struct {
  22. Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
  23. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  24. XXX_unrecognized []byte `json:"-"`
  25. XXX_sizecache int32 `json:"-"`
  26. }
  27. func (m *EchoRequest) Reset() { *m = EchoRequest{} }
  28. func (m *EchoRequest) String() string { return proto.CompactTextString(m) }
  29. func (*EchoRequest) ProtoMessage() {}
  30. func (*EchoRequest) Descriptor() ([]byte, []int) {
  31. return fileDescriptor_echo_9d6886b3223721ca, []int{0}
  32. }
  33. func (m *EchoRequest) XXX_Unmarshal(b []byte) error {
  34. return xxx_messageInfo_EchoRequest.Unmarshal(m, b)
  35. }
  36. func (m *EchoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  37. return xxx_messageInfo_EchoRequest.Marshal(b, m, deterministic)
  38. }
  39. func (dst *EchoRequest) XXX_Merge(src proto.Message) {
  40. xxx_messageInfo_EchoRequest.Merge(dst, src)
  41. }
  42. func (m *EchoRequest) XXX_Size() int {
  43. return xxx_messageInfo_EchoRequest.Size(m)
  44. }
  45. func (m *EchoRequest) XXX_DiscardUnknown() {
  46. xxx_messageInfo_EchoRequest.DiscardUnknown(m)
  47. }
  48. var xxx_messageInfo_EchoRequest proto.InternalMessageInfo
  49. func (m *EchoRequest) GetMessage() string {
  50. if m != nil {
  51. return m.Message
  52. }
  53. return ""
  54. }
  55. // EchoResponse is the response for echo.
  56. type EchoResponse struct {
  57. Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
  58. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  59. XXX_unrecognized []byte `json:"-"`
  60. XXX_sizecache int32 `json:"-"`
  61. }
  62. func (m *EchoResponse) Reset() { *m = EchoResponse{} }
  63. func (m *EchoResponse) String() string { return proto.CompactTextString(m) }
  64. func (*EchoResponse) ProtoMessage() {}
  65. func (*EchoResponse) Descriptor() ([]byte, []int) {
  66. return fileDescriptor_echo_9d6886b3223721ca, []int{1}
  67. }
  68. func (m *EchoResponse) XXX_Unmarshal(b []byte) error {
  69. return xxx_messageInfo_EchoResponse.Unmarshal(m, b)
  70. }
  71. func (m *EchoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  72. return xxx_messageInfo_EchoResponse.Marshal(b, m, deterministic)
  73. }
  74. func (dst *EchoResponse) XXX_Merge(src proto.Message) {
  75. xxx_messageInfo_EchoResponse.Merge(dst, src)
  76. }
  77. func (m *EchoResponse) XXX_Size() int {
  78. return xxx_messageInfo_EchoResponse.Size(m)
  79. }
  80. func (m *EchoResponse) XXX_DiscardUnknown() {
  81. xxx_messageInfo_EchoResponse.DiscardUnknown(m)
  82. }
  83. var xxx_messageInfo_EchoResponse proto.InternalMessageInfo
  84. func (m *EchoResponse) GetMessage() string {
  85. if m != nil {
  86. return m.Message
  87. }
  88. return ""
  89. }
  90. func init() {
  91. proto.RegisterType((*EchoRequest)(nil), "grpc.examples.echo.EchoRequest")
  92. proto.RegisterType((*EchoResponse)(nil), "grpc.examples.echo.EchoResponse")
  93. }
  94. // Reference imports to suppress errors if they are not otherwise used.
  95. var _ context.Context
  96. var _ grpc.ClientConn
  97. // This is a compile-time assertion to ensure that this generated file
  98. // is compatible with the grpc package it is being compiled against.
  99. const _ = grpc.SupportPackageIsVersion4
  100. // EchoClient is the client API for Echo service.
  101. //
  102. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  103. type EchoClient interface {
  104. // UnaryEcho is unary echo.
  105. UnaryEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
  106. // ServerStreamingEcho is server side streaming.
  107. ServerStreamingEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Echo_ServerStreamingEchoClient, error)
  108. // ClientStreamingEcho is client side streaming.
  109. ClientStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_ClientStreamingEchoClient, error)
  110. // BidirectionalStreamingEcho is bidi streaming.
  111. BidirectionalStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_BidirectionalStreamingEchoClient, error)
  112. }
  113. type echoClient struct {
  114. cc *grpc.ClientConn
  115. }
  116. func NewEchoClient(cc *grpc.ClientConn) EchoClient {
  117. return &echoClient{cc}
  118. }
  119. func (c *echoClient) UnaryEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) {
  120. out := new(EchoResponse)
  121. err := c.cc.Invoke(ctx, "/grpc.examples.echo.Echo/UnaryEcho", in, out, opts...)
  122. if err != nil {
  123. return nil, err
  124. }
  125. return out, nil
  126. }
  127. func (c *echoClient) ServerStreamingEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Echo_ServerStreamingEchoClient, error) {
  128. stream, err := c.cc.NewStream(ctx, &_Echo_serviceDesc.Streams[0], "/grpc.examples.echo.Echo/ServerStreamingEcho", opts...)
  129. if err != nil {
  130. return nil, err
  131. }
  132. x := &echoServerStreamingEchoClient{stream}
  133. if err := x.ClientStream.SendMsg(in); err != nil {
  134. return nil, err
  135. }
  136. if err := x.ClientStream.CloseSend(); err != nil {
  137. return nil, err
  138. }
  139. return x, nil
  140. }
  141. type Echo_ServerStreamingEchoClient interface {
  142. Recv() (*EchoResponse, error)
  143. grpc.ClientStream
  144. }
  145. type echoServerStreamingEchoClient struct {
  146. grpc.ClientStream
  147. }
  148. func (x *echoServerStreamingEchoClient) Recv() (*EchoResponse, error) {
  149. m := new(EchoResponse)
  150. if err := x.ClientStream.RecvMsg(m); err != nil {
  151. return nil, err
  152. }
  153. return m, nil
  154. }
  155. func (c *echoClient) ClientStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_ClientStreamingEchoClient, error) {
  156. stream, err := c.cc.NewStream(ctx, &_Echo_serviceDesc.Streams[1], "/grpc.examples.echo.Echo/ClientStreamingEcho", opts...)
  157. if err != nil {
  158. return nil, err
  159. }
  160. x := &echoClientStreamingEchoClient{stream}
  161. return x, nil
  162. }
  163. type Echo_ClientStreamingEchoClient interface {
  164. Send(*EchoRequest) error
  165. CloseAndRecv() (*EchoResponse, error)
  166. grpc.ClientStream
  167. }
  168. type echoClientStreamingEchoClient struct {
  169. grpc.ClientStream
  170. }
  171. func (x *echoClientStreamingEchoClient) Send(m *EchoRequest) error {
  172. return x.ClientStream.SendMsg(m)
  173. }
  174. func (x *echoClientStreamingEchoClient) CloseAndRecv() (*EchoResponse, error) {
  175. if err := x.ClientStream.CloseSend(); err != nil {
  176. return nil, err
  177. }
  178. m := new(EchoResponse)
  179. if err := x.ClientStream.RecvMsg(m); err != nil {
  180. return nil, err
  181. }
  182. return m, nil
  183. }
  184. func (c *echoClient) BidirectionalStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_BidirectionalStreamingEchoClient, error) {
  185. stream, err := c.cc.NewStream(ctx, &_Echo_serviceDesc.Streams[2], "/grpc.examples.echo.Echo/BidirectionalStreamingEcho", opts...)
  186. if err != nil {
  187. return nil, err
  188. }
  189. x := &echoBidirectionalStreamingEchoClient{stream}
  190. return x, nil
  191. }
  192. type Echo_BidirectionalStreamingEchoClient interface {
  193. Send(*EchoRequest) error
  194. Recv() (*EchoResponse, error)
  195. grpc.ClientStream
  196. }
  197. type echoBidirectionalStreamingEchoClient struct {
  198. grpc.ClientStream
  199. }
  200. func (x *echoBidirectionalStreamingEchoClient) Send(m *EchoRequest) error {
  201. return x.ClientStream.SendMsg(m)
  202. }
  203. func (x *echoBidirectionalStreamingEchoClient) Recv() (*EchoResponse, error) {
  204. m := new(EchoResponse)
  205. if err := x.ClientStream.RecvMsg(m); err != nil {
  206. return nil, err
  207. }
  208. return m, nil
  209. }
  210. // EchoServer is the server API for Echo service.
  211. type EchoServer interface {
  212. // UnaryEcho is unary echo.
  213. UnaryEcho(context.Context, *EchoRequest) (*EchoResponse, error)
  214. // ServerStreamingEcho is server side streaming.
  215. ServerStreamingEcho(*EchoRequest, Echo_ServerStreamingEchoServer) error
  216. // ClientStreamingEcho is client side streaming.
  217. ClientStreamingEcho(Echo_ClientStreamingEchoServer) error
  218. // BidirectionalStreamingEcho is bidi streaming.
  219. BidirectionalStreamingEcho(Echo_BidirectionalStreamingEchoServer) error
  220. }
  221. func RegisterEchoServer(s *grpc.Server, srv EchoServer) {
  222. s.RegisterService(&_Echo_serviceDesc, srv)
  223. }
  224. func _Echo_UnaryEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  225. in := new(EchoRequest)
  226. if err := dec(in); err != nil {
  227. return nil, err
  228. }
  229. if interceptor == nil {
  230. return srv.(EchoServer).UnaryEcho(ctx, in)
  231. }
  232. info := &grpc.UnaryServerInfo{
  233. Server: srv,
  234. FullMethod: "/grpc.examples.echo.Echo/UnaryEcho",
  235. }
  236. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  237. return srv.(EchoServer).UnaryEcho(ctx, req.(*EchoRequest))
  238. }
  239. return interceptor(ctx, in, info, handler)
  240. }
  241. func _Echo_ServerStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
  242. m := new(EchoRequest)
  243. if err := stream.RecvMsg(m); err != nil {
  244. return err
  245. }
  246. return srv.(EchoServer).ServerStreamingEcho(m, &echoServerStreamingEchoServer{stream})
  247. }
  248. type Echo_ServerStreamingEchoServer interface {
  249. Send(*EchoResponse) error
  250. grpc.ServerStream
  251. }
  252. type echoServerStreamingEchoServer struct {
  253. grpc.ServerStream
  254. }
  255. func (x *echoServerStreamingEchoServer) Send(m *EchoResponse) error {
  256. return x.ServerStream.SendMsg(m)
  257. }
  258. func _Echo_ClientStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
  259. return srv.(EchoServer).ClientStreamingEcho(&echoClientStreamingEchoServer{stream})
  260. }
  261. type Echo_ClientStreamingEchoServer interface {
  262. SendAndClose(*EchoResponse) error
  263. Recv() (*EchoRequest, error)
  264. grpc.ServerStream
  265. }
  266. type echoClientStreamingEchoServer struct {
  267. grpc.ServerStream
  268. }
  269. func (x *echoClientStreamingEchoServer) SendAndClose(m *EchoResponse) error {
  270. return x.ServerStream.SendMsg(m)
  271. }
  272. func (x *echoClientStreamingEchoServer) Recv() (*EchoRequest, error) {
  273. m := new(EchoRequest)
  274. if err := x.ServerStream.RecvMsg(m); err != nil {
  275. return nil, err
  276. }
  277. return m, nil
  278. }
  279. func _Echo_BidirectionalStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
  280. return srv.(EchoServer).BidirectionalStreamingEcho(&echoBidirectionalStreamingEchoServer{stream})
  281. }
  282. type Echo_BidirectionalStreamingEchoServer interface {
  283. Send(*EchoResponse) error
  284. Recv() (*EchoRequest, error)
  285. grpc.ServerStream
  286. }
  287. type echoBidirectionalStreamingEchoServer struct {
  288. grpc.ServerStream
  289. }
  290. func (x *echoBidirectionalStreamingEchoServer) Send(m *EchoResponse) error {
  291. return x.ServerStream.SendMsg(m)
  292. }
  293. func (x *echoBidirectionalStreamingEchoServer) Recv() (*EchoRequest, error) {
  294. m := new(EchoRequest)
  295. if err := x.ServerStream.RecvMsg(m); err != nil {
  296. return nil, err
  297. }
  298. return m, nil
  299. }
  300. var _Echo_serviceDesc = grpc.ServiceDesc{
  301. ServiceName: "grpc.examples.echo.Echo",
  302. HandlerType: (*EchoServer)(nil),
  303. Methods: []grpc.MethodDesc{
  304. {
  305. MethodName: "UnaryEcho",
  306. Handler: _Echo_UnaryEcho_Handler,
  307. },
  308. },
  309. Streams: []grpc.StreamDesc{
  310. {
  311. StreamName: "ServerStreamingEcho",
  312. Handler: _Echo_ServerStreamingEcho_Handler,
  313. ServerStreams: true,
  314. },
  315. {
  316. StreamName: "ClientStreamingEcho",
  317. Handler: _Echo_ClientStreamingEcho_Handler,
  318. ClientStreams: true,
  319. },
  320. {
  321. StreamName: "BidirectionalStreamingEcho",
  322. Handler: _Echo_BidirectionalStreamingEcho_Handler,
  323. ServerStreams: true,
  324. ClientStreams: true,
  325. },
  326. },
  327. Metadata: "echo.proto",
  328. }
  329. func init() { proto.RegisterFile("echo.proto", fileDescriptor_echo_9d6886b3223721ca) }
  330. var fileDescriptor_echo_9d6886b3223721ca = []byte{
  331. // 234 bytes of a gzipped FileDescriptorProto
  332. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0xb1, 0x4b, 0x03, 0x31,
  333. 0x14, 0x87, 0x3d, 0x11, 0xa5, 0x4f, 0xa7, 0xb8, 0x94, 0x2e, 0x96, 0x5b, 0xbc, 0x29, 0x29, 0x16,
  334. 0xff, 0x81, 0x8a, 0xbb, 0xb4, 0xb8, 0x88, 0x4b, 0x3c, 0x7f, 0xa6, 0x81, 0x5c, 0xde, 0xf9, 0x92,
  335. 0x8a, 0xfe, 0xed, 0x2e, 0x92, 0x2b, 0x05, 0x41, 0xba, 0xd5, 0x2d, 0x8f, 0x7c, 0xef, 0xfb, 0x96,
  336. 0x47, 0x84, 0x76, 0xcd, 0xba, 0x17, 0xce, 0xac, 0x94, 0x93, 0xbe, 0xd5, 0xf8, 0xb4, 0x5d, 0x1f,
  337. 0x90, 0x74, 0xf9, 0xa9, 0xaf, 0xe9, 0xfc, 0xbe, 0x5d, 0xf3, 0x12, 0xef, 0x1b, 0xa4, 0xac, 0xc6,
  338. 0x74, 0xd6, 0x21, 0x25, 0xeb, 0x30, 0xae, 0xa6, 0x55, 0x33, 0x5a, 0xee, 0xc6, 0xba, 0xa1, 0x8b,
  339. 0x2d, 0x98, 0x7a, 0x8e, 0x09, 0xfb, 0xc9, 0x9b, 0xef, 0x63, 0x3a, 0x29, 0xa8, 0x7a, 0xa0, 0xd1,
  340. 0x63, 0xb4, 0xf2, 0x35, 0x0c, 0x57, 0xfa, 0x6f, 0x5d, 0xff, 0x4a, 0x4f, 0xa6, 0xfb, 0x81, 0x6d,
  341. 0xb2, 0x3e, 0x52, 0xcf, 0x74, 0xb9, 0x82, 0x7c, 0x40, 0x56, 0x59, 0x60, 0x3b, 0x1f, 0xdd, 0xc1,
  342. 0xdc, 0xb3, 0xaa, 0xd8, 0xef, 0x82, 0x47, 0xcc, 0x87, 0xb7, 0x37, 0x95, 0x02, 0x4d, 0x16, 0xfe,
  343. 0xd5, 0x0b, 0xda, 0xec, 0x39, 0xda, 0xf0, 0x1f, 0x91, 0x59, 0xb5, 0xb8, 0x7d, 0x9a, 0x3b, 0x66,
  344. 0x17, 0xa0, 0x1d, 0x07, 0x1b, 0x9d, 0x66, 0x71, 0xa6, 0xac, 0x9a, 0xdd, 0xaa, 0x79, 0x83, 0xcd,
  345. 0x1b, 0x41, 0x32, 0xc3, 0x59, 0x98, 0x62, 0x7a, 0x39, 0x1d, 0xde, 0xf3, 0x9f, 0x00, 0x00, 0x00,
  346. 0xff, 0xff, 0x23, 0x14, 0x26, 0x96, 0x30, 0x02, 0x00, 0x00,
  347. }