From f61c1dbb05c7bea2ae42aaf2151b5901a7ec3141 Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Mon, 9 Feb 2015 16:35:10 -0800 Subject: [PATCH] rename the proto dir, prepare for porting into google3 --- interop/client/client.go | 2 +- .../{testdata => grpc_testing}/messages.proto | 0 interop/{testdata => grpc_testing}/test.proto | 0 .../test_proto.pb.go | 0 .../test_proto_grpc.pb.go | 0 interop/server/server.go | 2 +- test/end2end_test.go | 2 +- test/{testdata => proto}/test.pb.go | 55 +++----------- test/{testdata => proto}/test.proto | 4 +- test/{testdata => proto}/test_grpc.pb.go | 71 ++++++------------- 10 files changed, 37 insertions(+), 99 deletions(-) rename interop/{testdata => grpc_testing}/messages.proto (100%) rename interop/{testdata => grpc_testing}/test.proto (100%) rename interop/{testdata => grpc_testing}/test_proto.pb.go (100%) rename interop/{testdata => grpc_testing}/test_proto_grpc.pb.go (100%) rename test/{testdata => proto}/test.pb.go (53%) rename test/{testdata => proto}/test.proto (96%) rename test/{testdata => proto}/test_grpc.pb.go (70%) diff --git a/interop/client/client.go b/interop/client/client.go index cc0f76fe7..40dfe1907 100644 --- a/interop/client/client.go +++ b/interop/client/client.go @@ -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 ( diff --git a/interop/testdata/messages.proto b/interop/grpc_testing/messages.proto similarity index 100% rename from interop/testdata/messages.proto rename to interop/grpc_testing/messages.proto diff --git a/interop/testdata/test.proto b/interop/grpc_testing/test.proto similarity index 100% rename from interop/testdata/test.proto rename to interop/grpc_testing/test.proto diff --git a/interop/testdata/test_proto.pb.go b/interop/grpc_testing/test_proto.pb.go similarity index 100% rename from interop/testdata/test_proto.pb.go rename to interop/grpc_testing/test_proto.pb.go diff --git a/interop/testdata/test_proto_grpc.pb.go b/interop/grpc_testing/test_proto_grpc.pb.go similarity index 100% rename from interop/testdata/test_proto_grpc.pb.go rename to interop/grpc_testing/test_proto_grpc.pb.go diff --git a/interop/server/server.go b/interop/server/server.go index 8bfd37d98..d34b794a1 100644 --- a/interop/server/server.go +++ b/interop/server/server.go @@ -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 ( diff --git a/test/end2end_test.go b/test/end2end_test.go index 5d8c50012..9c49282a9 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -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 ( diff --git a/test/testdata/test.pb.go b/test/proto/test.pb.go similarity index 53% rename from test/testdata/test.pb.go rename to test/proto/test.pb.go index 46fa1d3f2..6466b5a28 100644 --- a/test/testdata/test.pb.go +++ b/test/proto/test.pb.go @@ -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 { diff --git a/test/testdata/test.proto b/test/proto/test.proto similarity index 96% rename from test/testdata/test.proto rename to test/proto/test.proto index 4e72cf87a..da299e47e 100644 --- a/test/testdata/test.proto +++ b/test/proto/test.proto @@ -1,8 +1,8 @@ syntax = "proto2"; -package test; +package proto; -option go_package = "test"; +//option go_package = "test"; message DivArgs { required int64 dividend = 1; diff --git a/test/testdata/test_grpc.pb.go b/test/proto/test_grpc.pb.go similarity index 70% rename from test/testdata/test_grpc.pb.go rename to test/proto/test_grpc.pb.go index 5192d299c..29e4137aa 100644 --- a/test/testdata/test_grpc.pb.go +++ b/test/proto/test_grpc.pb.go @@ -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, }, }, } + +