Rename top level package from "rpc" to "grpc".
Also move the nascent package doc to doc.go.
This commit is contained in:
@ -31,10 +31,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
package grpc
|
||||||
Package rpc implements various components to perform RPC on top of transport package.
|
|
||||||
*/
|
|
||||||
package rpc
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
4
doc.go
Normal file
4
doc.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/*
|
||||||
|
Package grpc implements various components to perform RPC on top of transport package.
|
||||||
|
*/
|
||||||
|
package grpc
|
90
interop/testdata/test_proto_grpc.pb.go
vendored
90
interop/testdata/test_proto_grpc.pb.go
vendored
@ -35,49 +35,49 @@ package grpc_testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/grpc/grpc-go/rpc"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestServiceClient interface {
|
type TestServiceClient interface {
|
||||||
EmptyCall(ctx context.Context, in *Empty, opts ...rpc.CallOption) (*Empty, error)
|
EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||||
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...rpc.CallOption) (*SimpleResponse, error)
|
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
||||||
StreamingOutputCall(ctx context.Context, m *StreamingOutputCallRequest, opts ...rpc.CallOption) (TestService_StreamingOutputCallClient, error)
|
StreamingOutputCall(ctx context.Context, m *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error)
|
||||||
StreamingInputCall(ctx context.Context, opts ...rpc.CallOption) (TestService_StreamingInputCallClient, error)
|
StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error)
|
||||||
FullDuplexCall(ctx context.Context, opts ...rpc.CallOption) (TestService_FullDuplexCallClient, error)
|
FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error)
|
||||||
HalfDuplexCall(ctx context.Context, opts ...rpc.CallOption) (TestService_HalfDuplexCallClient, error)
|
HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceClient struct {
|
type testServiceClient struct {
|
||||||
cc *rpc.ClientConn
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTestServiceClient(cc *rpc.ClientConn) TestServiceClient {
|
func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient {
|
||||||
return &testServiceClient{cc}
|
return &testServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...rpc.CallOption) (*Empty, error) {
|
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||||
out := new(Empty)
|
out := new(Empty)
|
||||||
err := rpc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...rpc.CallOption) (*SimpleResponse, error) {
|
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||||
out := new(SimpleResponse)
|
out := new(SimpleResponse)
|
||||||
err := rpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, m *StreamingOutputCallRequest, opts ...rpc.CallOption) (TestService_StreamingOutputCallClient, error) {
|
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, m *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/StreamingOutputCall", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/StreamingOutputCall", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -93,11 +93,11 @@ func (c *testServiceClient) StreamingOutputCall(ctx context.Context, m *Streamin
|
|||||||
|
|
||||||
type TestService_StreamingOutputCallClient interface {
|
type TestService_StreamingOutputCallClient interface {
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceStreamingOutputCallClient struct {
|
type testServiceStreamingOutputCallClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
||||||
@ -108,8 +108,8 @@ func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallRespo
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...rpc.CallOption) (TestService_StreamingInputCallClient, error) {
|
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/StreamingInputCall", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/StreamingInputCall", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -119,11 +119,11 @@ func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...rpc.
|
|||||||
type TestService_StreamingInputCallClient interface {
|
type TestService_StreamingInputCallClient interface {
|
||||||
Send(*StreamingInputCallRequest) error
|
Send(*StreamingInputCallRequest) error
|
||||||
CloseAndRecv() (*StreamingInputCallResponse, error)
|
CloseAndRecv() (*StreamingInputCallResponse, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceStreamingInputCallClient struct {
|
type testServiceStreamingInputCallClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error {
|
func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error {
|
||||||
@ -146,8 +146,8 @@ func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCal
|
|||||||
return m, fmt.Errorf("Violate gRPC client streaming protocol: no EOF after the response.")
|
return m, fmt.Errorf("Violate gRPC client streaming protocol: no EOF after the response.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...rpc.CallOption) (TestService_FullDuplexCallClient, error) {
|
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -157,11 +157,11 @@ func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...rpc.Call
|
|||||||
type TestService_FullDuplexCallClient interface {
|
type TestService_FullDuplexCallClient interface {
|
||||||
Send(*StreamingOutputCallRequest) error
|
Send(*StreamingOutputCallRequest) error
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceFullDuplexCallClient struct {
|
type testServiceFullDuplexCallClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
||||||
@ -176,8 +176,8 @@ func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse,
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...rpc.CallOption) (TestService_HalfDuplexCallClient, error) {
|
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/HalfDuplexCall", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/grpc.testing.TestService/HalfDuplexCall", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -187,11 +187,11 @@ func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...rpc.Call
|
|||||||
type TestService_HalfDuplexCallClient interface {
|
type TestService_HalfDuplexCallClient interface {
|
||||||
Send(*StreamingOutputCallRequest) error
|
Send(*StreamingOutputCallRequest) error
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceHalfDuplexCallClient struct {
|
type testServiceHalfDuplexCallClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
||||||
@ -215,7 +215,7 @@ type TestServiceServer interface {
|
|||||||
HalfDuplexCall(TestService_HalfDuplexCallServer) error
|
HalfDuplexCall(TestService_HalfDuplexCallServer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterService(s *rpc.Server, srv TestServiceServer) {
|
func RegisterService(s *grpc.Server, srv TestServiceServer) {
|
||||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
s.RegisterService(&_TestService_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_StreamingOutputCall_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
m := new(StreamingOutputCallRequest)
|
m := new(StreamingOutputCallRequest)
|
||||||
if err := stream.RecvProto(m); err != nil {
|
if err := stream.RecvProto(m); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -253,29 +253,29 @@ func _TestService_StreamingOutputCall_Handler(srv interface{}, stream rpc.Server
|
|||||||
|
|
||||||
type TestService_StreamingOutputCallServer interface {
|
type TestService_StreamingOutputCallServer interface {
|
||||||
Send(*StreamingOutputCallResponse) error
|
Send(*StreamingOutputCallResponse) error
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceStreamingOutputCallServer struct {
|
type testServiceStreamingOutputCallServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error {
|
func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
return x.ServerStream.SendProto(m)
|
return x.ServerStream.SendProto(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_StreamingInputCall_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream})
|
return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestService_StreamingInputCallServer interface {
|
type TestService_StreamingInputCallServer interface {
|
||||||
SendAndClose(*StreamingInputCallResponse) error
|
SendAndClose(*StreamingInputCallResponse) error
|
||||||
Recv() (*StreamingInputCallRequest, error)
|
Recv() (*StreamingInputCallRequest, error)
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceStreamingInputCallServer struct {
|
type testServiceStreamingInputCallServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error {
|
func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error {
|
||||||
@ -293,18 +293,18 @@ func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_FullDuplexCall_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
|
return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestService_FullDuplexCallServer interface {
|
type TestService_FullDuplexCallServer interface {
|
||||||
Send(*StreamingOutputCallResponse) error
|
Send(*StreamingOutputCallResponse) error
|
||||||
Recv() (*StreamingOutputCallRequest, error)
|
Recv() (*StreamingOutputCallRequest, error)
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceFullDuplexCallServer struct {
|
type testServiceFullDuplexCallServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
@ -319,18 +319,18 @@ func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, e
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_HalfDuplexCall_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream})
|
return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestService_HalfDuplexCallServer interface {
|
type TestService_HalfDuplexCallServer interface {
|
||||||
Send(*StreamingOutputCallResponse) error
|
Send(*StreamingOutputCallResponse) error
|
||||||
Recv() (*StreamingOutputCallRequest, error)
|
Recv() (*StreamingOutputCallRequest, error)
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type testServiceHalfDuplexCallServer struct {
|
type testServiceHalfDuplexCallServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
@ -345,10 +345,10 @@ func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, e
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _TestService_serviceDesc = rpc.ServiceDesc{
|
var _TestService_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "grpc.testing.TestService",
|
ServiceName: "grpc.testing.TestService",
|
||||||
HandlerType: (*TestServiceServer)(nil),
|
HandlerType: (*TestServiceServer)(nil),
|
||||||
Methods: []rpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
MethodName: "EmptyCall",
|
MethodName: "EmptyCall",
|
||||||
Handler: _TestService_EmptyCall_Handler,
|
Handler: _TestService_EmptyCall_Handler,
|
||||||
@ -358,7 +358,7 @@ var _TestService_serviceDesc = rpc.ServiceDesc{
|
|||||||
Handler: _TestService_UnaryCall_Handler,
|
Handler: _TestService_UnaryCall_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []rpc.StreamDesc{
|
Streams: []grpc.StreamDesc{
|
||||||
{
|
{
|
||||||
StreamName: "StreamingOutputCall",
|
StreamName: "StreamingOutputCall",
|
||||||
Handler: _TestService_StreamingOutputCall_Handler,
|
Handler: _TestService_StreamingOutputCall_Handler,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package rpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package rpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package rpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package rpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
75
test/testdata/test_grpc.pb.go
vendored
75
test/testdata/test_grpc.pb.go
vendored
@ -35,38 +35,38 @@ package test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"github.com/grpc/grpc-go/rpc"
|
|
||||||
context "golang.org/x/net/context"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
context "golang.org/x/net/context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MathClient interface {
|
type MathClient interface {
|
||||||
Div(ctx context.Context, in *DivArgs, opts ...rpc.CallOption) (*DivReply, error)
|
Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error)
|
||||||
DivMany(ctx context.Context, opts ...rpc.CallOption) (Math_DivManyClient, error)
|
DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error)
|
||||||
Fib(ctx context.Context, m *FibArgs, opts ...rpc.CallOption) (Math_FibClient, error)
|
Fib(ctx context.Context, m *FibArgs, opts ...grpc.CallOption) (Math_FibClient, error)
|
||||||
Sum(ctx context.Context, opts ...rpc.CallOption) (Math_SumClient, error)
|
Sum(ctx context.Context, opts ...grpc.CallOption) (Math_SumClient, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathClient struct {
|
type mathClient struct {
|
||||||
cc *rpc.ClientConn
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMathClient(cc *rpc.ClientConn) MathClient {
|
func NewMathClient(cc *grpc.ClientConn) MathClient {
|
||||||
return &mathClient{cc}
|
return &mathClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...rpc.CallOption) (*DivReply, error) {
|
func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error) {
|
||||||
out := new(DivReply)
|
out := new(DivReply)
|
||||||
err := rpc.Invoke(ctx, "/test.Math/Div", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/test.Math/Div", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) DivMany(ctx context.Context, opts ...rpc.CallOption) (Math_DivManyClient, error) {
|
func (c *mathClient) DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/test.Math/DivMany", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/DivMany", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -76,11 +76,11 @@ func (c *mathClient) DivMany(ctx context.Context, opts ...rpc.CallOption) (Math_
|
|||||||
type Math_DivManyClient interface {
|
type Math_DivManyClient interface {
|
||||||
Send(*DivArgs) error
|
Send(*DivArgs) error
|
||||||
Recv() (*DivReply, error)
|
Recv() (*DivReply, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathDivManyClient struct {
|
type mathDivManyClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathDivManyClient) Send(m *DivArgs) error {
|
func (x *mathDivManyClient) Send(m *DivArgs) error {
|
||||||
@ -95,8 +95,8 @@ func (x *mathDivManyClient) Recv() (*DivReply, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) Fib(ctx context.Context, m *FibArgs, opts ...rpc.CallOption) (Math_FibClient, error) {
|
func (c *mathClient) Fib(ctx context.Context, m *FibArgs, opts ...grpc.CallOption) (Math_FibClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/test.Math/Fib", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/Fib", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -112,11 +112,11 @@ func (c *mathClient) Fib(ctx context.Context, m *FibArgs, opts ...rpc.CallOption
|
|||||||
|
|
||||||
type Math_FibClient interface {
|
type Math_FibClient interface {
|
||||||
Recv() (*Num, error)
|
Recv() (*Num, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathFibClient struct {
|
type mathFibClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathFibClient) Recv() (*Num, error) {
|
func (x *mathFibClient) Recv() (*Num, error) {
|
||||||
@ -127,8 +127,8 @@ func (x *mathFibClient) Recv() (*Num, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) Sum(ctx context.Context, opts ...rpc.CallOption) (Math_SumClient, error) {
|
func (c *mathClient) Sum(ctx context.Context, opts ...grpc.CallOption) (Math_SumClient, error) {
|
||||||
stream, err := rpc.NewClientStream(ctx, c.cc, "/test.Math/Sum", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/Sum", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -138,11 +138,11 @@ func (c *mathClient) Sum(ctx context.Context, opts ...rpc.CallOption) (Math_SumC
|
|||||||
type Math_SumClient interface {
|
type Math_SumClient interface {
|
||||||
Send(*Num) error
|
Send(*Num) error
|
||||||
CloseAndRecv() (*Num, error)
|
CloseAndRecv() (*Num, error)
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathSumClient struct {
|
type mathSumClient struct {
|
||||||
rpc.ClientStream
|
grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathSumClient) Send(m *Num) error {
|
func (x *mathSumClient) Send(m *Num) error {
|
||||||
@ -165,7 +165,6 @@ func (x *mathSumClient) CloseAndRecv() (*Num, error) {
|
|||||||
return m, fmt.Errorf("Violate gRPC client streaming protocol: no EOF after the response.")
|
return m, fmt.Errorf("Violate gRPC client streaming protocol: no EOF after the response.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type MathServer interface {
|
type MathServer interface {
|
||||||
Div(context.Context, *DivArgs) (*DivReply, error)
|
Div(context.Context, *DivArgs) (*DivReply, error)
|
||||||
DivMany(Math_DivManyServer) error
|
DivMany(Math_DivManyServer) error
|
||||||
@ -173,7 +172,7 @@ type MathServer interface {
|
|||||||
Sum(Math_SumServer) error
|
Sum(Math_SumServer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterService(s *rpc.Server, srv MathServer) {
|
func RegisterService(s *grpc.Server, srv MathServer) {
|
||||||
s.RegisterService(&_Math_serviceDesc, srv)
|
s.RegisterService(&_Math_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,18 +188,18 @@ func _Math_Div_Handler(srv interface{}, ctx context.Context, buf []byte) (proto.
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Math_DivMany_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _Math_DivMany_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(MathServer).DivMany(&mathDivManyServer{stream})
|
return srv.(MathServer).DivMany(&mathDivManyServer{stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type Math_DivManyServer interface {
|
type Math_DivManyServer interface {
|
||||||
Send(*DivReply) error
|
Send(*DivReply) error
|
||||||
Recv() (*DivArgs, error)
|
Recv() (*DivArgs, error)
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathDivManyServer struct {
|
type mathDivManyServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathDivManyServer) Send(m *DivReply) error {
|
func (x *mathDivManyServer) Send(m *DivReply) error {
|
||||||
@ -215,7 +214,7 @@ func (x *mathDivManyServer) Recv() (*DivArgs, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Math_Fib_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _Math_Fib_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
m := new(FibArgs)
|
m := new(FibArgs)
|
||||||
if err := stream.RecvProto(m); err != nil {
|
if err := stream.RecvProto(m); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -225,29 +224,29 @@ func _Math_Fib_Handler(srv interface{}, stream rpc.ServerStream) error {
|
|||||||
|
|
||||||
type Math_FibServer interface {
|
type Math_FibServer interface {
|
||||||
Send(*Num) error
|
Send(*Num) error
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathFibServer struct {
|
type mathFibServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathFibServer) Send(m *Num) error {
|
func (x *mathFibServer) Send(m *Num) error {
|
||||||
return x.ServerStream.SendProto(m)
|
return x.ServerStream.SendProto(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Math_Sum_Handler(srv interface{}, stream rpc.ServerStream) error {
|
func _Math_Sum_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
return srv.(MathServer).Sum(&mathSumServer{stream})
|
return srv.(MathServer).Sum(&mathSumServer{stream})
|
||||||
}
|
}
|
||||||
|
|
||||||
type Math_SumServer interface {
|
type Math_SumServer interface {
|
||||||
SendAndClose(*Num) error
|
SendAndClose(*Num) error
|
||||||
Recv() (*Num, error)
|
Recv() (*Num, error)
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
type mathSumServer struct {
|
type mathSumServer struct {
|
||||||
rpc.ServerStream
|
grpc.ServerStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *mathSumServer) SendAndClose(m *Num) error {
|
func (x *mathSumServer) SendAndClose(m *Num) error {
|
||||||
@ -265,16 +264,16 @@ func (x *mathSumServer) Recv() (*Num, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _Math_serviceDesc = rpc.ServiceDesc{
|
var _Math_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "test.Math",
|
ServiceName: "test.Math",
|
||||||
HandlerType: (*MathServer)(nil),
|
HandlerType: (*MathServer)(nil),
|
||||||
Methods: []rpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
MethodName: "Div",
|
MethodName: "Div",
|
||||||
Handler: _Math_Div_Handler,
|
Handler: _Math_Div_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []rpc.StreamDesc{
|
Streams: []grpc.StreamDesc{
|
||||||
{
|
{
|
||||||
StreamName: "DivMany",
|
StreamName: "DivMany",
|
||||||
Handler: _Math_DivMany_Handler,
|
Handler: _Math_DivMany_Handler,
|
||||||
@ -289,5 +288,3 @@ var _Math_serviceDesc = rpc.ServiceDesc{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user