您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

163 行
5.6 KiB

  1. // Copyright 2017 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*
  15. Package helloworld is a generated protocol buffer package.
  16. It is generated from these files:
  17. helloworld.proto
  18. It has these top-level messages:
  19. HelloRequest
  20. HelloReply
  21. */
  22. package helloworld
  23. import proto "github.com/golang/protobuf/proto"
  24. import fmt "fmt"
  25. import math "math"
  26. import (
  27. "context"
  28. grpc "google.golang.org/grpc"
  29. )
  30. // Reference imports to suppress errors if they are not otherwise used.
  31. var _ = proto.Marshal
  32. var _ = fmt.Errorf
  33. var _ = math.Inf
  34. // This is a compile-time assertion to ensure that this generated file
  35. // is compatible with the proto package it is being compiled against.
  36. // A compilation error at this line likely means your copy of the
  37. // proto package needs to be updated.
  38. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  39. // The request message containing the user's name.
  40. type HelloRequest struct {
  41. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
  42. }
  43. func (m *HelloRequest) Reset() { *m = HelloRequest{} }
  44. func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
  45. func (*HelloRequest) ProtoMessage() {}
  46. func (*HelloRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
  47. // The response message containing the greetings
  48. type HelloReply struct {
  49. Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
  50. }
  51. func (m *HelloReply) Reset() { *m = HelloReply{} }
  52. func (m *HelloReply) String() string { return proto.CompactTextString(m) }
  53. func (*HelloReply) ProtoMessage() {}
  54. func (*HelloReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
  55. func init() {
  56. proto.RegisterType((*HelloRequest)(nil), "helloworld.HelloRequest")
  57. proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply")
  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 Greeter service
  66. type GreeterClient interface {
  67. // Sends a greeting
  68. SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
  69. }
  70. type greeterClient struct {
  71. cc *grpc.ClientConn
  72. }
  73. func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
  74. return &greeterClient{cc}
  75. }
  76. func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
  77. out := new(HelloReply)
  78. err := grpc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, c.cc, opts...)
  79. if err != nil {
  80. return nil, err
  81. }
  82. return out, nil
  83. }
  84. // Server API for Greeter service
  85. type GreeterServer interface {
  86. // Sends a greeting
  87. SayHello(context.Context, *HelloRequest) (*HelloReply, error)
  88. }
  89. func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
  90. s.RegisterService(&_Greeter_serviceDesc, srv)
  91. }
  92. func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  93. in := new(HelloRequest)
  94. if err := dec(in); err != nil {
  95. return nil, err
  96. }
  97. if interceptor == nil {
  98. return srv.(GreeterServer).SayHello(ctx, in)
  99. }
  100. info := &grpc.UnaryServerInfo{
  101. Server: srv,
  102. FullMethod: "/helloworld.Greeter/SayHello",
  103. }
  104. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  105. return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
  106. }
  107. return interceptor(ctx, in, info, handler)
  108. }
  109. var _Greeter_serviceDesc = grpc.ServiceDesc{
  110. ServiceName: "helloworld.Greeter",
  111. HandlerType: (*GreeterServer)(nil),
  112. Methods: []grpc.MethodDesc{
  113. {
  114. MethodName: "SayHello",
  115. Handler: _Greeter_SayHello_Handler,
  116. },
  117. },
  118. Streams: []grpc.StreamDesc{},
  119. Metadata: "helloworld.proto",
  120. }
  121. func init() { proto.RegisterFile("helloworld.proto", fileDescriptor0) }
  122. var fileDescriptor0 = []byte{
  123. // 174 bytes of a gzipped FileDescriptorProto
  124. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9,
  125. 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88,
  126. 0x28, 0x29, 0x71, 0xf1, 0x78, 0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42,
  127. 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x92,
  128. 0x1a, 0x17, 0x17, 0x54, 0x4d, 0x41, 0x4e, 0xa5, 0x90, 0x04, 0x17, 0x7b, 0x6e, 0x6a, 0x71, 0x71,
  129. 0x62, 0x3a, 0x4c, 0x11, 0x8c, 0x6b, 0xe4, 0xc9, 0xc5, 0xee, 0x5e, 0x94, 0x9a, 0x5a, 0x92, 0x5a,
  130. 0x24, 0x64, 0xc7, 0xc5, 0x11, 0x9c, 0x58, 0x09, 0xd6, 0x25, 0x24, 0xa1, 0x87, 0xe4, 0x02, 0x64,
  131. 0xcb, 0xa4, 0xc4, 0xb0, 0xc8, 0x00, 0xad, 0x50, 0x62, 0x70, 0x32, 0xe0, 0x92, 0xce, 0xcc, 0xd7,
  132. 0x4b, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0x46, 0x52, 0xeb,
  133. 0xc4, 0x0f, 0x56, 0x1c, 0x0e, 0x62, 0x07, 0x80, 0xbc, 0x14, 0xc0, 0x98, 0xc4, 0x06, 0xf6, 0x9b,
  134. 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xb7, 0xcd, 0xf2, 0xef, 0x00, 0x00, 0x00,
  135. }