rename the proto dir, prepare for porting into google3

This commit is contained in:
iamqizhao 2015-02-09 16:35:10 -08:00
parent 00231015a6
commit f61c1dbb05
10 changed files with 37 additions and 99 deletions

View File

@ -44,7 +44,7 @@ import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
testpb "google.golang.org/grpc/interop/testdata"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
var (

View File

@ -46,7 +46,7 @@ import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
testpb "google.golang.org/grpc/interop/testdata"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
var (

View File

@ -52,7 +52,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
testpb "google.golang.org/grpc/test/testdata"
testpb "google.golang.org/grpc/test/proto"
)
var (

View File

@ -1,45 +1,12 @@
/*
*
* Copyright 2014, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// Code generated by protoc-gen-go.
// source: test.proto
// source: src/google.golang.org/grpc/test/proto/test.proto
// 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:
test.proto
src/google.golang.org/grpc/test/proto/test.proto
It has these top-level messages:
DivArgs
@ -48,13 +15,13 @@ It has these top-level messages:
Num
FibReply
*/
package test
package proto
import proto "github.com/golang/protobuf/proto"
import proto1 "github.com/golang/protobuf/proto"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = proto1.Marshal
var _ = math.Inf
type DivArgs struct {
@ -64,7 +31,7 @@ type DivArgs struct {
}
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 (m *DivArgs) GetDividend() int64 {
@ -88,7 +55,7 @@ type DivReply struct {
}
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 (m *DivReply) GetQuotient() int64 {
@ -111,7 +78,7 @@ type FibArgs struct {
}
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 (m *FibArgs) GetLimit() int64 {
@ -127,7 +94,7 @@ type Num struct {
}
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 (m *Num) GetNum() int64 {
@ -143,7 +110,7 @@ type FibReply struct {
}
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 (m *FibReply) GetCount() int64 {

View File

@ -1,8 +1,8 @@
syntax = "proto2";
package test;
package proto;
option go_package = "test";
//option go_package = "test";
message DivArgs {
required int64 dividend = 1;

View File

@ -1,46 +1,14 @@
/*
*
* Copyright 2014, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package test
package proto
import (
"fmt"
proto "github.com/golang/protobuf/proto"
context "golang.org/x/net/context"
"google.golang.org/grpc"
"io"
"google.golang.org/grpc"
context "golang.org/x/net/context"
proto "github.com/golang/protobuf/proto"
)
type MathClient interface {
Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error)
DivMany(ctx context.Context, opts ...grpc.CallOption) (Math_DivManyClient, error)
@ -58,7 +26,7 @@ func NewMathClient(cc *grpc.ClientConn) MathClient {
func (c *mathClient) Div(ctx context.Context, in *DivArgs, opts ...grpc.CallOption) (*DivReply, error) {
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 {
return nil, err
}
@ -66,7 +34,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) {
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 {
return nil, err
}
@ -96,7 +64,7 @@ func (x *mathDivManyClient) Recv() (*DivReply, 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 {
return nil, err
}
@ -128,7 +96,7 @@ func (x *mathFibClient) Recv() (*Num, 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 {
return nil, err
}
@ -165,6 +133,7 @@ func (x *mathSumClient) CloseAndRecv() (*Num, error) {
return m, fmt.Errorf("Violate gRPC client streaming protocol: no EOF after the response.")
}
type MathServer interface {
Div(context.Context, *DivArgs) (*DivReply, error)
DivMany(Math_DivManyServer) error
@ -265,26 +234,28 @@ func (x *mathSumServer) Recv() (*Num, error) {
}
var _Math_serviceDesc = grpc.ServiceDesc{
ServiceName: "test.Math",
ServiceName: "proto.Math",
HandlerType: (*MathServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Div",
Handler: _Math_Div_Handler,
MethodName: "Div",
Handler: _Math_Div_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "DivMany",
Handler: _Math_DivMany_Handler,
StreamName: "DivMany",
Handler: _Math_DivMany_Handler,
},
{
StreamName: "Fib",
Handler: _Math_Fib_Handler,
StreamName: "Fib",
Handler: _Math_Fib_Handler,
},
{
StreamName: "Sum",
Handler: _Math_Sum_Handler,
StreamName: "Sum",
Handler: _Math_Sum_Handler,
},
},
}