github.com/gogo/protobuf@v1.3.2/protoc-gen-gogo/testdata/grpc/grpc.pb.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: grpc/grpc.proto
     3  
     4  package testing
     5  
     6  import (
     7  	context "context"
     8  	fmt "fmt"
     9  	proto "github.com/gogo/protobuf/proto"
    10  	grpc "google.golang.org/grpc"
    11  	codes "google.golang.org/grpc/codes"
    12  	status "google.golang.org/grpc/status"
    13  	math "math"
    14  )
    15  
    16  // Reference imports to suppress errors if they are not otherwise used.
    17  var _ = proto.Marshal
    18  var _ = fmt.Errorf
    19  var _ = math.Inf
    20  
    21  // This is a compile-time assertion to ensure that this generated file
    22  // is compatible with the proto package it is being compiled against.
    23  // A compilation error at this line likely means your copy of the
    24  // proto package needs to be updated.
    25  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    26  
    27  type SimpleRequest struct {
    28  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    29  	XXX_unrecognized     []byte   `json:"-"`
    30  	XXX_sizecache        int32    `json:"-"`
    31  }
    32  
    33  func (m *SimpleRequest) Reset()         { *m = SimpleRequest{} }
    34  func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
    35  func (*SimpleRequest) ProtoMessage()    {}
    36  func (*SimpleRequest) Descriptor() ([]byte, []int) {
    37  	return fileDescriptor_81ea47a3f88c2082, []int{0}
    38  }
    39  func (m *SimpleRequest) XXX_Unmarshal(b []byte) error {
    40  	return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
    41  }
    42  func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    43  	return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic)
    44  }
    45  func (m *SimpleRequest) XXX_Merge(src proto.Message) {
    46  	xxx_messageInfo_SimpleRequest.Merge(m, src)
    47  }
    48  func (m *SimpleRequest) XXX_Size() int {
    49  	return xxx_messageInfo_SimpleRequest.Size(m)
    50  }
    51  func (m *SimpleRequest) XXX_DiscardUnknown() {
    52  	xxx_messageInfo_SimpleRequest.DiscardUnknown(m)
    53  }
    54  
    55  var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo
    56  
    57  type SimpleResponse struct {
    58  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    59  	XXX_unrecognized     []byte   `json:"-"`
    60  	XXX_sizecache        int32    `json:"-"`
    61  }
    62  
    63  func (m *SimpleResponse) Reset()         { *m = SimpleResponse{} }
    64  func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
    65  func (*SimpleResponse) ProtoMessage()    {}
    66  func (*SimpleResponse) Descriptor() ([]byte, []int) {
    67  	return fileDescriptor_81ea47a3f88c2082, []int{1}
    68  }
    69  func (m *SimpleResponse) XXX_Unmarshal(b []byte) error {
    70  	return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
    71  }
    72  func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    73  	return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic)
    74  }
    75  func (m *SimpleResponse) XXX_Merge(src proto.Message) {
    76  	xxx_messageInfo_SimpleResponse.Merge(m, src)
    77  }
    78  func (m *SimpleResponse) XXX_Size() int {
    79  	return xxx_messageInfo_SimpleResponse.Size(m)
    80  }
    81  func (m *SimpleResponse) XXX_DiscardUnknown() {
    82  	xxx_messageInfo_SimpleResponse.DiscardUnknown(m)
    83  }
    84  
    85  var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo
    86  
    87  type StreamMsg struct {
    88  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    89  	XXX_unrecognized     []byte   `json:"-"`
    90  	XXX_sizecache        int32    `json:"-"`
    91  }
    92  
    93  func (m *StreamMsg) Reset()         { *m = StreamMsg{} }
    94  func (m *StreamMsg) String() string { return proto.CompactTextString(m) }
    95  func (*StreamMsg) ProtoMessage()    {}
    96  func (*StreamMsg) Descriptor() ([]byte, []int) {
    97  	return fileDescriptor_81ea47a3f88c2082, []int{2}
    98  }
    99  func (m *StreamMsg) XXX_Unmarshal(b []byte) error {
   100  	return xxx_messageInfo_StreamMsg.Unmarshal(m, b)
   101  }
   102  func (m *StreamMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   103  	return xxx_messageInfo_StreamMsg.Marshal(b, m, deterministic)
   104  }
   105  func (m *StreamMsg) XXX_Merge(src proto.Message) {
   106  	xxx_messageInfo_StreamMsg.Merge(m, src)
   107  }
   108  func (m *StreamMsg) XXX_Size() int {
   109  	return xxx_messageInfo_StreamMsg.Size(m)
   110  }
   111  func (m *StreamMsg) XXX_DiscardUnknown() {
   112  	xxx_messageInfo_StreamMsg.DiscardUnknown(m)
   113  }
   114  
   115  var xxx_messageInfo_StreamMsg proto.InternalMessageInfo
   116  
   117  type StreamMsg2 struct {
   118  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
   119  	XXX_unrecognized     []byte   `json:"-"`
   120  	XXX_sizecache        int32    `json:"-"`
   121  }
   122  
   123  func (m *StreamMsg2) Reset()         { *m = StreamMsg2{} }
   124  func (m *StreamMsg2) String() string { return proto.CompactTextString(m) }
   125  func (*StreamMsg2) ProtoMessage()    {}
   126  func (*StreamMsg2) Descriptor() ([]byte, []int) {
   127  	return fileDescriptor_81ea47a3f88c2082, []int{3}
   128  }
   129  func (m *StreamMsg2) XXX_Unmarshal(b []byte) error {
   130  	return xxx_messageInfo_StreamMsg2.Unmarshal(m, b)
   131  }
   132  func (m *StreamMsg2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   133  	return xxx_messageInfo_StreamMsg2.Marshal(b, m, deterministic)
   134  }
   135  func (m *StreamMsg2) XXX_Merge(src proto.Message) {
   136  	xxx_messageInfo_StreamMsg2.Merge(m, src)
   137  }
   138  func (m *StreamMsg2) XXX_Size() int {
   139  	return xxx_messageInfo_StreamMsg2.Size(m)
   140  }
   141  func (m *StreamMsg2) XXX_DiscardUnknown() {
   142  	xxx_messageInfo_StreamMsg2.DiscardUnknown(m)
   143  }
   144  
   145  var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo
   146  
   147  func init() {
   148  	proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest")
   149  	proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse")
   150  	proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg")
   151  	proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2")
   152  }
   153  
   154  func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_81ea47a3f88c2082) }
   155  
   156  var fileDescriptor_81ea47a3f88c2082 = []byte{
   157  	// 241 bytes of a gzipped FileDescriptorProto
   158  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48,
   159  	0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71,
   160  	0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a,
   161  	0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38,
   162  	0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87,
   163  	0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6,
   164  	0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85,
   165  	0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97,
   166  	0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce,
   167  	0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e,
   168  	0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74,
   169  	0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf,
   170  	0x4f, 0xcf, 0xd7, 0x07, 0x87, 0x7f, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, 0x9a, 0xa7,
   171  	0x0b, 0x96, 0x00, 0x19, 0x91, 0x92, 0x58, 0x92, 0x08, 0x8e, 0x26, 0x6b, 0xa8, 0x81, 0x49, 0x6c,
   172  	0x60, 0x65, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x54, 0x6e, 0x1b, 0xc2, 0x01, 0x00,
   173  	0x00,
   174  }
   175  
   176  // Reference imports to suppress errors if they are not otherwise used.
   177  var _ context.Context
   178  var _ grpc.ClientConn
   179  
   180  // This is a compile-time assertion to ensure that this generated file
   181  // is compatible with the grpc package it is being compiled against.
   182  const _ = grpc.SupportPackageIsVersion4
   183  
   184  // TestClient is the client API for Test service.
   185  //
   186  // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
   187  type TestClient interface {
   188  	UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
   189  	// This RPC streams from the server only.
   190  	Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error)
   191  	// This RPC streams from the client.
   192  	Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error)
   193  	// This one streams in both directions.
   194  	Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error)
   195  }
   196  
   197  type testClient struct {
   198  	cc *grpc.ClientConn
   199  }
   200  
   201  func NewTestClient(cc *grpc.ClientConn) TestClient {
   202  	return &testClient{cc}
   203  }
   204  
   205  func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
   206  	out := new(SimpleResponse)
   207  	err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...)
   208  	if err != nil {
   209  		return nil, err
   210  	}
   211  	return out, nil
   212  }
   213  
   214  func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) {
   215  	stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...)
   216  	if err != nil {
   217  		return nil, err
   218  	}
   219  	x := &testDownstreamClient{stream}
   220  	if err := x.ClientStream.SendMsg(in); err != nil {
   221  		return nil, err
   222  	}
   223  	if err := x.ClientStream.CloseSend(); err != nil {
   224  		return nil, err
   225  	}
   226  	return x, nil
   227  }
   228  
   229  type Test_DownstreamClient interface {
   230  	Recv() (*StreamMsg, error)
   231  	grpc.ClientStream
   232  }
   233  
   234  type testDownstreamClient struct {
   235  	grpc.ClientStream
   236  }
   237  
   238  func (x *testDownstreamClient) Recv() (*StreamMsg, error) {
   239  	m := new(StreamMsg)
   240  	if err := x.ClientStream.RecvMsg(m); err != nil {
   241  		return nil, err
   242  	}
   243  	return m, nil
   244  }
   245  
   246  func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) {
   247  	stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...)
   248  	if err != nil {
   249  		return nil, err
   250  	}
   251  	x := &testUpstreamClient{stream}
   252  	return x, nil
   253  }
   254  
   255  type Test_UpstreamClient interface {
   256  	Send(*StreamMsg) error
   257  	CloseAndRecv() (*SimpleResponse, error)
   258  	grpc.ClientStream
   259  }
   260  
   261  type testUpstreamClient struct {
   262  	grpc.ClientStream
   263  }
   264  
   265  func (x *testUpstreamClient) Send(m *StreamMsg) error {
   266  	return x.ClientStream.SendMsg(m)
   267  }
   268  
   269  func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) {
   270  	if err := x.ClientStream.CloseSend(); err != nil {
   271  		return nil, err
   272  	}
   273  	m := new(SimpleResponse)
   274  	if err := x.ClientStream.RecvMsg(m); err != nil {
   275  		return nil, err
   276  	}
   277  	return m, nil
   278  }
   279  
   280  func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) {
   281  	stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...)
   282  	if err != nil {
   283  		return nil, err
   284  	}
   285  	x := &testBidiClient{stream}
   286  	return x, nil
   287  }
   288  
   289  type Test_BidiClient interface {
   290  	Send(*StreamMsg) error
   291  	Recv() (*StreamMsg2, error)
   292  	grpc.ClientStream
   293  }
   294  
   295  type testBidiClient struct {
   296  	grpc.ClientStream
   297  }
   298  
   299  func (x *testBidiClient) Send(m *StreamMsg) error {
   300  	return x.ClientStream.SendMsg(m)
   301  }
   302  
   303  func (x *testBidiClient) Recv() (*StreamMsg2, error) {
   304  	m := new(StreamMsg2)
   305  	if err := x.ClientStream.RecvMsg(m); err != nil {
   306  		return nil, err
   307  	}
   308  	return m, nil
   309  }
   310  
   311  // TestServer is the server API for Test service.
   312  type TestServer interface {
   313  	UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
   314  	// This RPC streams from the server only.
   315  	Downstream(*SimpleRequest, Test_DownstreamServer) error
   316  	// This RPC streams from the client.
   317  	Upstream(Test_UpstreamServer) error
   318  	// This one streams in both directions.
   319  	Bidi(Test_BidiServer) error
   320  }
   321  
   322  // UnimplementedTestServer can be embedded to have forward compatible implementations.
   323  type UnimplementedTestServer struct {
   324  }
   325  
   326  func (*UnimplementedTestServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) {
   327  	return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented")
   328  }
   329  func (*UnimplementedTestServer) Downstream(req *SimpleRequest, srv Test_DownstreamServer) error {
   330  	return status.Errorf(codes.Unimplemented, "method Downstream not implemented")
   331  }
   332  func (*UnimplementedTestServer) Upstream(srv Test_UpstreamServer) error {
   333  	return status.Errorf(codes.Unimplemented, "method Upstream not implemented")
   334  }
   335  func (*UnimplementedTestServer) Bidi(srv Test_BidiServer) error {
   336  	return status.Errorf(codes.Unimplemented, "method Bidi not implemented")
   337  }
   338  
   339  func RegisterTestServer(s *grpc.Server, srv TestServer) {
   340  	s.RegisterService(&_Test_serviceDesc, srv)
   341  }
   342  
   343  func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   344  	in := new(SimpleRequest)
   345  	if err := dec(in); err != nil {
   346  		return nil, err
   347  	}
   348  	if interceptor == nil {
   349  		return srv.(TestServer).UnaryCall(ctx, in)
   350  	}
   351  	info := &grpc.UnaryServerInfo{
   352  		Server:     srv,
   353  		FullMethod: "/grpc.testing.Test/UnaryCall",
   354  	}
   355  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   356  		return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest))
   357  	}
   358  	return interceptor(ctx, in, info, handler)
   359  }
   360  
   361  func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error {
   362  	m := new(SimpleRequest)
   363  	if err := stream.RecvMsg(m); err != nil {
   364  		return err
   365  	}
   366  	return srv.(TestServer).Downstream(m, &testDownstreamServer{stream})
   367  }
   368  
   369  type Test_DownstreamServer interface {
   370  	Send(*StreamMsg) error
   371  	grpc.ServerStream
   372  }
   373  
   374  type testDownstreamServer struct {
   375  	grpc.ServerStream
   376  }
   377  
   378  func (x *testDownstreamServer) Send(m *StreamMsg) error {
   379  	return x.ServerStream.SendMsg(m)
   380  }
   381  
   382  func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error {
   383  	return srv.(TestServer).Upstream(&testUpstreamServer{stream})
   384  }
   385  
   386  type Test_UpstreamServer interface {
   387  	SendAndClose(*SimpleResponse) error
   388  	Recv() (*StreamMsg, error)
   389  	grpc.ServerStream
   390  }
   391  
   392  type testUpstreamServer struct {
   393  	grpc.ServerStream
   394  }
   395  
   396  func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error {
   397  	return x.ServerStream.SendMsg(m)
   398  }
   399  
   400  func (x *testUpstreamServer) Recv() (*StreamMsg, error) {
   401  	m := new(StreamMsg)
   402  	if err := x.ServerStream.RecvMsg(m); err != nil {
   403  		return nil, err
   404  	}
   405  	return m, nil
   406  }
   407  
   408  func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error {
   409  	return srv.(TestServer).Bidi(&testBidiServer{stream})
   410  }
   411  
   412  type Test_BidiServer interface {
   413  	Send(*StreamMsg2) error
   414  	Recv() (*StreamMsg, error)
   415  	grpc.ServerStream
   416  }
   417  
   418  type testBidiServer struct {
   419  	grpc.ServerStream
   420  }
   421  
   422  func (x *testBidiServer) Send(m *StreamMsg2) error {
   423  	return x.ServerStream.SendMsg(m)
   424  }
   425  
   426  func (x *testBidiServer) Recv() (*StreamMsg, error) {
   427  	m := new(StreamMsg)
   428  	if err := x.ServerStream.RecvMsg(m); err != nil {
   429  		return nil, err
   430  	}
   431  	return m, nil
   432  }
   433  
   434  var _Test_serviceDesc = grpc.ServiceDesc{
   435  	ServiceName: "grpc.testing.Test",
   436  	HandlerType: (*TestServer)(nil),
   437  	Methods: []grpc.MethodDesc{
   438  		{
   439  			MethodName: "UnaryCall",
   440  			Handler:    _Test_UnaryCall_Handler,
   441  		},
   442  	},
   443  	Streams: []grpc.StreamDesc{
   444  		{
   445  			StreamName:    "Downstream",
   446  			Handler:       _Test_Downstream_Handler,
   447  			ServerStreams: true,
   448  		},
   449  		{
   450  			StreamName:    "Upstream",
   451  			Handler:       _Test_Upstream_Handler,
   452  			ClientStreams: true,
   453  		},
   454  		{
   455  			StreamName:    "Bidi",
   456  			Handler:       _Test_Bidi_Handler,
   457  			ServerStreams: true,
   458  			ClientStreams: true,
   459  		},
   460  	},
   461  	Metadata: "grpc/grpc.proto",
   462  }