Merge pull request #50 from iamqizhao/master
migrate to the new codegen solution
This commit is contained in:
17
codegen.sh
Executable file
17
codegen.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script serves as an example to demonstrate how to generate the gRPC-Go
|
||||
# interface and the related messages from .proto file.
|
||||
#
|
||||
# It assumes the installation of i) Google proto buffer compiler at
|
||||
# https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen
|
||||
# plugin at https://github.com/golang/protobuf (after 2/19/2015). If you have
|
||||
# not, please install them first.
|
||||
#
|
||||
# We recommend running this script at $GOPATH or $GOPATH/src.
|
||||
#
|
||||
# If this is not what you need, feel free to make your own scripts. Again, this
|
||||
# script is for demonstration purpose.
|
||||
#
|
||||
proto=$1
|
||||
protoc --go_out=plugins=grpc:. $proto
|
@ -1,18 +0,0 @@
|
||||
CC=g++
|
||||
CFLAGS=-c -Wall `pkg-config --cflags protobuf` -std=c++11
|
||||
LDFLAGS=-g
|
||||
LDLIBS=`pkg-config --libs protobuf` -lprotoc
|
||||
SOURCES=go_generator.cc go_plugin.cc
|
||||
OBJECTS=$(SOURCES:.cc=.o)
|
||||
EXECUTABLE=go_plugin
|
||||
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LDLIBS)
|
||||
|
||||
.cc.o:
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(EXECUTABLE)
|
@ -1,3 +0,0 @@
|
||||
The plugin here is a short-term solution and does not support all the use cases.
|
||||
We are working on having a full-fledged solution as part of
|
||||
github.com/golang/protobuf. Once it is online, this code will be deleted.
|
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script serves as an example to demonstrate how to generate the gRPC-Go
|
||||
# interface and the related messages.
|
||||
#
|
||||
# We suggest the importing paths in proto file are relative to $GOPATH/src and
|
||||
# this script should be run at $GOPATH/src.
|
||||
#
|
||||
# If this is not what you need, feel free to make your own scripts. Again, this
|
||||
# script is for demonstration purpose.
|
||||
#
|
||||
locProtocGenGo=$1
|
||||
locGoPlugIn=$2
|
||||
proto=$3
|
||||
protoc --plugin=protoc-gen-go=$locProtocGenGo --go_out=. $proto
|
||||
protoc --plugin=protoc-gen-gogrpc=$locGoPlugIn --gogrpc_out=. $proto
|
@ -1,654 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "./go_generator.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include <google/protobuf/io/printer.h>
|
||||
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
|
||||
#include <google/protobuf/descriptor.pb.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace grpc_go_generator {
|
||||
|
||||
bool NoStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return !method->client_streaming() && !method->server_streaming();
|
||||
}
|
||||
|
||||
bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return method->client_streaming() && !method->server_streaming();
|
||||
}
|
||||
|
||||
bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return !method->client_streaming() && method->server_streaming();
|
||||
}
|
||||
|
||||
bool BidiStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return method->client_streaming() && method->server_streaming();
|
||||
}
|
||||
|
||||
bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
|
||||
for (int i = 0; i < file->service_count(); i++) {
|
||||
for (int j = 0; j < file->service(i)->method_count(); j++) {
|
||||
if (ClientOnlyStreaming(file->service(i)->method(j))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
string LowerCaseService(const string& service) {
|
||||
string ret = service;
|
||||
if (!ret.empty() && ret[0] >= 'A' && ret[0] <= 'Z') {
|
||||
ret[0] = ret[0] - 'A' + 'a';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string BadToUnderscore(std::string str) {
|
||||
for (unsigned i = 0; i < str.size(); ++i) {
|
||||
if (!std::isalnum(str[i])) {
|
||||
str[i] = '_';
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
string GenerateFullGoPackage(const google::protobuf::FileDescriptor* file) {
|
||||
// In opensouce environment, assume each directory has at most one package.
|
||||
size_t pos = file->name().find_last_of('/');
|
||||
if (pos != string::npos) {
|
||||
return file->name().substr(0, pos);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const string GetFullMessageQualifiedName(
|
||||
const google::protobuf::Descriptor* desc,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
string pkg = GenerateFullGoPackage(desc->file());
|
||||
if (imports.find(pkg) == imports.end()) {
|
||||
// The message is in the same package as the services definition.
|
||||
return desc->name();
|
||||
}
|
||||
if (import_alias.find(pkg) != import_alias.end()) {
|
||||
// The message is in a package whose name is as same as the one consisting
|
||||
// of the service definition. Use the alias to differentiate.
|
||||
return import_alias.find(pkg)->second + "." + desc->name();
|
||||
}
|
||||
string prefix = !desc->file()->options().go_package().empty()
|
||||
? desc->file()->options().go_package() : desc->file()->package();
|
||||
return BadToUnderscore(prefix) + "." + desc->name();
|
||||
}
|
||||
|
||||
void PrintClientMethodDef(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
GetFullMessageQualifiedName(method->input_type(), imports, import_alias);
|
||||
(*vars)["Response"] =
|
||||
GetFullMessageQualifiedName(method->output_type(), imports, import_alias);
|
||||
if (NoStreaming(method)) {
|
||||
printer->Print(*vars,
|
||||
"\t$Method$(ctx context.Context, in *$Request$, opts "
|
||||
"...grpc.CallOption) "
|
||||
"(*$Response$, error)\n");
|
||||
} else if (BidiStreaming(method)) {
|
||||
printer->Print(*vars,
|
||||
"\t$Method$(ctx context.Context, opts ...grpc.CallOption) "
|
||||
"($Service$_$Method$Client, error)\n");
|
||||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"\t$Method$(ctx context.Context, m *$Request$, opts ...grpc.CallOption) "
|
||||
"($Service$_$Method$Client, error)\n");
|
||||
} else if (ClientOnlyStreaming(method)) {
|
||||
printer->Print(*vars,
|
||||
"\t$Method$(ctx context.Context, opts ...grpc.CallOption) "
|
||||
"($Service$_$Method$Client, error)\n");
|
||||
}
|
||||
}
|
||||
|
||||
void PrintClientMethodImpl(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias,
|
||||
int* stream_ind) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
GetFullMessageQualifiedName(method->input_type(), imports, import_alias);
|
||||
(*vars)["Response"] =
|
||||
GetFullMessageQualifiedName(method->output_type(), imports, import_alias);
|
||||
if (NoStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (c *$ServiceStruct$Client) $Method$(ctx context.Context, "
|
||||
"in *$Request$, opts ...grpc.CallOption) (*$Response$, error) {\n");
|
||||
printer->Print(*vars, "\tout := new($Response$)\n");
|
||||
printer->Print(*vars,
|
||||
"\terr := grpc.Invoke(ctx, \"/$Package$$Service$/$Method$\", "
|
||||
"in, out, c.cc, opts...)\n");
|
||||
printer->Print("\tif err != nil {\n");
|
||||
printer->Print("\t\treturn nil, err\n");
|
||||
printer->Print("\t}\n");
|
||||
printer->Print("\treturn out, nil\n");
|
||||
printer->Print("}\n\n");
|
||||
return;
|
||||
}
|
||||
(*vars)["StreamInd"] = std::to_string(*stream_ind);
|
||||
if (BidiStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (c *$ServiceStruct$Client) $Method$(ctx context.Context, opts "
|
||||
"...grpc.CallOption) ($Service$_$Method$Client, error) {\n"
|
||||
"\tstream, err := grpc.NewClientStream(ctx, &_$Service$_serviceDesc.Streams[$StreamInd$], c.cc, "
|
||||
"\"/$Package$$Service$/$Method$\", opts...)\n"
|
||||
"\tif err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn &$ServiceStruct$$Method$Client{stream}, nil\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Client interface {\n"
|
||||
"\tSend(*$Request$) error\n"
|
||||
"\tRecv() (*$Response$, error)\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Client struct {\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Client) Send(m *$Request$) error {\n"
|
||||
"\treturn x.ClientStream.SendProto(m)\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Client) Recv() (*$Response$, error) "
|
||||
"{\n"
|
||||
"\tm := new($Response$)\n"
|
||||
"\tif err := x.ClientStream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn m, nil\n"
|
||||
"}\n\n");
|
||||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (c *$ServiceStruct$Client) $Method$(ctx context.Context, m "
|
||||
"*$Request$, "
|
||||
"opts ...grpc.CallOption) ($Service$_$Method$Client, error) {\n"
|
||||
"\tstream, err := grpc.NewClientStream(ctx, &_$Service$_serviceDesc.Streams[$StreamInd$], c.cc, "
|
||||
"\"/$Package$$Service$/$Method$\", opts...)\n"
|
||||
"\tif err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\tx := &$ServiceStruct$$Method$Client{stream}\n"
|
||||
"\tif err := x.ClientStream.SendProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\tif err := x.ClientStream.CloseSend(); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn x, nil\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Client interface {\n"
|
||||
"\tRecv() (*$Response$, error)\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Client struct {\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Client) Recv() (*$Response$, error) "
|
||||
"{\n"
|
||||
"\tm := new($Response$)\n"
|
||||
"\tif err := x.ClientStream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn m, nil\n"
|
||||
"}\n\n");
|
||||
} else if (ClientOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (c *$ServiceStruct$Client) $Method$(ctx context.Context, opts "
|
||||
"...grpc.CallOption) ($Service$_$Method$Client, error) {\n"
|
||||
"\tstream, err := grpc.NewClientStream(ctx, &_$Service$_serviceDesc.Streams[$StreamInd$], c.cc, "
|
||||
"\"/$Package$$Service$/$Method$\", opts...)\n"
|
||||
"\tif err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn &$ServiceStruct$$Method$Client{stream}, nil\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Client interface {\n"
|
||||
"\tSend(*$Request$) error\n"
|
||||
"\tCloseAndRecv() (*$Response$, error)\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Client struct {\n"
|
||||
"\tgrpc.ClientStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Client) Send(m *$Request$) error {\n"
|
||||
"\treturn x.ClientStream.SendProto(m)\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Client) CloseAndRecv() (*$Response$, "
|
||||
"error) {\n"
|
||||
"\tif err := x.ClientStream.CloseSend(); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\tm := new($Response$)\n"
|
||||
"\tif err := x.ClientStream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn m, nil\n"
|
||||
"}\n\n");
|
||||
}
|
||||
(*stream_ind)++;
|
||||
}
|
||||
|
||||
void PrintClient(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::ServiceDescriptor* service,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
(*vars)["Service"] = service->name();
|
||||
(*vars)["ServiceStruct"] = LowerCaseService(service->name());
|
||||
printer->Print(*vars, "type $Service$Client interface {\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintClientMethodDef(printer, service->method(i), vars, imports, import_alias);
|
||||
}
|
||||
printer->Print("}\n\n");
|
||||
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$Client struct {\n"
|
||||
"\tcc *grpc.ClientConn\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func New$Service$Client(cc *grpc.ClientConn) $Service$Client {\n"
|
||||
"\treturn &$ServiceStruct$Client{cc}\n"
|
||||
"}\n\n");
|
||||
int stream_ind = 0;
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintClientMethodImpl(
|
||||
printer, service->method(i), vars, imports, import_alias, &stream_ind);
|
||||
}
|
||||
}
|
||||
|
||||
void PrintServerMethodDef(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
GetFullMessageQualifiedName(method->input_type(), imports, import_alias);
|
||||
(*vars)["Response"] =
|
||||
GetFullMessageQualifiedName(method->output_type(), imports, import_alias);
|
||||
if (NoStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"\t$Method$(context.Context, *$Request$) (*$Response$, error)\n");
|
||||
} else if (BidiStreaming(method)) {
|
||||
printer->Print(*vars, "\t$Method$($Service$_$Method$Server) error\n");
|
||||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(*vars,
|
||||
"\t$Method$(*$Request$, $Service$_$Method$Server) error\n");
|
||||
} else if (ClientOnlyStreaming(method)) {
|
||||
printer->Print(*vars, "\t$Method$($Service$_$Method$Server) error\n");
|
||||
}
|
||||
}
|
||||
|
||||
void PrintServerHandler(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
GetFullMessageQualifiedName(method->input_type(), imports, import_alias);
|
||||
(*vars)["Response"] =
|
||||
GetFullMessageQualifiedName(method->output_type(), imports, import_alias);
|
||||
if (NoStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func _$Service$_$Method$_Handler(srv interface{}, ctx context.Context,"
|
||||
" buf []byte) (proto.Message, error) {\n");
|
||||
printer->Print(*vars, "\tin := new($Request$)\n");
|
||||
printer->Print("\tif err := proto.Unmarshal(buf, in); err != nil {\n");
|
||||
printer->Print("\t\treturn nil, err\n");
|
||||
printer->Print("\t}\n");
|
||||
printer->Print(*vars,
|
||||
"\tout, err := srv.($Service$Server).$Method$(ctx, in)\n");
|
||||
printer->Print("\tif err != nil {\n");
|
||||
printer->Print("\t\treturn nil, err\n");
|
||||
printer->Print("\t}\n");
|
||||
printer->Print("\treturn out, nil\n");
|
||||
printer->Print("}\n\n");
|
||||
} else if (BidiStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func _$Service$_$Method$_Handler(srv interface{}, stream grpc.ServerStream) "
|
||||
"error {\n"
|
||||
"\treturn srv.($Service$Server).$Method$(&$ServiceStruct$$Method$Server"
|
||||
"{stream})\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Server interface {\n"
|
||||
"\tSend(*$Response$) error\n"
|
||||
"\tRecv() (*$Request$, error)\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Server struct {\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Server) Send(m *$Response$) error {\n"
|
||||
"\treturn x.ServerStream.SendProto(m)\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Server) Recv() (*$Request$, error) "
|
||||
"{\n"
|
||||
"\tm := new($Request$)\n"
|
||||
"\tif err := x.ServerStream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn m, nil\n"
|
||||
"}\n\n");
|
||||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func _$Service$_$Method$_Handler(srv interface{}, stream grpc.ServerStream) "
|
||||
"error {\n"
|
||||
"\tm := new($Request$)\n"
|
||||
"\tif err := stream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn err\n"
|
||||
"\t}\n"
|
||||
"\treturn srv.($Service$Server).$Method$(m, "
|
||||
"&$ServiceStruct$$Method$Server{stream})\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Server interface {\n"
|
||||
"\tSend(*$Response$) error\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Server struct {\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Server) Send(m *$Response$) error {\n"
|
||||
"\treturn x.ServerStream.SendProto(m)\n"
|
||||
"}\n\n");
|
||||
} else if (ClientOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func _$Service$_$Method$_Handler(srv interface{}, stream grpc.ServerStream) "
|
||||
"error {\n"
|
||||
"\treturn srv.($Service$Server).$Method$(&$ServiceStruct$$Method$Server"
|
||||
"{stream})\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $Service$_$Method$Server interface {\n"
|
||||
"\tSendAndClose(*$Response$) error\n"
|
||||
"\tRecv() (*$Request$, error)\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
"type $ServiceStruct$$Method$Server struct {\n"
|
||||
"\tgrpc.ServerStream\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Server) SendAndClose(m *$Response$) "
|
||||
"error {\n"
|
||||
"\tif err := x.ServerStream.SendProto(m); err != nil {\n"
|
||||
"\t\treturn err\n"
|
||||
"\t}\n"
|
||||
"\treturn nil\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"func (x *$ServiceStruct$$Method$Server) Recv() (*$Request$, error) {\n"
|
||||
"\tm := new($Request$)\n"
|
||||
"\tif err := x.ServerStream.RecvProto(m); err != nil {\n"
|
||||
"\t\treturn nil, err\n"
|
||||
"\t}\n"
|
||||
"\treturn m, nil\n"
|
||||
"}\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void PrintServerMethodDesc(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
printer->Print("\t\t{\n");
|
||||
printer->Print(*vars, "\t\t\tMethodName:\t\"$Method$\",\n");
|
||||
printer->Print(*vars, "\t\t\tHandler:\t_$Service$_$Method$_Handler,\n");
|
||||
printer->Print("\t\t},\n");
|
||||
}
|
||||
|
||||
void PrintServerStreamingMethodDesc(
|
||||
google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
printer->Print("\t\t{\n");
|
||||
printer->Print(*vars, "\t\t\tStreamName:\t\"$Method$\",\n");
|
||||
printer->Print(*vars, "\t\t\tHandler:\t_$Service$_$Method$_Handler,\n");
|
||||
if (method->client_streaming()) {
|
||||
printer->Print(*vars, "\t\t\tClientStreams:\ttrue,\n");
|
||||
}
|
||||
if (method->server_streaming()) {
|
||||
printer->Print(*vars, "\t\t\tServerStreams:\ttrue,\n");
|
||||
}
|
||||
printer->Print("\t\t},\n");
|
||||
}
|
||||
|
||||
void PrintServer(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::ServiceDescriptor* service,
|
||||
map<string, string>* vars,
|
||||
const set<string>& imports,
|
||||
const map<string, string>& import_alias) {
|
||||
(*vars)["Service"] = service->name();
|
||||
printer->Print(*vars, "type $Service$Server interface {\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintServerMethodDef(printer, service->method(i), vars, imports, import_alias);
|
||||
}
|
||||
printer->Print("}\n\n");
|
||||
|
||||
printer->Print(*vars,
|
||||
"func Register$Service$Server(s *grpc.Server, srv $Service$Server) {\n"
|
||||
"\ts.RegisterService(&_$Service$_serviceDesc, srv)\n"
|
||||
"}\n\n");
|
||||
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintServerHandler(printer, service->method(i), vars, imports, import_alias);
|
||||
}
|
||||
|
||||
printer->Print(*vars,
|
||||
"var _$Service$_serviceDesc = grpc.ServiceDesc{\n"
|
||||
"\tServiceName: \"$Package$$Service$\",\n"
|
||||
"\tHandlerType: (*$Service$Server)(nil),\n"
|
||||
"\tMethods: []grpc.MethodDesc{\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
if (NoStreaming(service->method(i))) {
|
||||
PrintServerMethodDesc(printer, service->method(i), vars);
|
||||
}
|
||||
}
|
||||
printer->Print("\t},\n");
|
||||
|
||||
printer->Print("\tStreams: []grpc.StreamDesc{\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
if (!NoStreaming(service->method(i))) {
|
||||
PrintServerStreamingMethodDesc(printer, service->method(i), vars);
|
||||
}
|
||||
}
|
||||
printer->Print(
|
||||
"\t},\n"
|
||||
"}\n\n");
|
||||
}
|
||||
|
||||
bool IsSelfImport(const google::protobuf::FileDescriptor* self,
|
||||
const google::protobuf::FileDescriptor* import) {
|
||||
if (GenerateFullGoPackage(self) == GenerateFullGoPackage(import)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrintMessageImports(
|
||||
google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::FileDescriptor* file,
|
||||
map<string, string>* vars,
|
||||
const string& import_prefix,
|
||||
set<string>* imports,
|
||||
map<string, string>* import_alias) {
|
||||
set<const google::protobuf::FileDescriptor*> descs;
|
||||
for (int i = 0; i < file->service_count(); ++i) {
|
||||
const google::protobuf::ServiceDescriptor* service = file->service(i);
|
||||
for (int j = 0; j < service->method_count(); ++j) {
|
||||
const google::protobuf::MethodDescriptor* method = service->method(j);
|
||||
if (!IsSelfImport(file, method->input_type()->file())) {
|
||||
descs.insert(method->input_type()->file());
|
||||
}
|
||||
if (!IsSelfImport(file, method->output_type()->file())) {
|
||||
descs.insert(method->output_type()->file());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
set<string> pkgs;
|
||||
pkgs.insert((*vars)["PackageName"]);
|
||||
for (auto fd : descs) {
|
||||
string full_pkg = GenerateFullGoPackage(fd);
|
||||
if (full_pkg != "") {
|
||||
// Use ret_full to guarantee it only gets an alias once if a
|
||||
// package spans multiple files,
|
||||
auto ret_full = imports->insert(full_pkg);
|
||||
string fd_pkg = !fd->options().go_package().empty()
|
||||
? fd->options().go_package() : fd->package();
|
||||
// Use ret_pkg to guarantee the packages get the different alias
|
||||
// names if they are on different paths but use the same name.
|
||||
auto ret_pkg = pkgs.insert(fd_pkg);
|
||||
if (ret_full.second && !ret_pkg.second) {
|
||||
// the same package name in different directories. Require an alias.
|
||||
(*import_alias)[full_pkg] = "apb" + std::to_string(idx++);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto import : *imports) {
|
||||
string import_path = "import ";
|
||||
if (import_alias->find(import) != import_alias->end()) {
|
||||
import_path += (*import_alias)[import] + " ";
|
||||
}
|
||||
import_path += "\"" + import_prefix + import + "\"";
|
||||
printer->Print(import_path.c_str());
|
||||
printer->Print("\n");
|
||||
}
|
||||
printer->Print("\n");
|
||||
}
|
||||
|
||||
string GetServices(const google::protobuf::FileDescriptor* file,
|
||||
const vector<pair<string, string> >& options) {
|
||||
string output;
|
||||
google::protobuf::io::StringOutputStream output_stream(&output);
|
||||
google::protobuf::io::Printer printer(&output_stream, '$');
|
||||
map<string, string> vars;
|
||||
map<string, string> import_alias;
|
||||
set<string> imports;
|
||||
string package_name = !file->options().go_package().empty()
|
||||
? file->options().go_package()
|
||||
: file->package();
|
||||
vars["PackageName"] = BadToUnderscore(package_name);
|
||||
printer.Print(vars, "package $PackageName$\n\n");
|
||||
printer.Print("import (\n");
|
||||
printer.Print(
|
||||
"\t\"google.golang.org/grpc\"\n"
|
||||
"\tcontext \"golang.org/x/net/context\"\n"
|
||||
"\tproto \"github.com/golang/protobuf/proto\"\n"
|
||||
")\n\n");
|
||||
|
||||
// TODO(zhaoq): Support other command line parameters supported by
|
||||
// the protoc-gen-go plugin.
|
||||
string import_prefix = "";
|
||||
for (auto& p : options) {
|
||||
if (p.first == "import_prefix") {
|
||||
import_prefix = p.second;
|
||||
}
|
||||
}
|
||||
PrintMessageImports(
|
||||
&printer, file, &vars, import_prefix, &imports, &import_alias);
|
||||
|
||||
// $Package$ is used to fully qualify method names.
|
||||
vars["Package"] = file->package();
|
||||
if (!file->package().empty()) {
|
||||
vars["Package"].append(".");
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->service_count(); ++i) {
|
||||
PrintClient(&printer, file->service(0), &vars, imports, import_alias);
|
||||
printer.Print("\n");
|
||||
PrintServer(&printer, file->service(0), &vars, imports, import_alias);
|
||||
printer.Print("\n");
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
} // namespace grpc_go_generator
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NET_GRPC_COMPILER_GO_GENERATOR_H_
|
||||
#define NET_GRPC_COMPILER_GO_GENERATOR_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
class FileDescriptor;
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
namespace grpc_go_generator {
|
||||
|
||||
string GetServices(const google::protobuf::FileDescriptor* file,
|
||||
const vector<std::pair<string, string> >& options);
|
||||
|
||||
} // namespace grpc_go_generator
|
||||
|
||||
#endif // NET_GRPC_COMPILER_GO_GENERATOR_H_
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// Generates go gRPC service interface out of Protobuf IDL.
|
||||
//
|
||||
// This is a Proto2 compiler plugin. See net/proto2/compiler/proto/plugin.proto
|
||||
// and net/proto2/compiler/public/plugin.h for more information on plugins.
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "./go_generator.h"
|
||||
#include <google/protobuf/compiler/code_generator.h>
|
||||
#include <google/protobuf/compiler/plugin.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/io/zero_copy_stream.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class GoGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
|
||||
public:
|
||||
GoGrpcGenerator() {}
|
||||
virtual ~GoGrpcGenerator() {}
|
||||
|
||||
virtual bool Generate(const google::protobuf::FileDescriptor* file,
|
||||
const string& parameter,
|
||||
google::protobuf::compiler::GeneratorContext* context,
|
||||
string* error) const {
|
||||
if (file->service_count() <= 0) {
|
||||
// Do not generate anything if there is no rpc service defined.
|
||||
return true;
|
||||
}
|
||||
// Get output file name.
|
||||
string file_name;
|
||||
if (file->name().size() > 6 &&
|
||||
file->name().find_last_of(".proto") == file->name().size() - 1) {
|
||||
file_name =
|
||||
file->name().substr(0, file->name().size() - 6) + "_grpc.pb.go";
|
||||
} else {
|
||||
*error = "Invalid proto file name. Proto file must end with .proto";
|
||||
return false;
|
||||
}
|
||||
|
||||
vector<pair<string, string> > options;
|
||||
google::protobuf::compiler::ParseGeneratorParameter(parameter, &options);
|
||||
unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
|
||||
context->Open(file_name));
|
||||
google::protobuf::io::CodedOutputStream coded_out(output.get());
|
||||
string code = grpc_go_generator::GetServices(file, options);
|
||||
coded_out.WriteRaw(code.data(), code.size());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
GoGrpcGenerator generator;
|
||||
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
|
||||
}
|
@ -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: google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
// source: src/google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package grpc_testing is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
third_party/golang/grpc/test/grpc_testing/test.proto
|
||||
src/google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Empty
|
||||
@ -109,16 +76,14 @@ func (x *PayloadType) UnmarshalJSON(data []byte) error {
|
||||
*x = PayloadType(value)
|
||||
return nil
|
||||
}
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type Empty struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
|
||||
// A block of data, to simply increase gRPC message size.
|
||||
type Payload struct {
|
||||
@ -129,10 +94,9 @@ type Payload struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
|
||||
func (m *Payload) GetType() PayloadType {
|
||||
if m != nil && m.Type != nil {
|
||||
@ -165,10 +129,9 @@ type SimpleRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
|
||||
func (m *SimpleRequest) GetResponseType() PayloadType {
|
||||
if m != nil && m.ResponseType != nil {
|
||||
@ -217,10 +180,9 @@ type SimpleResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
|
||||
func (m *SimpleResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -250,10 +212,9 @@ type StreamingInputCallRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingInputCallRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -269,10 +230,9 @@ type StreamingInputCallResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 {
|
||||
if m != nil && m.AggregatedPayloadSize != nil {
|
||||
@ -292,10 +252,9 @@ type ResponseParameters struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
|
||||
func (m *ResponseParameters) GetSize() int32 {
|
||||
if m != nil && m.Size != nil {
|
||||
@ -325,10 +284,9 @@ type StreamingOutputCallRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetResponseType() PayloadType {
|
||||
if m != nil && m.ResponseType != nil {
|
||||
@ -358,10 +316,9 @@ type StreamingOutputCallResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingOutputCallResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -732,51 +689,14 @@ var _TestService_serviceDesc = grpc.ServiceDesc{
|
||||
{
|
||||
StreamName: "FullDuplexCall",
|
||||
Handler: _TestService_FullDuplexCall_Handler,
|
||||
ClientStreams: true,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "HalfDuplexCall",
|
||||
Handler: _TestService_HalfDuplexCall_Handler,
|
||||
ClientStreams: true,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 527 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x53, 0x5f, 0x6f, 0xd2, 0x50,
|
||||
0x14, 0xf7, 0x0e, 0x18, 0xd9, 0x81, 0x11, 0x72, 0xc8, 0x94, 0x75, 0x46, 0x97, 0x3e, 0x38, 0xf4,
|
||||
0x01, 0x08, 0xd1, 0xf8, 0xb4, 0xe8, 0x64, 0x2c, 0x9a, 0xb8, 0x41, 0xe8, 0x96, 0xf8, 0xd6, 0x5c,
|
||||
0xe1, 0x52, 0x9b, 0x94, 0xf6, 0xee, 0xf6, 0x76, 0xb1, 0x3e, 0xf9, 0x51, 0x7c, 0xdc, 0x17, 0xf0,
|
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 0x15, 0x3f, 0x9a, 0x28, 0x0d,
|
||||
0x36, 0xb2, 0xa6, 0x71, 0x43, 0xcb, 0x2b, 0xe2, 0x09, 0x6c, 0x5d, 0xb8, 0x54, 0x24, 0xb4, 0xbd,
|
||||
0x2c, 0x22, 0xf3, 0x70, 0xb4, 0x87, 0xf9, 0xcd, 0xc5, 0xdc, 0x97, 0xd0, 0xc8, 0x59, 0x0b, 0xb6,
|
||||
0x56, 0x48, 0xb7, 0x1e, 0x5c, 0x7b, 0xba, 0x06, 0x32, 0xf1, 0xd2, 0x0b, 0xd7, 0x84, 0x74, 0x09,
|
||||
0xba, 0x80, 0xbf, 0xff, 0x73, 0xf1, 0xe0, 0x16, 0x9d, 0xd5, 0x07, 0xa2, 0xb5, 0xfe, 0x0e, 0x5c,
|
||||
0xfa, 0x7d, 0x23, 0xa4, 0x45, 0xd4, 0x88, 0xb5, 0x93, 0xc0, 0x71, 0x8e, 0x03, 0x35, 0xf7, 0xe7,
|
||||
0x7f, 0x37, 0xdd, 0xa6, 0x72, 0xbb, 0x8e, 0x0c, 0xbb, 0xb1, 0xe5, 0x5b, 0xea, 0xcc, 0xfe, 0xa3,
|
||||
0xe5, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x02, 0x21, 0x8d, 0xc1, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
142
test/grpc_testing/test.pb.go
Executable file → Normal file
142
test/grpc_testing/test.pb.go
Executable file → Normal 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: google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
// source: src/google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package grpc_testing is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
third_party/golang/grpc/test/grpc_testing/test.proto
|
||||
src/google.golang.org/grpc/test/grpc_testing/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Empty
|
||||
@ -109,16 +76,14 @@ func (x *PayloadType) UnmarshalJSON(data []byte) error {
|
||||
*x = PayloadType(value)
|
||||
return nil
|
||||
}
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type Empty struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
|
||||
// A block of data, to simply increase gRPC message size.
|
||||
type Payload struct {
|
||||
@ -129,10 +94,9 @@ type Payload struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
|
||||
func (m *Payload) GetType() PayloadType {
|
||||
if m != nil && m.Type != nil {
|
||||
@ -165,10 +129,9 @@ type SimpleRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
|
||||
func (m *SimpleRequest) GetResponseType() PayloadType {
|
||||
if m != nil && m.ResponseType != nil {
|
||||
@ -217,10 +180,9 @@ type SimpleResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
|
||||
func (m *SimpleResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -250,10 +212,9 @@ type StreamingInputCallRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingInputCallRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -269,10 +230,9 @@ type StreamingInputCallResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 {
|
||||
if m != nil && m.AggregatedPayloadSize != nil {
|
||||
@ -292,10 +252,9 @@ type ResponseParameters struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
|
||||
func (m *ResponseParameters) GetSize() int32 {
|
||||
if m != nil && m.Size != nil {
|
||||
@ -325,10 +284,9 @@ type StreamingOutputCallRequest struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetResponseType() PayloadType {
|
||||
if m != nil && m.ResponseType != nil {
|
||||
@ -358,10 +316,9 @@ type StreamingOutputCallResponse struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
|
||||
func (m *StreamingOutputCallResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -732,51 +689,14 @@ var _TestService_serviceDesc = grpc.ServiceDesc{
|
||||
{
|
||||
StreamName: "FullDuplexCall",
|
||||
Handler: _TestService_FullDuplexCall_Handler,
|
||||
ClientStreams: true,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "HalfDuplexCall",
|
||||
Handler: _TestService_HalfDuplexCall_Handler,
|
||||
ClientStreams: true,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 527 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x53, 0x5f, 0x6f, 0xd2, 0x50,
|
||||
0x14, 0xf7, 0x0e, 0x18, 0xd9, 0x81, 0x11, 0x72, 0xc8, 0x94, 0x75, 0x46, 0x97, 0x3e, 0x38, 0xf4,
|
||||
0x01, 0x08, 0xd1, 0xf8, 0xb4, 0xe8, 0x64, 0x2c, 0x9a, 0xb8, 0x41, 0xe8, 0x96, 0xf8, 0xd6, 0x5c,
|
||||
0xe1, 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0xd1, 0xfb, 0x51, 0x84,
|
||||
0xca, 0xb9, 0x12, 0x35, 0xd4, 0x5e, 0xed, 0x09, 0xc3, 0x17, 0xb0, 0x15, 0x3f, 0x9a, 0x28, 0x0d,
|
||||
0x36, 0xb2, 0xa6, 0x71, 0x43, 0xcb, 0x2b, 0xe2, 0x09, 0x6c, 0x5d, 0xb8, 0x54, 0x24, 0xb4, 0xbd,
|
||||
0x2c, 0x22, 0xf3, 0x70, 0xb4, 0x87, 0xf9, 0xcd, 0xc5, 0xdc, 0x97, 0xd0, 0xc8, 0x59, 0x0b, 0xb6,
|
||||
0x56, 0x48, 0xb7, 0x1e, 0x5c, 0x7b, 0xba, 0x06, 0x32, 0xf1, 0xd2, 0x0b, 0xd7, 0x84, 0x74, 0x09,
|
||||
0xba, 0x80, 0xbf, 0xff, 0x73, 0xf1, 0xe0, 0x16, 0x9d, 0xd5, 0x07, 0xa2, 0xb5, 0xfe, 0x0e, 0x5c,
|
||||
0xfa, 0x7d, 0x23, 0xa4, 0x45, 0xd4, 0x88, 0xb5, 0x93, 0xc0, 0x71, 0x8e, 0x03, 0x35, 0xf7, 0xe7,
|
||||
0x7f, 0x37, 0xdd, 0xa6, 0x72, 0xbb, 0x8e, 0x0c, 0xbb, 0xb1, 0xe5, 0x5b, 0xea, 0xcc, 0xfe, 0xa3,
|
||||
0xe5, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x02, 0x21, 0x8d, 0xc1, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
Reference in New Issue
Block a user