rpc.pb.go 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go v1.25.0
  4. // protoc v3.9.0
  5. // source: rpc.proto
  6. // option go_package = "google.golang.org/grpc/examples/helloworld/helloworld";
  7. // option java_multiple_files = true;
  8. // option java_package = "io.grpc.examples.helloworld";
  9. // option java_outer_classname = "HelloWorldProto";
  10. package proto
  11. import (
  12. context "context"
  13. proto "github.com/golang/protobuf/proto"
  14. grpc "google.golang.org/grpc"
  15. codes "google.golang.org/grpc/codes"
  16. status "google.golang.org/grpc/status"
  17. protoreflect "google.golang.org/protobuf/reflect/protoreflect"
  18. protoimpl "google.golang.org/protobuf/runtime/protoimpl"
  19. reflect "reflect"
  20. sync "sync"
  21. )
  22. const (
  23. // Verify that this generated code is sufficiently up-to-date.
  24. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
  25. // Verify that runtime/protoimpl is sufficiently up-to-date.
  26. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
  27. )
  28. // This is a compile-time assertion that a sufficiently up-to-date version
  29. // of the legacy proto package is being used.
  30. const _ = proto.ProtoPackageIsVersion4
  31. // The request message containing the user's name.
  32. type HelloRequest struct {
  33. state protoimpl.MessageState
  34. sizeCache protoimpl.SizeCache
  35. unknownFields protoimpl.UnknownFields
  36. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  37. }
  38. func (x *HelloRequest) Reset() {
  39. *x = HelloRequest{}
  40. if protoimpl.UnsafeEnabled {
  41. mi := &file_rpc_proto_msgTypes[0]
  42. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  43. ms.StoreMessageInfo(mi)
  44. }
  45. }
  46. func (x *HelloRequest) String() string {
  47. return protoimpl.X.MessageStringOf(x)
  48. }
  49. func (*HelloRequest) ProtoMessage() {}
  50. func (x *HelloRequest) ProtoReflect() protoreflect.Message {
  51. mi := &file_rpc_proto_msgTypes[0]
  52. if protoimpl.UnsafeEnabled && x != nil {
  53. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  54. if ms.LoadMessageInfo() == nil {
  55. ms.StoreMessageInfo(mi)
  56. }
  57. return ms
  58. }
  59. return mi.MessageOf(x)
  60. }
  61. // Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
  62. func (*HelloRequest) Descriptor() ([]byte, []int) {
  63. return file_rpc_proto_rawDescGZIP(), []int{0}
  64. }
  65. func (x *HelloRequest) GetName() string {
  66. if x != nil {
  67. return x.Name
  68. }
  69. return ""
  70. }
  71. // The response message containing the greetings
  72. type HelloReply struct {
  73. state protoimpl.MessageState
  74. sizeCache protoimpl.SizeCache
  75. unknownFields protoimpl.UnknownFields
  76. Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
  77. }
  78. func (x *HelloReply) Reset() {
  79. *x = HelloReply{}
  80. if protoimpl.UnsafeEnabled {
  81. mi := &file_rpc_proto_msgTypes[1]
  82. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  83. ms.StoreMessageInfo(mi)
  84. }
  85. }
  86. func (x *HelloReply) String() string {
  87. return protoimpl.X.MessageStringOf(x)
  88. }
  89. func (*HelloReply) ProtoMessage() {}
  90. func (x *HelloReply) ProtoReflect() protoreflect.Message {
  91. mi := &file_rpc_proto_msgTypes[1]
  92. if protoimpl.UnsafeEnabled && x != nil {
  93. ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
  94. if ms.LoadMessageInfo() == nil {
  95. ms.StoreMessageInfo(mi)
  96. }
  97. return ms
  98. }
  99. return mi.MessageOf(x)
  100. }
  101. // Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
  102. func (*HelloReply) Descriptor() ([]byte, []int) {
  103. return file_rpc_proto_rawDescGZIP(), []int{1}
  104. }
  105. func (x *HelloReply) GetMessage() string {
  106. if x != nil {
  107. return x.Message
  108. }
  109. return ""
  110. }
  111. var File_rpc_proto protoreflect.FileDescriptor
  112. var file_rpc_proto_rawDesc = []byte{
  113. 0x0a, 0x09, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f,
  114. 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
  115. 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
  116. 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x26, 0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52,
  117. 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
  118. 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x3f,
  119. 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79,
  120. 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65,
  121. 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f,
  122. 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x62,
  123. 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
  124. }
  125. var (
  126. file_rpc_proto_rawDescOnce sync.Once
  127. file_rpc_proto_rawDescData = file_rpc_proto_rawDesc
  128. )
  129. func file_rpc_proto_rawDescGZIP() []byte {
  130. file_rpc_proto_rawDescOnce.Do(func() {
  131. file_rpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_proto_rawDescData)
  132. })
  133. return file_rpc_proto_rawDescData
  134. }
  135. var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
  136. var file_rpc_proto_goTypes = []interface{}{
  137. (*HelloRequest)(nil), // 0: proto.HelloRequest
  138. (*HelloReply)(nil), // 1: proto.HelloReply
  139. }
  140. var file_rpc_proto_depIdxs = []int32{
  141. 0, // 0: proto.Greeter.SayHello:input_type -> proto.HelloRequest
  142. 1, // 1: proto.Greeter.SayHello:output_type -> proto.HelloReply
  143. 1, // [1:2] is the sub-list for method output_type
  144. 0, // [0:1] is the sub-list for method input_type
  145. 0, // [0:0] is the sub-list for extension type_name
  146. 0, // [0:0] is the sub-list for extension extendee
  147. 0, // [0:0] is the sub-list for field type_name
  148. }
  149. func init() { file_rpc_proto_init() }
  150. func file_rpc_proto_init() {
  151. if File_rpc_proto != nil {
  152. return
  153. }
  154. if !protoimpl.UnsafeEnabled {
  155. file_rpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
  156. switch v := v.(*HelloRequest); i {
  157. case 0:
  158. return &v.state
  159. case 1:
  160. return &v.sizeCache
  161. case 2:
  162. return &v.unknownFields
  163. default:
  164. return nil
  165. }
  166. }
  167. file_rpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
  168. switch v := v.(*HelloReply); i {
  169. case 0:
  170. return &v.state
  171. case 1:
  172. return &v.sizeCache
  173. case 2:
  174. return &v.unknownFields
  175. default:
  176. return nil
  177. }
  178. }
  179. }
  180. type x struct{}
  181. out := protoimpl.TypeBuilder{
  182. File: protoimpl.DescBuilder{
  183. GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
  184. RawDescriptor: file_rpc_proto_rawDesc,
  185. NumEnums: 0,
  186. NumMessages: 2,
  187. NumExtensions: 0,
  188. NumServices: 1,
  189. },
  190. GoTypes: file_rpc_proto_goTypes,
  191. DependencyIndexes: file_rpc_proto_depIdxs,
  192. MessageInfos: file_rpc_proto_msgTypes,
  193. }.Build()
  194. File_rpc_proto = out.File
  195. file_rpc_proto_rawDesc = nil
  196. file_rpc_proto_goTypes = nil
  197. file_rpc_proto_depIdxs = nil
  198. }
  199. // Reference imports to suppress errors if they are not otherwise used.
  200. var _ context.Context
  201. var _ grpc.ClientConnInterface
  202. // This is a compile-time assertion to ensure that this generated file
  203. // is compatible with the grpc package it is being compiled against.
  204. const _ = grpc.SupportPackageIsVersion6
  205. // GreeterClient is the client API for Greeter service.
  206. //
  207. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  208. type GreeterClient interface {
  209. // Sends a greeting
  210. SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
  211. }
  212. type greeterClient struct {
  213. cc grpc.ClientConnInterface
  214. }
  215. func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
  216. return &greeterClient{cc}
  217. }
  218. func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
  219. out := new(HelloReply)
  220. err := c.cc.Invoke(ctx, "/proto.Greeter/SayHello", in, out, opts...)
  221. if err != nil {
  222. return nil, err
  223. }
  224. return out, nil
  225. }
  226. // GreeterServer is the server API for Greeter service.
  227. type GreeterServer interface {
  228. // Sends a greeting
  229. SayHello(context.Context, *HelloRequest) (*HelloReply, error)
  230. }
  231. // UnimplementedGreeterServer can be embedded to have forward compatible implementations.
  232. type UnimplementedGreeterServer struct {
  233. }
  234. func (*UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
  235. return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
  236. }
  237. func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
  238. s.RegisterService(&_Greeter_serviceDesc, srv)
  239. }
  240. func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  241. in := new(HelloRequest)
  242. if err := dec(in); err != nil {
  243. return nil, err
  244. }
  245. if interceptor == nil {
  246. return srv.(GreeterServer).SayHello(ctx, in)
  247. }
  248. info := &grpc.UnaryServerInfo{
  249. Server: srv,
  250. FullMethod: "/proto.Greeter/SayHello",
  251. }
  252. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  253. return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
  254. }
  255. return interceptor(ctx, in, info, handler)
  256. }
  257. var _Greeter_serviceDesc = grpc.ServiceDesc{
  258. ServiceName: "proto.Greeter",
  259. HandlerType: (*GreeterServer)(nil),
  260. Methods: []grpc.MethodDesc{
  261. {
  262. MethodName: "SayHello",
  263. Handler: _Greeter_SayHello_Handler,
  264. },
  265. },
  266. Streams: []grpc.StreamDesc{},
  267. Metadata: "rpc.proto",
  268. }