test.pb.go 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: test.proto
  3. /*
  4. Package testpb is a generated protocol buffer package.
  5. It is generated from these files:
  6. test.proto
  7. It has these top-level messages:
  8. FooRequest
  9. FooResponse
  10. */
  11. package testpb // import "go.opencensus.io/internal/testpb"
  12. import proto "github.com/golang/protobuf/proto"
  13. import fmt "fmt"
  14. import math "math"
  15. import (
  16. context "golang.org/x/net/context"
  17. grpc "google.golang.org/grpc"
  18. )
  19. // Reference imports to suppress errors if they are not otherwise used.
  20. var _ = proto.Marshal
  21. var _ = fmt.Errorf
  22. var _ = math.Inf
  23. // This is a compile-time assertion to ensure that this generated file
  24. // is compatible with the proto package it is being compiled against.
  25. // A compilation error at this line likely means your copy of the
  26. // proto package needs to be updated.
  27. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  28. type FooRequest struct {
  29. Fail bool `protobuf:"varint,1,opt,name=fail" json:"fail,omitempty"`
  30. SleepNanos int64 `protobuf:"varint,2,opt,name=sleep_nanos,json=sleepNanos" json:"sleep_nanos,omitempty"`
  31. }
  32. func (m *FooRequest) Reset() { *m = FooRequest{} }
  33. func (m *FooRequest) String() string { return proto.CompactTextString(m) }
  34. func (*FooRequest) ProtoMessage() {}
  35. func (*FooRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
  36. func (m *FooRequest) GetFail() bool {
  37. if m != nil {
  38. return m.Fail
  39. }
  40. return false
  41. }
  42. func (m *FooRequest) GetSleepNanos() int64 {
  43. if m != nil {
  44. return m.SleepNanos
  45. }
  46. return 0
  47. }
  48. type FooResponse struct {
  49. }
  50. func (m *FooResponse) Reset() { *m = FooResponse{} }
  51. func (m *FooResponse) String() string { return proto.CompactTextString(m) }
  52. func (*FooResponse) ProtoMessage() {}
  53. func (*FooResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
  54. func init() {
  55. proto.RegisterType((*FooRequest)(nil), "testpb.FooRequest")
  56. proto.RegisterType((*FooResponse)(nil), "testpb.FooResponse")
  57. }
  58. // Reference imports to suppress errors if they are not otherwise used.
  59. var _ context.Context
  60. var _ grpc.ClientConn
  61. // This is a compile-time assertion to ensure that this generated file
  62. // is compatible with the grpc package it is being compiled against.
  63. const _ = grpc.SupportPackageIsVersion4
  64. // Client API for Foo service
  65. type FooClient interface {
  66. Single(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooResponse, error)
  67. Multiple(ctx context.Context, opts ...grpc.CallOption) (Foo_MultipleClient, error)
  68. }
  69. type fooClient struct {
  70. cc *grpc.ClientConn
  71. }
  72. func NewFooClient(cc *grpc.ClientConn) FooClient {
  73. return &fooClient{cc}
  74. }
  75. func (c *fooClient) Single(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooResponse, error) {
  76. out := new(FooResponse)
  77. err := grpc.Invoke(ctx, "/testpb.Foo/Single", in, out, c.cc, opts...)
  78. if err != nil {
  79. return nil, err
  80. }
  81. return out, nil
  82. }
  83. func (c *fooClient) Multiple(ctx context.Context, opts ...grpc.CallOption) (Foo_MultipleClient, error) {
  84. stream, err := grpc.NewClientStream(ctx, &_Foo_serviceDesc.Streams[0], c.cc, "/testpb.Foo/Multiple", opts...)
  85. if err != nil {
  86. return nil, err
  87. }
  88. x := &fooMultipleClient{stream}
  89. return x, nil
  90. }
  91. type Foo_MultipleClient interface {
  92. Send(*FooRequest) error
  93. Recv() (*FooResponse, error)
  94. grpc.ClientStream
  95. }
  96. type fooMultipleClient struct {
  97. grpc.ClientStream
  98. }
  99. func (x *fooMultipleClient) Send(m *FooRequest) error {
  100. return x.ClientStream.SendMsg(m)
  101. }
  102. func (x *fooMultipleClient) Recv() (*FooResponse, error) {
  103. m := new(FooResponse)
  104. if err := x.ClientStream.RecvMsg(m); err != nil {
  105. return nil, err
  106. }
  107. return m, nil
  108. }
  109. // Server API for Foo service
  110. type FooServer interface {
  111. Single(context.Context, *FooRequest) (*FooResponse, error)
  112. Multiple(Foo_MultipleServer) error
  113. }
  114. func RegisterFooServer(s *grpc.Server, srv FooServer) {
  115. s.RegisterService(&_Foo_serviceDesc, srv)
  116. }
  117. func _Foo_Single_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  118. in := new(FooRequest)
  119. if err := dec(in); err != nil {
  120. return nil, err
  121. }
  122. if interceptor == nil {
  123. return srv.(FooServer).Single(ctx, in)
  124. }
  125. info := &grpc.UnaryServerInfo{
  126. Server: srv,
  127. FullMethod: "/testpb.Foo/Single",
  128. }
  129. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  130. return srv.(FooServer).Single(ctx, req.(*FooRequest))
  131. }
  132. return interceptor(ctx, in, info, handler)
  133. }
  134. func _Foo_Multiple_Handler(srv interface{}, stream grpc.ServerStream) error {
  135. return srv.(FooServer).Multiple(&fooMultipleServer{stream})
  136. }
  137. type Foo_MultipleServer interface {
  138. Send(*FooResponse) error
  139. Recv() (*FooRequest, error)
  140. grpc.ServerStream
  141. }
  142. type fooMultipleServer struct {
  143. grpc.ServerStream
  144. }
  145. func (x *fooMultipleServer) Send(m *FooResponse) error {
  146. return x.ServerStream.SendMsg(m)
  147. }
  148. func (x *fooMultipleServer) Recv() (*FooRequest, error) {
  149. m := new(FooRequest)
  150. if err := x.ServerStream.RecvMsg(m); err != nil {
  151. return nil, err
  152. }
  153. return m, nil
  154. }
  155. var _Foo_serviceDesc = grpc.ServiceDesc{
  156. ServiceName: "testpb.Foo",
  157. HandlerType: (*FooServer)(nil),
  158. Methods: []grpc.MethodDesc{
  159. {
  160. MethodName: "Single",
  161. Handler: _Foo_Single_Handler,
  162. },
  163. },
  164. Streams: []grpc.StreamDesc{
  165. {
  166. StreamName: "Multiple",
  167. Handler: _Foo_Multiple_Handler,
  168. ServerStreams: true,
  169. ClientStreams: true,
  170. },
  171. },
  172. Metadata: "test.proto",
  173. }
  174. func init() { proto.RegisterFile("test.proto", fileDescriptor0) }
  175. var fileDescriptor0 = []byte{
  176. // 165 bytes of a gzipped FileDescriptorProto
  177. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e,
  178. 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0xb1, 0x0b, 0x92, 0x94, 0x1c, 0xb9, 0xb8,
  179. 0xdc, 0xf2, 0xf3, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x84, 0xb8, 0x58, 0xd2, 0x12,
  180. 0x33, 0x73, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x82, 0xc0, 0x6c, 0x21, 0x79, 0x2e, 0xee, 0xe2,
  181. 0x9c, 0xd4, 0xd4, 0x82, 0xf8, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xe6,
  182. 0x20, 0x2e, 0xb0, 0x90, 0x1f, 0x48, 0x44, 0x89, 0x97, 0x8b, 0x1b, 0x6c, 0x44, 0x71, 0x41, 0x7e,
  183. 0x5e, 0x71, 0xaa, 0x51, 0x21, 0x17, 0xb3, 0x5b, 0x7e, 0xbe, 0x90, 0x21, 0x17, 0x5b, 0x70, 0x66,
  184. 0x5e, 0x7a, 0x4e, 0xaa, 0x90, 0x90, 0x1e, 0xc4, 0x2e, 0x3d, 0x84, 0x45, 0x52, 0xc2, 0x28, 0x62,
  185. 0x10, 0x9d, 0x42, 0xe6, 0x5c, 0x1c, 0xbe, 0xa5, 0x39, 0x25, 0x99, 0x05, 0x24, 0x68, 0xd2, 0x60,
  186. 0x34, 0x60, 0x4c, 0x62, 0x03, 0xfb, 0xc9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x37, 0xb1, 0x2d,
  187. 0x6e, 0xe1, 0x00, 0x00, 0x00,
  188. }
  189. //go:generate ./generate.sh