Merge pull request #32 from iamqizhao/master
prepare for google3 porting
This commit is contained in:
@ -44,7 +44,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
testpb "google.golang.org/grpc/interop/testdata"
|
testpb "google.golang.org/grpc/interop/grpc_testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -46,7 +46,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
testpb "google.golang.org/grpc/interop/testdata"
|
testpb "google.golang.org/grpc/interop/grpc_testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -52,7 +52,7 @@ import (
|
|||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
testpb "google.golang.org/grpc/test/testdata"
|
testpb "google.golang.org/grpc/test/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -32,14 +32,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Code generated by protoc-gen-go.
|
// Code generated by protoc-gen-go.
|
||||||
// source: test.proto
|
// source: src/google.golang.org/grpc/test/proto/test.proto
|
||||||
// DO NOT EDIT!
|
// DO NOT EDIT!
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package test is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package.
|
||||||
|
|
||||||
It is generated from these files:
|
It is generated from these files:
|
||||||
test.proto
|
src/google.golang.org/grpc/test/proto/test.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
DivArgs
|
DivArgs
|
||||||
@ -48,13 +48,13 @@ It has these top-level messages:
|
|||||||
Num
|
Num
|
||||||
FibReply
|
FibReply
|
||||||
*/
|
*/
|
||||||
package test
|
package proto
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
import proto1 "github.com/golang/protobuf/proto"
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ = proto.Marshal
|
var _ = proto1.Marshal
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
|
|
||||||
type DivArgs struct {
|
type DivArgs struct {
|
||||||
@ -64,7 +64,7 @@ type DivArgs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *DivArgs) Reset() { *m = DivArgs{} }
|
func (m *DivArgs) Reset() { *m = DivArgs{} }
|
||||||
func (m *DivArgs) String() string { return proto.CompactTextString(m) }
|
func (m *DivArgs) String() string { return proto1.CompactTextString(m) }
|
||||||
func (*DivArgs) ProtoMessage() {}
|
func (*DivArgs) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *DivArgs) GetDividend() int64 {
|
func (m *DivArgs) GetDividend() int64 {
|
||||||
@ -88,7 +88,7 @@ type DivReply struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *DivReply) Reset() { *m = DivReply{} }
|
func (m *DivReply) Reset() { *m = DivReply{} }
|
||||||
func (m *DivReply) String() string { return proto.CompactTextString(m) }
|
func (m *DivReply) String() string { return proto1.CompactTextString(m) }
|
||||||
func (*DivReply) ProtoMessage() {}
|
func (*DivReply) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *DivReply) GetQuotient() int64 {
|
func (m *DivReply) GetQuotient() int64 {
|
||||||
@ -111,7 +111,7 @@ type FibArgs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *FibArgs) Reset() { *m = FibArgs{} }
|
func (m *FibArgs) Reset() { *m = FibArgs{} }
|
||||||
func (m *FibArgs) String() string { return proto.CompactTextString(m) }
|
func (m *FibArgs) String() string { return proto1.CompactTextString(m) }
|
||||||
func (*FibArgs) ProtoMessage() {}
|
func (*FibArgs) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *FibArgs) GetLimit() int64 {
|
func (m *FibArgs) GetLimit() int64 {
|
||||||
@ -127,7 +127,7 @@ type Num struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Num) Reset() { *m = Num{} }
|
func (m *Num) Reset() { *m = Num{} }
|
||||||
func (m *Num) String() string { return proto.CompactTextString(m) }
|
func (m *Num) String() string { return proto1.CompactTextString(m) }
|
||||||
func (*Num) ProtoMessage() {}
|
func (*Num) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *Num) GetNum() int64 {
|
func (m *Num) GetNum() int64 {
|
||||||
@ -143,7 +143,7 @@ type FibReply struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *FibReply) Reset() { *m = FibReply{} }
|
func (m *FibReply) Reset() { *m = FibReply{} }
|
||||||
func (m *FibReply) String() string { return proto.CompactTextString(m) }
|
func (m *FibReply) String() string { return proto1.CompactTextString(m) }
|
||||||
func (*FibReply) ProtoMessage() {}
|
func (*FibReply) ProtoMessage() {}
|
||||||
|
|
||||||
func (m *FibReply) GetCount() int64 {
|
func (m *FibReply) GetCount() int64 {
|
@ -1,8 +1,6 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package test;
|
package proto;
|
||||||
|
|
||||||
option go_package = "test";
|
|
||||||
|
|
||||||
message DivArgs {
|
message DivArgs {
|
||||||
required int64 dividend = 1;
|
required int64 dividend = 1;
|
@ -31,16 +31,17 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package test
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
context "golang.org/x/net/context"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"io"
|
"io"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
context "golang.org/x/net/context"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type MathClient interface {
|
type MathClient interface {
|
||||||
Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error)
|
Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error)
|
||||||
DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error)
|
DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error)
|
||||||
@ -58,7 +59,7 @@ func NewMathClient(cc *grpc.ClientConn) MathClient {
|
|||||||
|
|
||||||
func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error) {
|
func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error) {
|
||||||
out := new(DivReply)
|
out := new(DivReply)
|
||||||
err := grpc.Invoke(ctx, "/test.Math/Div", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/proto.Math/Div", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOpti
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error) {
|
func (c *mathClient) DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error) {
|
||||||
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/DivMany", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/proto.Math/DivMany", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -96,7 +97,7 @@ func (x *mathDivManyClient) Recv() (*DivReply, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) Fib(ctx context.Context, m *FibArgs, opts ...grpc.CallOption) (Math_FibClient, error) {
|
func (c *mathClient) Fib(ctx context.Context, m *FibArgs, opts ...grpc.CallOption) (Math_FibClient, error) {
|
||||||
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/Fib", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/proto.Math/Fib", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -128,7 +129,7 @@ func (x *mathFibClient) Recv() (*Num, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *mathClient) Sum(ctx context.Context, opts ...grpc.CallOption) (Math_SumClient, error) {
|
func (c *mathClient) Sum(ctx context.Context, opts ...grpc.CallOption) (Math_SumClient, error) {
|
||||||
stream, err := grpc.NewClientStream(ctx, c.cc, "/test.Math/Sum", opts...)
|
stream, err := grpc.NewClientStream(ctx, c.cc, "/proto.Math/Sum", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -165,6 +166,7 @@ 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
|
||||||
@ -265,26 +267,28 @@ func (x *mathSumServer) Recv() (*Num, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _Math_serviceDesc = grpc.ServiceDesc{
|
var _Math_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "test.Math",
|
ServiceName: "proto.Math",
|
||||||
HandlerType: (*MathServer)(nil),
|
HandlerType: (*MathServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
MethodName: "Div",
|
MethodName: "Div",
|
||||||
Handler: _Math_Div_Handler,
|
Handler: _Math_Div_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{
|
Streams: []grpc.StreamDesc{
|
||||||
{
|
{
|
||||||
StreamName: "DivMany",
|
StreamName: "DivMany",
|
||||||
Handler: _Math_DivMany_Handler,
|
Handler: _Math_DivMany_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
StreamName: "Fib",
|
StreamName: "Fib",
|
||||||
Handler: _Math_Fib_Handler,
|
Handler: _Math_Fib_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
StreamName: "Sum",
|
StreamName: "Sum",
|
||||||
Handler: _Math_Sum_Handler,
|
Handler: _Math_Sum_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user