mirror of https://github.com/grpc/grpc.git
commit
f5266d31c8
87 changed files with 3726 additions and 607 deletions
@ -0,0 +1,39 @@ |
|||||||
|
// GENERATED CODE -- DO NOT EDIT!
|
||||||
|
|
||||||
|
var grpc = require('grpc'); |
||||||
|
var helloworld_pb = require('./helloworld_pb.js'); |
||||||
|
|
||||||
|
function serialize_HelloReply(arg) { |
||||||
|
if (!(arg instanceof helloworld_pb.HelloReply)) { |
||||||
|
throw new Error('Expected argument of type HelloReply'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
function deserialize_HelloReply(buffer_arg) { |
||||||
|
return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
function serialize_HelloRequest(arg) { |
||||||
|
if (!(arg instanceof helloworld_pb.HelloRequest)) { |
||||||
|
throw new Error('Expected argument of type HelloRequest'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
function deserialize_HelloRequest(buffer_arg) { |
||||||
|
return helloworld_pb.HelloRequest.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
|
||||||
|
var GreeterService = exports.GreeterService = { |
||||||
|
sayHello: { |
||||||
|
path: '/helloworld.Greeter/SayHello', |
||||||
|
requestStream: false, |
||||||
|
responseStream: false, |
||||||
|
requestType: helloworld_pb.HelloRequest, |
||||||
|
responseType: helloworld_pb.HelloReply, |
||||||
|
requestSerialize: serialize_HelloRequest, |
||||||
|
requestDeserialize: deserialize_HelloRequest, |
||||||
|
responseSerialize: serialize_HelloReply, |
||||||
|
responseDeserialize: deserialize_HelloReply, |
||||||
|
}, |
||||||
|
}; |
||||||
|
|
||||||
|
exports.GreeterClient = grpc.makeGenericClientConstructor(GreeterService); |
@ -0,0 +1,332 @@ |
|||||||
|
/** |
||||||
|
* @fileoverview |
||||||
|
* @enhanceable |
||||||
|
* @public |
||||||
|
*/ |
||||||
|
// GENERATED CODE -- DO NOT EDIT!
|
||||||
|
|
||||||
|
var jspb = require('google-protobuf'); |
||||||
|
var goog = jspb; |
||||||
|
var global = Function('return this')(); |
||||||
|
|
||||||
|
goog.exportSymbol('proto.helloworld.HelloReply', null, global); |
||||||
|
goog.exportSymbol('proto.helloworld.HelloRequest', null, global); |
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.helloworld.HelloRequest, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.helloworld.HelloRequest} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
name: msg.getName() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.helloworld.HelloRequest} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.helloworld.HelloRequest; |
||||||
|
return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.helloworld.HelloRequest} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {string} */ (reader.readString()); |
||||||
|
msg.setName(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.helloworld.HelloRequest} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getName(); |
||||||
|
if (f.length > 0) { |
||||||
|
writer.writeString( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.helloworld.HelloRequest} The clone. |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.helloworld.HelloRequest} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional string name = 1; |
||||||
|
* @return {string} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloRequest.prototype.getName = function() { |
||||||
|
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {string} value */ |
||||||
|
proto.helloworld.HelloRequest.prototype.setName = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.helloworld.HelloReply, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.helloworld.HelloReply.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.helloworld.HelloReply} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
message: msg.getMessage() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.helloworld.HelloReply} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.helloworld.HelloReply; |
||||||
|
return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.helloworld.HelloReply} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.helloworld.HelloReply} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {string} */ (reader.readString()); |
||||||
|
msg.setMessage(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.helloworld.HelloReply} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getMessage(); |
||||||
|
if (f.length > 0) { |
||||||
|
writer.writeString( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.helloworld.HelloReply} The clone. |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.helloworld.HelloReply} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional string message = 1; |
||||||
|
* @return {string} |
||||||
|
*/ |
||||||
|
proto.helloworld.HelloReply.prototype.getMessage = function() { |
||||||
|
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {string} value */ |
||||||
|
proto.helloworld.HelloReply.prototype.setMessage = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
goog.object.extend(exports, proto.helloworld); |
@ -1,7 +1,8 @@ |
|||||||
# GRPC Python setup requirements |
# GRPC Python setup requirements |
||||||
|
coverage>=4.0 |
||||||
|
cython>=0.23 |
||||||
enum34>=1.0.4 |
enum34>=1.0.4 |
||||||
futures>=2.2.0 |
futures>=2.2.0 |
||||||
cython>=0.23 |
protobuf>=3.0.0a3 |
||||||
coverage>=4.0 |
|
||||||
six>=1.10 |
six>=1.10 |
||||||
wheel>=0.29 |
wheel>=0.29 |
@ -0,0 +1,277 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, 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 <map> |
||||||
|
|
||||||
|
#include "src/compiler/config.h" |
||||||
|
#include "src/compiler/generator_helpers.h" |
||||||
|
#include "src/compiler/node_generator_helpers.h" |
||||||
|
|
||||||
|
using grpc::protobuf::FileDescriptor; |
||||||
|
using grpc::protobuf::ServiceDescriptor; |
||||||
|
using grpc::protobuf::MethodDescriptor; |
||||||
|
using grpc::protobuf::Descriptor; |
||||||
|
using grpc::protobuf::io::Printer; |
||||||
|
using grpc::protobuf::io::StringOutputStream; |
||||||
|
using std::map; |
||||||
|
|
||||||
|
namespace grpc_node_generator { |
||||||
|
namespace { |
||||||
|
|
||||||
|
// Returns the alias we assign to the module of the given .proto filename
|
||||||
|
// when importing. Copied entirely from
|
||||||
|
// github:google/protobuf/src/google/protobuf/compiler/js/js_generator.cc#L154
|
||||||
|
grpc::string ModuleAlias(const grpc::string filename) { |
||||||
|
// This scheme could technically cause problems if a file includes any 2 of:
|
||||||
|
// foo/bar_baz.proto
|
||||||
|
// foo_bar_baz.proto
|
||||||
|
// foo_bar/baz.proto
|
||||||
|
//
|
||||||
|
// We'll worry about this problem if/when we actually see it. This name isn't
|
||||||
|
// exposed to users so we can change it later if we need to.
|
||||||
|
grpc::string basename = grpc_generator::StripProto(filename); |
||||||
|
basename = grpc_generator::StringReplace(basename, "-", "$"); |
||||||
|
basename = grpc_generator::StringReplace(basename, "/", "_"); |
||||||
|
return basename + "_pb"; |
||||||
|
} |
||||||
|
|
||||||
|
// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
|
||||||
|
// message file foo/bar/baz.js
|
||||||
|
grpc::string GetJSMessageFilename(const grpc::string& filename) { |
||||||
|
grpc::string name = filename; |
||||||
|
return grpc_generator::StripProto(name) + "_pb.js"; |
||||||
|
} |
||||||
|
|
||||||
|
// Given a filename like foo/bar/baz.proto, returns the root directory
|
||||||
|
// path ../../
|
||||||
|
grpc::string GetRootPath(const grpc::string& filename) { |
||||||
|
size_t slashes = std::count(filename.begin(), filename.end(), '/'); |
||||||
|
if (slashes == 0) { |
||||||
|
return "./"; |
||||||
|
} |
||||||
|
grpc::string result = ""; |
||||||
|
for (size_t i = 0; i < slashes; i++) { |
||||||
|
result += "../"; |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// Return the relative path to load to_file from the directory containing
|
||||||
|
// from_file, assuming that both paths are relative to the same directory
|
||||||
|
grpc::string GetRelativePath(const grpc::string& from_file, |
||||||
|
const grpc::string& to_file) { |
||||||
|
return GetRootPath(from_file) + to_file; |
||||||
|
} |
||||||
|
|
||||||
|
/* Finds all message types used in all services in the file, and returns them
|
||||||
|
* as a map of fully qualified message type name to message descriptor */ |
||||||
|
map<grpc::string, const Descriptor*> GetAllMessages(const FileDescriptor *file) { |
||||||
|
map<grpc::string, const Descriptor*> message_types; |
||||||
|
for (int service_num = 0; service_num < file->service_count(); service_num++) { |
||||||
|
const ServiceDescriptor* service = file->service(service_num); |
||||||
|
for (int method_num = 0; method_num < service->method_count(); method_num++) { |
||||||
|
const MethodDescriptor* method = service->method(method_num); |
||||||
|
const Descriptor* input_type = method->input_type(); |
||||||
|
const Descriptor* output_type = method->output_type(); |
||||||
|
message_types[input_type->name()] = input_type; |
||||||
|
message_types[output_type->name()] = output_type; |
||||||
|
} |
||||||
|
} |
||||||
|
return message_types; |
||||||
|
} |
||||||
|
|
||||||
|
grpc::string MessageIdentifierName(const grpc::string& name) { |
||||||
|
return grpc_generator::StringReplace(name, ".", "_"); |
||||||
|
} |
||||||
|
|
||||||
|
grpc::string NodeObjectPath(const Descriptor *descriptor) { |
||||||
|
grpc::string module_alias = ModuleAlias(descriptor->file()->name()); |
||||||
|
grpc::string name = descriptor->name(); |
||||||
|
grpc_generator::StripPrefix(&name, descriptor->file()->package() + "."); |
||||||
|
return module_alias + "." + name; |
||||||
|
} |
||||||
|
|
||||||
|
// Prints out the message serializer and deserializer functions
|
||||||
|
void PrintMessageTransformer(const Descriptor *descriptor, Printer *out) { |
||||||
|
map<grpc::string, grpc::string> template_vars; |
||||||
|
template_vars["identifier_name"] = MessageIdentifierName(descriptor->name()); |
||||||
|
template_vars["name"] = descriptor->name(); |
||||||
|
template_vars["node_name"] = NodeObjectPath(descriptor); |
||||||
|
// Print the serializer
|
||||||
|
out->Print(template_vars, "function serialize_$identifier_name$(arg) {\n"); |
||||||
|
out->Indent(); |
||||||
|
out->Print(template_vars, "if (!(arg instanceof $node_name$)) {\n"); |
||||||
|
out->Indent(); |
||||||
|
out->Print(template_vars, |
||||||
|
"throw new Error('Expected argument of type $name$');\n"); |
||||||
|
out->Outdent(); |
||||||
|
out->Print("}\n"); |
||||||
|
out->Print("return new Buffer(arg.serializeBinary());\n"); |
||||||
|
out->Outdent(); |
||||||
|
out->Print("}\n\n"); |
||||||
|
|
||||||
|
// Print the deserializer
|
||||||
|
out->Print(template_vars, |
||||||
|
"function deserialize_$identifier_name$(buffer_arg) {\n"); |
||||||
|
out->Indent(); |
||||||
|
out->Print( |
||||||
|
template_vars, |
||||||
|
"return $node_name$.deserializeBinary(new Uint8Array(buffer_arg));\n"); |
||||||
|
out->Outdent(); |
||||||
|
out->Print("}\n\n"); |
||||||
|
} |
||||||
|
|
||||||
|
void PrintMethod(const MethodDescriptor *method, Printer *out) { |
||||||
|
const Descriptor *input_type = method->input_type(); |
||||||
|
const Descriptor *output_type = method->output_type(); |
||||||
|
map<grpc::string, grpc::string> vars; |
||||||
|
vars["service_name"] = method->service()->full_name(); |
||||||
|
vars["name"] = method->name(); |
||||||
|
vars["input_type"] = NodeObjectPath(input_type); |
||||||
|
vars["input_type_id"] = MessageIdentifierName(input_type->name()); |
||||||
|
vars["output_type"] = NodeObjectPath(output_type); |
||||||
|
vars["output_type_id"] = MessageIdentifierName(output_type->name()); |
||||||
|
vars["client_stream"] = method->client_streaming() ? "true" : "false"; |
||||||
|
vars["server_stream"] = method->server_streaming() ? "true" : "false"; |
||||||
|
out->Print("{\n"); |
||||||
|
out->Indent(); |
||||||
|
out->Print(vars, "path: '/$service_name$/$name$',\n"); |
||||||
|
out->Print(vars, "requestStream: $client_stream$,\n"); |
||||||
|
out->Print(vars, "responseStream: $server_stream$,\n"); |
||||||
|
out->Print(vars, "requestType: $input_type$,\n"); |
||||||
|
out->Print(vars, "responseType: $output_type$,\n"); |
||||||
|
out->Print(vars, "requestSerialize: serialize_$input_type_id$,\n"); |
||||||
|
out->Print(vars, "requestDeserialize: deserialize_$input_type_id$,\n"); |
||||||
|
out->Print(vars, "responseSerialize: serialize_$output_type_id$,\n"); |
||||||
|
out->Print(vars, "responseDeserialize: deserialize_$output_type_id$,\n"); |
||||||
|
out->Outdent(); |
||||||
|
out->Print("}"); |
||||||
|
} |
||||||
|
|
||||||
|
// Prints out the service descriptor object
|
||||||
|
void PrintService(const ServiceDescriptor *service, Printer *out) { |
||||||
|
map<grpc::string, grpc::string> template_vars; |
||||||
|
template_vars["name"] = service->name(); |
||||||
|
out->Print(template_vars, "var $name$Service = exports.$name$Service = {\n"); |
||||||
|
out->Indent(); |
||||||
|
for (int i = 0; i < service->method_count(); i++) { |
||||||
|
grpc::string method_name = grpc_generator::LowercaseFirstLetter( |
||||||
|
service->method(i)->name()); |
||||||
|
out->Print("$method_name$: ", |
||||||
|
"method_name", method_name); |
||||||
|
PrintMethod(service->method(i), out); |
||||||
|
out->Print(",\n"); |
||||||
|
} |
||||||
|
out->Outdent(); |
||||||
|
out->Print("};\n\n"); |
||||||
|
out->Print(template_vars, "exports.$name$Client = " |
||||||
|
"grpc.makeGenericClientConstructor($name$Service);\n"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
grpc::string GetImports(const FileDescriptor *file) { |
||||||
|
grpc::string output; |
||||||
|
{ |
||||||
|
StringOutputStream output_stream(&output); |
||||||
|
Printer out(&output_stream, '$'); |
||||||
|
|
||||||
|
if (file->service_count() == 0) { |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n"); |
||||||
|
|
||||||
|
out.Print("'use strict';\n"); |
||||||
|
|
||||||
|
out.Print("var grpc = require('grpc');\n"); |
||||||
|
if (file->message_type_count() > 0) { |
||||||
|
grpc::string file_path = GetRelativePath(file->name(), |
||||||
|
GetJSMessageFilename( |
||||||
|
file->name())); |
||||||
|
out.Print("var $module_alias$ = require('$file_path$');\n", |
||||||
|
"module_alias", ModuleAlias(file->name()), |
||||||
|
"file_path", file_path); |
||||||
|
} |
||||||
|
|
||||||
|
for (int i = 0; i < file->dependency_count(); i++) { |
||||||
|
grpc::string file_path = GetRelativePath( |
||||||
|
file->name(), GetJSMessageFilename(file->dependency(i)->name())); |
||||||
|
out.Print("var $module_alias$ = require('$file_path$');\n", |
||||||
|
"module_alias", ModuleAlias(file->dependency(i)->name()), |
||||||
|
"file_path", file_path); |
||||||
|
} |
||||||
|
out.Print("\n"); |
||||||
|
} |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
grpc::string GetTransformers(const FileDescriptor *file) { |
||||||
|
grpc::string output; |
||||||
|
{ |
||||||
|
StringOutputStream output_stream(&output); |
||||||
|
Printer out(&output_stream, '$'); |
||||||
|
|
||||||
|
if (file->service_count() == 0) { |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
map<grpc::string, const Descriptor*> messages = GetAllMessages(file); |
||||||
|
for (std::map<grpc::string, const Descriptor*>::iterator it = |
||||||
|
messages.begin(); |
||||||
|
it != messages.end(); it++) { |
||||||
|
PrintMessageTransformer(it->second, &out); |
||||||
|
} |
||||||
|
out.Print("\n"); |
||||||
|
} |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
grpc::string GetServices(const FileDescriptor *file) { |
||||||
|
grpc::string output; |
||||||
|
{ |
||||||
|
StringOutputStream output_stream(&output); |
||||||
|
Printer out(&output_stream, '$'); |
||||||
|
|
||||||
|
if (file->service_count() == 0) { |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
for (int i = 0; i < file->service_count(); i++) { |
||||||
|
PrintService(file->service(i), &out); |
||||||
|
} |
||||||
|
} |
||||||
|
return output; |
||||||
|
} |
||||||
|
|
||||||
|
} // namespace grpc_node_generator
|
@ -0,0 +1,49 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, 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 GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H |
||||||
|
#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H |
||||||
|
|
||||||
|
#include "src/compiler/config.h" |
||||||
|
|
||||||
|
namespace grpc_node_generator { |
||||||
|
|
||||||
|
grpc::string GetImports(const grpc::protobuf::FileDescriptor *file); |
||||||
|
|
||||||
|
grpc::string GetTransformers(const grpc::protobuf::FileDescriptor *file); |
||||||
|
|
||||||
|
grpc::string GetServices(const grpc::protobuf::FileDescriptor *file); |
||||||
|
|
||||||
|
} // namespace grpc_node_generator
|
||||||
|
|
||||||
|
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
|
@ -0,0 +1,50 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, 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 GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H |
||||||
|
#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H |
||||||
|
|
||||||
|
#include <algorithm> |
||||||
|
|
||||||
|
#include "src/compiler/config.h" |
||||||
|
#include "src/compiler/generator_helpers.h" |
||||||
|
|
||||||
|
namespace grpc_node_generator { |
||||||
|
|
||||||
|
inline grpc::string GetJSServiceFilename(const grpc::string& filename) { |
||||||
|
return grpc_generator::StripProto(filename) + "_grpc_pb.js"; |
||||||
|
} |
||||||
|
|
||||||
|
} // namespace grpc_node_generator
|
||||||
|
|
||||||
|
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
|
@ -0,0 +1,77 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2015, 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 Node gRPC service interface out of Protobuf IDL.
|
||||||
|
|
||||||
|
#include <memory> |
||||||
|
|
||||||
|
#include "src/compiler/config.h" |
||||||
|
#include "src/compiler/node_generator.h" |
||||||
|
#include "src/compiler/node_generator_helpers.h" |
||||||
|
|
||||||
|
using grpc_node_generator::GetImports; |
||||||
|
using grpc_node_generator::GetJSServiceFilename; |
||||||
|
using grpc_node_generator::GetServices; |
||||||
|
using grpc_node_generator::GetTransformers; |
||||||
|
|
||||||
|
class NodeGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { |
||||||
|
public: |
||||||
|
NodeGrpcGenerator() {} |
||||||
|
~NodeGrpcGenerator() {} |
||||||
|
|
||||||
|
bool Generate(const grpc::protobuf::FileDescriptor *file, |
||||||
|
const grpc::string ¶meter, |
||||||
|
grpc::protobuf::compiler::GeneratorContext *context, |
||||||
|
grpc::string *error) const { |
||||||
|
grpc::string code = GetImports(file) + |
||||||
|
GetTransformers(file) + |
||||||
|
GetServices(file); |
||||||
|
if (code.size() == 0) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
// Get output file name
|
||||||
|
grpc::string file_name = GetJSServiceFilename(file->name()); |
||||||
|
|
||||||
|
std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output( |
||||||
|
context->Open(file_name)); |
||||||
|
grpc::protobuf::io::CodedOutputStream coded_out(output.get()); |
||||||
|
coded_out.WriteRaw(code.data(), code.size()); |
||||||
|
return true; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
int main(int argc, char *argv[]) { |
||||||
|
NodeGrpcGenerator generator; |
||||||
|
return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); |
||||||
|
} |
@ -1,2 +0,0 @@ |
|||||||
build |
|
||||||
node_modules |
|
@ -0,0 +1 @@ |
|||||||
|
**/*_pb.js |
@ -1,28 +0,0 @@ |
|||||||
{ |
|
||||||
"bitwise": true, |
|
||||||
"curly": true, |
|
||||||
"eqeqeq": true, |
|
||||||
"esnext": true, |
|
||||||
"freeze": true, |
|
||||||
"immed": true, |
|
||||||
"indent": 2, |
|
||||||
"latedef": "nofunc", |
|
||||||
"maxlen": 80, |
|
||||||
"newcap": true, |
|
||||||
"node": true, |
|
||||||
"noarg": true, |
|
||||||
"quotmark": "single", |
|
||||||
"strict": true, |
|
||||||
"trailing": true, |
|
||||||
"undef": true, |
|
||||||
"unused": "vars", |
|
||||||
"globals": { |
|
||||||
/* Mocha-provided globals */ |
|
||||||
"describe": false, |
|
||||||
"it": false, |
|
||||||
"before": false, |
|
||||||
"beforeEach": false, |
|
||||||
"after": false, |
|
||||||
"afterEach": false |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,99 @@ |
|||||||
|
// GENERATED CODE -- DO NOT EDIT!
|
||||||
|
|
||||||
|
'use strict'; |
||||||
|
var grpc = require('grpc'); |
||||||
|
var math_pb = require('./math_pb.js'); |
||||||
|
|
||||||
|
function serialize_DivArgs(arg) { |
||||||
|
if (!(arg instanceof math_pb.DivArgs)) { |
||||||
|
throw new Error('Expected argument of type DivArgs'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
|
||||||
|
function deserialize_DivArgs(buffer_arg) { |
||||||
|
return math_pb.DivArgs.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
|
||||||
|
function serialize_DivReply(arg) { |
||||||
|
if (!(arg instanceof math_pb.DivReply)) { |
||||||
|
throw new Error('Expected argument of type DivReply'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
|
||||||
|
function deserialize_DivReply(buffer_arg) { |
||||||
|
return math_pb.DivReply.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
|
||||||
|
function serialize_FibArgs(arg) { |
||||||
|
if (!(arg instanceof math_pb.FibArgs)) { |
||||||
|
throw new Error('Expected argument of type FibArgs'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
|
||||||
|
function deserialize_FibArgs(buffer_arg) { |
||||||
|
return math_pb.FibArgs.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
|
||||||
|
function serialize_Num(arg) { |
||||||
|
if (!(arg instanceof math_pb.Num)) { |
||||||
|
throw new Error('Expected argument of type Num'); |
||||||
|
} |
||||||
|
return new Buffer(arg.serializeBinary()); |
||||||
|
} |
||||||
|
|
||||||
|
function deserialize_Num(buffer_arg) { |
||||||
|
return math_pb.Num.deserializeBinary(new Uint8Array(buffer_arg)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
var MathService = exports.MathService = { |
||||||
|
div: { |
||||||
|
path: '/math.Math/Div', |
||||||
|
requestStream: false, |
||||||
|
responseStream: false, |
||||||
|
requestType: math_pb.DivArgs, |
||||||
|
responseType: math_pb.DivReply, |
||||||
|
requestSerialize: serialize_DivArgs, |
||||||
|
requestDeserialize: deserialize_DivArgs, |
||||||
|
responseSerialize: serialize_DivReply, |
||||||
|
responseDeserialize: deserialize_DivReply, |
||||||
|
}, |
||||||
|
divMany: { |
||||||
|
path: '/math.Math/DivMany', |
||||||
|
requestStream: true, |
||||||
|
responseStream: true, |
||||||
|
requestType: math_pb.DivArgs, |
||||||
|
responseType: math_pb.DivReply, |
||||||
|
requestSerialize: serialize_DivArgs, |
||||||
|
requestDeserialize: deserialize_DivArgs, |
||||||
|
responseSerialize: serialize_DivReply, |
||||||
|
responseDeserialize: deserialize_DivReply, |
||||||
|
}, |
||||||
|
fib: { |
||||||
|
path: '/math.Math/Fib', |
||||||
|
requestStream: false, |
||||||
|
responseStream: true, |
||||||
|
requestType: math_pb.FibArgs, |
||||||
|
responseType: math_pb.Num, |
||||||
|
requestSerialize: serialize_FibArgs, |
||||||
|
requestDeserialize: deserialize_FibArgs, |
||||||
|
responseSerialize: serialize_Num, |
||||||
|
responseDeserialize: deserialize_Num, |
||||||
|
}, |
||||||
|
sum: { |
||||||
|
path: '/math.Math/Sum', |
||||||
|
requestStream: true, |
||||||
|
responseStream: false, |
||||||
|
requestType: math_pb.Num, |
||||||
|
responseType: math_pb.Num, |
||||||
|
requestSerialize: serialize_Num, |
||||||
|
requestDeserialize: deserialize_Num, |
||||||
|
responseSerialize: serialize_Num, |
||||||
|
responseDeserialize: deserialize_Num, |
||||||
|
}, |
||||||
|
}; |
||||||
|
|
||||||
|
exports.MathClient = grpc.makeGenericClientConstructor(MathService); |
@ -0,0 +1,866 @@ |
|||||||
|
/** |
||||||
|
* @fileoverview |
||||||
|
* @enhanceable |
||||||
|
* @public |
||||||
|
*/ |
||||||
|
// GENERATED CODE -- DO NOT EDIT!
|
||||||
|
|
||||||
|
var jspb = require('google-protobuf'); |
||||||
|
var goog = jspb; |
||||||
|
var global = Function('return this')(); |
||||||
|
|
||||||
|
goog.exportSymbol('proto.math.DivArgs', null, global); |
||||||
|
goog.exportSymbol('proto.math.DivReply', null, global); |
||||||
|
goog.exportSymbol('proto.math.FibArgs', null, global); |
||||||
|
goog.exportSymbol('proto.math.FibReply', null, global); |
||||||
|
goog.exportSymbol('proto.math.Num', null, global); |
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.math.DivArgs = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.math.DivArgs, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.math.DivArgs.displayName = 'proto.math.DivArgs'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.math.DivArgs.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.math.DivArgs} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
dividend: msg.getDividend(), |
||||||
|
divisor: msg.getDivisor() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.math.DivArgs} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.math.DivArgs; |
||||||
|
return proto.math.DivArgs.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.math.DivArgs} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.math.DivArgs} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setDividend(value); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setDivisor(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.math.DivArgs} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getDividend(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
f = this.getDivisor(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
2, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.math.DivArgs} The clone. |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.math.DivArgs} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 dividend = 1; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.getDividend = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.DivArgs.prototype.setDividend = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 divisor = 2; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.DivArgs.prototype.getDivisor = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.DivArgs.prototype.setDivisor = function(value) { |
||||||
|
jspb.Message.setField(this, 2, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.math.DivReply = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.math.DivReply, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.math.DivReply.displayName = 'proto.math.DivReply'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.math.DivReply.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.math.DivReply} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
quotient: msg.getQuotient(), |
||||||
|
remainder: msg.getRemainder() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.math.DivReply} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.math.DivReply; |
||||||
|
return proto.math.DivReply.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.math.DivReply} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.math.DivReply} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setQuotient(value); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setRemainder(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.math.DivReply} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.DivReply.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getQuotient(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
f = this.getRemainder(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
2, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.math.DivReply} The clone. |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.math.DivReply} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 quotient = 1; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.getQuotient = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.DivReply.prototype.setQuotient = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 remainder = 2; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.DivReply.prototype.getRemainder = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.DivReply.prototype.setRemainder = function(value) { |
||||||
|
jspb.Message.setField(this, 2, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.math.FibArgs = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.math.FibArgs, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.math.FibArgs.displayName = 'proto.math.FibArgs'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.math.FibArgs.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.math.FibArgs} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
limit: msg.getLimit() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.math.FibArgs} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.math.FibArgs; |
||||||
|
return proto.math.FibArgs.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.math.FibArgs} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.math.FibArgs} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setLimit(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.math.FibArgs} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getLimit(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.math.FibArgs} The clone. |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.math.FibArgs} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 limit = 1; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.FibArgs.prototype.getLimit = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.FibArgs.prototype.setLimit = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.math.Num = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.math.Num, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.math.Num.displayName = 'proto.math.Num'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.Num.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.math.Num.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.math.Num} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.Num.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
num: msg.getNum() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.math.Num} |
||||||
|
*/ |
||||||
|
proto.math.Num.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.math.Num; |
||||||
|
return proto.math.Num.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.math.Num} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.math.Num} |
||||||
|
*/ |
||||||
|
proto.math.Num.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setNum(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.math.Num} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.Num.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.math.Num.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.Num.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getNum(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.math.Num} The clone. |
||||||
|
*/ |
||||||
|
proto.math.Num.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.math.Num} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 num = 1; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.Num.prototype.getNum = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.Num.prototype.setNum = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Generated by JsPbCodeGenerator. |
||||||
|
* @param {Array=} opt_data Optional initial data array, typically from a |
||||||
|
* server response, or constructed directly in Javascript. The array is used |
||||||
|
* in place and becomes part of the constructed object. It is not cloned. |
||||||
|
* If no data is provided, the constructed object will be empty, but still |
||||||
|
* valid. |
||||||
|
* @extends {jspb.Message} |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
proto.math.FibReply = function(opt_data) { |
||||||
|
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||||
|
}; |
||||||
|
goog.inherits(proto.math.FibReply, jspb.Message); |
||||||
|
if (goog.DEBUG && !COMPILED) { |
||||||
|
proto.math.FibReply.displayName = 'proto.math.FibReply'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||||
|
/** |
||||||
|
* Creates an object representation of this proto suitable for use in Soy templates. |
||||||
|
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||||
|
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||||
|
* For the list of reserved names please see: |
||||||
|
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||||
|
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||||
|
* for transitional soy proto support: http://goto/soy-param-migration
|
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.prototype.toObject = function(opt_includeInstance) { |
||||||
|
return proto.math.FibReply.toObject(opt_includeInstance, this); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Static version of the {@see toObject} method. |
||||||
|
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||||
|
* instance for transitional soy proto support: |
||||||
|
* http://goto/soy-param-migration
|
||||||
|
* @param {!proto.math.FibReply} msg The msg instance to transform. |
||||||
|
* @return {!Object} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.toObject = function(includeInstance, msg) { |
||||||
|
var f, obj = { |
||||||
|
count: msg.getCount() |
||||||
|
}; |
||||||
|
|
||||||
|
if (includeInstance) { |
||||||
|
obj.$jspbMessageInstance = msg |
||||||
|
} |
||||||
|
return obj; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format). |
||||||
|
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||||
|
* @return {!proto.math.FibReply} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.deserializeBinary = function(bytes) { |
||||||
|
var reader = new jspb.BinaryReader(bytes); |
||||||
|
var msg = new proto.math.FibReply; |
||||||
|
return proto.math.FibReply.deserializeBinaryFromReader(msg, reader); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Deserializes binary data (in protobuf wire format) from the |
||||||
|
* given reader into the given message object. |
||||||
|
* @param {!proto.math.FibReply} msg The message object to deserialize into. |
||||||
|
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||||
|
* @return {!proto.math.FibReply} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.deserializeBinaryFromReader = function(msg, reader) { |
||||||
|
while (reader.nextField()) { |
||||||
|
if (reader.isEndGroup()) { |
||||||
|
break; |
||||||
|
} |
||||||
|
var field = reader.getFieldNumber(); |
||||||
|
switch (field) { |
||||||
|
case 1: |
||||||
|
var value = /** @type {number} */ (reader.readInt64()); |
||||||
|
msg.setCount(value); |
||||||
|
break; |
||||||
|
default: |
||||||
|
reader.skipField(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return msg; |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Class method variant: serializes the given message to binary data |
||||||
|
* (in protobuf wire format), writing to the given BinaryWriter. |
||||||
|
* @param {!proto.math.FibReply} message |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.FibReply.serializeBinaryToWriter = function(message, writer) { |
||||||
|
message.serializeBinaryToWriter(writer); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format). |
||||||
|
* @return {!Uint8Array} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.prototype.serializeBinary = function() { |
||||||
|
var writer = new jspb.BinaryWriter(); |
||||||
|
this.serializeBinaryToWriter(writer); |
||||||
|
return writer.getResultBuffer(); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Serializes the message to binary data (in protobuf wire format), |
||||||
|
* writing to the given BinaryWriter. |
||||||
|
* @param {!jspb.BinaryWriter} writer |
||||||
|
*/ |
||||||
|
proto.math.FibReply.prototype.serializeBinaryToWriter = function (writer) { |
||||||
|
var f = undefined; |
||||||
|
f = this.getCount(); |
||||||
|
if (f !== 0) { |
||||||
|
writer.writeInt64( |
||||||
|
1, |
||||||
|
f |
||||||
|
); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a deep clone of this proto. No data is shared with the original. |
||||||
|
* @return {!proto.math.FibReply} The clone. |
||||||
|
*/ |
||||||
|
proto.math.FibReply.prototype.cloneMessage = function() { |
||||||
|
return /** @type {!proto.math.FibReply} */ (jspb.Message.cloneMessage(this)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* optional int64 count = 1; |
||||||
|
* @return {number} |
||||||
|
*/ |
||||||
|
proto.math.FibReply.prototype.getCount = function() { |
||||||
|
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** @param {number} value */ |
||||||
|
proto.math.FibReply.prototype.setCount = function(value) { |
||||||
|
jspb.Message.setField(this, 1, value); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
goog.object.extend(exports, proto.math); |
@ -0,0 +1,37 @@ |
|||||||
|
/* |
||||||
|
* |
||||||
|
* Copyright 2016, 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. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
/* This exists solely to allow the generated code to import the grpc module |
||||||
|
* without using a relative path */ |
||||||
|
|
||||||
|
module.exports = require('../../..'); |
@ -0,0 +1 @@ |
|||||||
|
gens/ |
@ -1,167 +0,0 @@ |
|||||||
|
|
||||||
// Copyright 2015, 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. |
|
||||||
|
|
||||||
// Message definitions to be used by integration test service definitions. |
|
||||||
|
|
||||||
syntax = "proto3"; |
|
||||||
|
|
||||||
package grpc.testing; |
|
||||||
|
|
||||||
// The type of payload that should be returned. |
|
||||||
enum PayloadType { |
|
||||||
// Compressable text format. |
|
||||||
COMPRESSABLE = 0; |
|
||||||
|
|
||||||
// Uncompressable binary format. |
|
||||||
UNCOMPRESSABLE = 1; |
|
||||||
|
|
||||||
// Randomly chosen from all other formats defined in this enum. |
|
||||||
RANDOM = 2; |
|
||||||
} |
|
||||||
|
|
||||||
// Compression algorithms |
|
||||||
enum CompressionType { |
|
||||||
// No compression |
|
||||||
NONE = 0; |
|
||||||
GZIP = 1; |
|
||||||
DEFLATE = 2; |
|
||||||
} |
|
||||||
|
|
||||||
// A block of data, to simply increase gRPC message size. |
|
||||||
message Payload { |
|
||||||
// The type of data in body. |
|
||||||
PayloadType type = 1; |
|
||||||
// Primary contents of payload. |
|
||||||
bytes body = 2; |
|
||||||
} |
|
||||||
|
|
||||||
// A protobuf representation for grpc status. This is used by test |
|
||||||
// clients to specify a status that the server should attempt to return. |
|
||||||
message EchoStatus { |
|
||||||
int32 code = 1; |
|
||||||
string message = 2; |
|
||||||
} |
|
||||||
|
|
||||||
// Unary request. |
|
||||||
message SimpleRequest { |
|
||||||
// Desired payload type in the response from the server. |
|
||||||
// If response_type is RANDOM, server randomly chooses one from other formats. |
|
||||||
PayloadType response_type = 1; |
|
||||||
|
|
||||||
// Desired payload size in the response from the server. |
|
||||||
// If response_type is COMPRESSABLE, this denotes the size before compression. |
|
||||||
int32 response_size = 2; |
|
||||||
|
|
||||||
// Optional input payload sent along with the request. |
|
||||||
Payload payload = 3; |
|
||||||
|
|
||||||
// Whether SimpleResponse should include username. |
|
||||||
bool fill_username = 4; |
|
||||||
|
|
||||||
// Whether SimpleResponse should include OAuth scope. |
|
||||||
bool fill_oauth_scope = 5; |
|
||||||
|
|
||||||
// Compression algorithm to be used by the server for the response (stream) |
|
||||||
CompressionType response_compression = 6; |
|
||||||
|
|
||||||
// Whether server should return a given status |
|
||||||
EchoStatus response_status = 7; |
|
||||||
} |
|
||||||
|
|
||||||
// Unary response, as configured by the request. |
|
||||||
message SimpleResponse { |
|
||||||
// Payload to increase message size. |
|
||||||
Payload payload = 1; |
|
||||||
// The user the request came from, for verifying authentication was |
|
||||||
// successful when the client expected it. |
|
||||||
string username = 2; |
|
||||||
// OAuth scope. |
|
||||||
string oauth_scope = 3; |
|
||||||
} |
|
||||||
|
|
||||||
// Client-streaming request. |
|
||||||
message StreamingInputCallRequest { |
|
||||||
// Optional input payload sent along with the request. |
|
||||||
Payload payload = 1; |
|
||||||
|
|
||||||
// Not expecting any payload from the response. |
|
||||||
} |
|
||||||
|
|
||||||
// Client-streaming response. |
|
||||||
message StreamingInputCallResponse { |
|
||||||
// Aggregated size of payloads received from the client. |
|
||||||
int32 aggregated_payload_size = 1; |
|
||||||
} |
|
||||||
|
|
||||||
// Configuration for a particular response. |
|
||||||
message ResponseParameters { |
|
||||||
// Desired payload sizes in responses from the server. |
|
||||||
// If response_type is COMPRESSABLE, this denotes the size before compression. |
|
||||||
int32 size = 1; |
|
||||||
|
|
||||||
// Desired interval between consecutive responses in the response stream in |
|
||||||
// microseconds. |
|
||||||
int32 interval_us = 2; |
|
||||||
} |
|
||||||
|
|
||||||
// Server-streaming request. |
|
||||||
message StreamingOutputCallRequest { |
|
||||||
// Desired payload type in the response from the server. |
|
||||||
// If response_type is RANDOM, the payload from each response in the stream |
|
||||||
// might be of different types. This is to simulate a mixed type of payload |
|
||||||
// stream. |
|
||||||
PayloadType response_type = 1; |
|
||||||
|
|
||||||
// Configuration for each expected response message. |
|
||||||
repeated ResponseParameters response_parameters = 2; |
|
||||||
|
|
||||||
// Optional input payload sent along with the request. |
|
||||||
Payload payload = 3; |
|
||||||
|
|
||||||
// Compression algorithm to be used by the server for the response (stream) |
|
||||||
CompressionType response_compression = 6; |
|
||||||
|
|
||||||
// Whether server should return a given status |
|
||||||
EchoStatus response_status = 7; |
|
||||||
} |
|
||||||
|
|
||||||
// Server-streaming response, as configured by the request and parameters. |
|
||||||
message StreamingOutputCallResponse { |
|
||||||
// Payload to increase response size. |
|
||||||
Payload payload = 1; |
|
||||||
} |
|
||||||
|
|
||||||
// For reconnect interop test only. |
|
||||||
// Server tells client whether its reconnects are following the spec and the |
|
||||||
// reconnect backoffs it saw. |
|
||||||
message ReconnectInfo { |
|
||||||
bool passed = 1; |
|
||||||
repeated int32 backoff_ms = 2; |
|
||||||
} |
|
@ -1,86 +0,0 @@ |
|||||||
|
|
||||||
// Copyright 2015, 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. |
|
||||||
|
|
||||||
// An integration test service that covers all the method signature permutations |
|
||||||
// of unary/streaming requests/responses. |
|
||||||
|
|
||||||
syntax = "proto3"; |
|
||||||
|
|
||||||
import "tests/interop/empty.proto"; |
|
||||||
import "tests/interop/messages.proto"; |
|
||||||
|
|
||||||
package grpc.testing; |
|
||||||
|
|
||||||
// A simple service to test the various types of RPCs and experiment with |
|
||||||
// performance with various types of payload. |
|
||||||
service TestService { |
|
||||||
// One empty request followed by one empty response. |
|
||||||
rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); |
|
||||||
|
|
||||||
// One request followed by one response. |
|
||||||
rpc UnaryCall(SimpleRequest) returns (SimpleResponse); |
|
||||||
|
|
||||||
// One request followed by a sequence of responses (streamed download). |
|
||||||
// The server returns the payload with client desired type and sizes. |
|
||||||
rpc StreamingOutputCall(StreamingOutputCallRequest) |
|
||||||
returns (stream StreamingOutputCallResponse); |
|
||||||
|
|
||||||
// A sequence of requests followed by one response (streamed upload). |
|
||||||
// The server returns the aggregated size of client payload as the result. |
|
||||||
rpc StreamingInputCall(stream StreamingInputCallRequest) |
|
||||||
returns (StreamingInputCallResponse); |
|
||||||
|
|
||||||
// A sequence of requests with each request served by the server immediately. |
|
||||||
// As one request could lead to multiple responses, this interface |
|
||||||
// demonstrates the idea of full duplexing. |
|
||||||
rpc FullDuplexCall(stream StreamingOutputCallRequest) |
|
||||||
returns (stream StreamingOutputCallResponse); |
|
||||||
|
|
||||||
// A sequence of requests followed by a sequence of responses. |
|
||||||
// The server buffers all the client requests and then serves them in order. A |
|
||||||
// stream of responses are returned to the client when the server starts with |
|
||||||
// first request. |
|
||||||
rpc HalfDuplexCall(stream StreamingOutputCallRequest) |
|
||||||
returns (stream StreamingOutputCallResponse); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
// A simple service NOT implemented at servers so clients can test for |
|
||||||
// that case. |
|
||||||
service UnimplementedService { |
|
||||||
// A call that no server should implement |
|
||||||
rpc UnimplementedCall(grpc.testing.Empty) returns(grpc.testing.Empty); |
|
||||||
} |
|
||||||
|
|
||||||
// A service used to control reconnect server. |
|
||||||
service ReconnectService { |
|
||||||
rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty); |
|
||||||
rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo); |
|
||||||
} |
|
@ -1,33 +0,0 @@ |
|||||||
#!/usr/bin/env ruby |
|
||||||
|
|
||||||
# Copyright 2015, 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. |
|
||||||
|
|
||||||
# Provides a gem binary entry point for the interop client. |
|
||||||
require 'test/client' |
|
@ -1,33 +0,0 @@ |
|||||||
#!/usr/bin/env ruby |
|
||||||
|
|
||||||
# Copyright 2015, 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. |
|
||||||
|
|
||||||
# Provides a gem binary entry point for the interop server |
|
||||||
require 'test/server' |
|
@ -1,50 +0,0 @@ |
|||||||
#!/usr/bin/env ruby |
|
||||||
|
|
||||||
# Copyright 2015, 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. |
|
||||||
|
|
||||||
# ####################################################################### |
|
||||||
# DEPRECATED: The behaviour in this file has been moved to pb/test/server.rb |
|
||||||
# |
|
||||||
# This file remains to support existing tools and scripts that use it. |
|
||||||
# ###################################################################### |
|
||||||
# |
|
||||||
# interop_server is a Testing app that runs a gRPC interop testing server. |
|
||||||
# |
|
||||||
# It helps validate interoperation b/w gRPC in different environments |
|
||||||
# |
|
||||||
# Helps validate interoperation b/w different gRPC implementations. |
|
||||||
# |
|
||||||
# Usage: $ path/to/interop_server.rb --port |
|
||||||
|
|
||||||
this_dir = File.expand_path(File.dirname(__FILE__)) |
|
||||||
pb_dir = File.join(File.dirname(File.dirname(this_dir)), 'pb') |
|
||||||
$LOAD_PATH.unshift(pb_dir) unless $LOAD_PATH.include?(pb_dir) |
|
||||||
|
|
||||||
require 'test/server' |
|
@ -0,0 +1,28 @@ |
|||||||
|
# Generated by the protocol buffer compiler. DO NOT EDIT! |
||||||
|
# source: grpc/testing/metrics.proto |
||||||
|
|
||||||
|
require 'google/protobuf' |
||||||
|
|
||||||
|
Google::Protobuf::DescriptorPool.generated_pool.build do |
||||||
|
add_message "grpc.testing.GaugeResponse" do |
||||||
|
optional :name, :string, 1 |
||||||
|
oneof :value do |
||||||
|
optional :long_value, :int64, 2 |
||||||
|
optional :double_value, :double, 3 |
||||||
|
optional :string_value, :string, 4 |
||||||
|
end |
||||||
|
end |
||||||
|
add_message "grpc.testing.GaugeRequest" do |
||||||
|
optional :name, :string, 1 |
||||||
|
end |
||||||
|
add_message "grpc.testing.EmptyMessage" do |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
module Grpc |
||||||
|
module Testing |
||||||
|
GaugeResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GaugeResponse").msgclass |
||||||
|
GaugeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GaugeRequest").msgclass |
||||||
|
EmptyMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.EmptyMessage").msgclass |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,27 @@ |
|||||||
|
# Generated by the protocol buffer compiler. DO NOT EDIT! |
||||||
|
# Source: grpc/testing/metrics.proto for package 'grpc.testing' |
||||||
|
|
||||||
|
require 'grpc' |
||||||
|
require 'grpc/testing/metrics' |
||||||
|
|
||||||
|
module Grpc |
||||||
|
module Testing |
||||||
|
module MetricsService |
||||||
|
|
||||||
|
# TODO: add proto service documentation here |
||||||
|
class Service |
||||||
|
|
||||||
|
include GRPC::GenericService |
||||||
|
|
||||||
|
self.marshal_class_method = :encode |
||||||
|
self.unmarshal_class_method = :decode |
||||||
|
self.service_name = 'grpc.testing.MetricsService' |
||||||
|
|
||||||
|
rpc :GetAllGauges, EmptyMessage, stream(GaugeResponse) |
||||||
|
rpc :GetGauge, GaugeRequest, GaugeResponse |
||||||
|
end |
||||||
|
|
||||||
|
Stub = Service.rpc_stub_class |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,155 @@ |
|||||||
|
#!/usr/bin/env ruby |
||||||
|
|
||||||
|
# Copyright 2016, 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. |
||||||
|
|
||||||
|
require 'optparse' |
||||||
|
require 'thread' |
||||||
|
require_relative '../pb/test/client' |
||||||
|
require_relative './metrics_server' |
||||||
|
require_relative '../lib/grpc' |
||||||
|
|
||||||
|
class QpsGauge < Gauge |
||||||
|
@query_count |
||||||
|
@query_mutex |
||||||
|
@start_time |
||||||
|
|
||||||
|
def initialize |
||||||
|
@query_count = 0 |
||||||
|
@query_mutex = Mutex.new |
||||||
|
@start_time = Time.now |
||||||
|
end |
||||||
|
|
||||||
|
def increment_queries |
||||||
|
@query_mutex.synchronize { @query_count += 1} |
||||||
|
end |
||||||
|
|
||||||
|
def get_name |
||||||
|
'qps' |
||||||
|
end |
||||||
|
|
||||||
|
def get_type |
||||||
|
'long' |
||||||
|
end |
||||||
|
|
||||||
|
def get_value |
||||||
|
(@query_mutex.synchronize { @query_count / (Time.now - @start_time) }).to_i |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def start_metrics_server(port) |
||||||
|
host = "0.0.0.0:#{port}" |
||||||
|
server = GRPC::RpcServer.new |
||||||
|
server.add_http2_port(host, :this_port_is_insecure) |
||||||
|
service = MetricsServiceImpl.new |
||||||
|
server.handle(service) |
||||||
|
server_thread = Thread.new { server.run_till_terminated } |
||||||
|
[server, service, server_thread] |
||||||
|
end |
||||||
|
|
||||||
|
StressArgs = Struct.new(:server_addresses, :test_cases, :duration, |
||||||
|
:channels_per_server, :concurrent_calls, :metrics_port) |
||||||
|
|
||||||
|
def start(stress_args) |
||||||
|
running = true |
||||||
|
threads = [] |
||||||
|
qps_gauge = QpsGauge.new |
||||||
|
metrics_server, metrics_service, metrics_thread = |
||||||
|
start_metrics_server(stress_args.metrics_port) |
||||||
|
metrics_service.register_gauge(qps_gauge) |
||||||
|
stress_args.server_addresses.each do |address| |
||||||
|
stress_args.channels_per_server.times do |
||||||
|
client_args = Args.new |
||||||
|
client_args.host, client_args.port = address.split(':') |
||||||
|
client_args.secure = false |
||||||
|
client_args.test_case = '' |
||||||
|
stub = create_stub(client_args) |
||||||
|
named_tests = NamedTests.new(stub, client_args) |
||||||
|
stress_args.concurrent_calls.times do |
||||||
|
threads << Thread.new do |
||||||
|
while running |
||||||
|
named_tests.method(stress_args.test_cases.sample).call |
||||||
|
qps_gauge.increment_queries |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
if stress_args.duration >= 0 |
||||||
|
sleep stress_args.duration |
||||||
|
running = false |
||||||
|
metrics_server.stop |
||||||
|
p "QPS: #{qps_gauge.get_value}" |
||||||
|
threads.each { |thd| thd.join; } |
||||||
|
end |
||||||
|
metrics_thread.join |
||||||
|
end |
||||||
|
|
||||||
|
def parse_stress_args |
||||||
|
stress_args = StressArgs.new |
||||||
|
stress_args.server_addresses = ['localhost:8080'] |
||||||
|
stress_args.test_cases = [] |
||||||
|
stress_args.duration = -1 |
||||||
|
stress_args.channels_per_server = 1 |
||||||
|
stress_args.concurrent_calls = 1 |
||||||
|
stress_args.metrics_port = '8081' |
||||||
|
OptionParser.new do |opts| |
||||||
|
opts.on('--server_addresses [LIST]', Array) do |addrs| |
||||||
|
stress_args.server_addresses = addrs |
||||||
|
end |
||||||
|
opts.on('--test_cases cases', Array) do |cases| |
||||||
|
stress_args.test_cases = (cases.map do |item| |
||||||
|
split = item.split(':') |
||||||
|
[split[0]] * split[1].to_i |
||||||
|
end).reduce([], :+) |
||||||
|
end |
||||||
|
opts.on('--test_duration_secs [INT]', OptionParser::DecimalInteger) do |time| |
||||||
|
stress_args.duration = time |
||||||
|
end |
||||||
|
opts.on('--num_channels_per_server [INT]', OptionParser::DecimalInteger) do |channels| |
||||||
|
stress_args.channels_per_server = channels |
||||||
|
end |
||||||
|
opts.on('--num_stubs_per_channel [INT]', OptionParser::DecimalInteger) do |stubs| |
||||||
|
stress_args.concurrent_calls = stubs |
||||||
|
end |
||||||
|
opts.on('--metrics_port [port]') do |port| |
||||||
|
stress_args.metrics_port = port |
||||||
|
end |
||||||
|
end.parse! |
||||||
|
stress_args |
||||||
|
end |
||||||
|
|
||||||
|
def main |
||||||
|
opts = parse_stress_args |
||||||
|
start(opts) |
||||||
|
end |
||||||
|
|
||||||
|
if __FILE__ == $0 |
||||||
|
main |
||||||
|
end |
@ -0,0 +1,294 @@ |
|||||||
|
// Generated by the gRPC protobuf plugin. |
||||||
|
// If you make any local change, they will be lost. |
||||||
|
// source: src/proto/grpc/testing/compiler_test.proto |
||||||
|
// Original file comments: |
||||||
|
// Copyright 2016, 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. |
||||||
|
// |
||||||
|
// File detached comment 1 |
||||||
|
// |
||||||
|
// File detached comment 2 |
||||||
|
// |
||||||
|
// File leading comment 1 |
||||||
|
#ifndef GRPC_src_2fproto_2fgrpc_2ftesting_2fcompiler_5ftest_2eproto__INCLUDED |
||||||
|
#define GRPC_src_2fproto_2fgrpc_2ftesting_2fcompiler_5ftest_2eproto__INCLUDED |
||||||
|
|
||||||
|
#include "src/proto/grpc/testing/compiler_test.pb.h" |
||||||
|
|
||||||
|
#include <grpc++/impl/codegen/async_stream.h> |
||||||
|
#include <grpc++/impl/codegen/async_unary_call.h> |
||||||
|
#include <grpc++/impl/codegen/proto_utils.h> |
||||||
|
#include <grpc++/impl/codegen/rpc_method.h> |
||||||
|
#include <grpc++/impl/codegen/service_type.h> |
||||||
|
#include <grpc++/impl/codegen/status.h> |
||||||
|
#include <grpc++/impl/codegen/stub_options.h> |
||||||
|
#include <grpc++/impl/codegen/sync_stream.h> |
||||||
|
|
||||||
|
namespace grpc { |
||||||
|
class CompletionQueue; |
||||||
|
class Channel; |
||||||
|
class RpcService; |
||||||
|
class ServerCompletionQueue; |
||||||
|
class ServerContext; |
||||||
|
} // namespace grpc |
||||||
|
|
||||||
|
namespace grpc { |
||||||
|
namespace testing { |
||||||
|
|
||||||
|
// ServiceA detached comment 1 |
||||||
|
// |
||||||
|
// ServiceA detached comment 2 |
||||||
|
// |
||||||
|
// ServiceA leading comment 1 |
||||||
|
class ServiceA GRPC_FINAL { |
||||||
|
public: |
||||||
|
class StubInterface { |
||||||
|
public: |
||||||
|
virtual ~StubInterface() {} |
||||||
|
// MethodA1 leading comment 1 |
||||||
|
virtual ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) = 0; |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq)); |
||||||
|
} |
||||||
|
// MethodA1 trailing comment 1 |
||||||
|
// MethodA2 detached leading comment 1 |
||||||
|
// |
||||||
|
// Method A2 leading comment 1 |
||||||
|
// Method A2 leading comment 2 |
||||||
|
std::unique_ptr< ::grpc::ClientWriterInterface< ::grpc::testing::Request>> MethodA2(::grpc::ClientContext* context, ::grpc::testing::Response* response) { |
||||||
|
return std::unique_ptr< ::grpc::ClientWriterInterface< ::grpc::testing::Request>>(MethodA2Raw(context, response)); |
||||||
|
} |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>> AsyncMethodA2(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>>(AsyncMethodA2Raw(context, response, cq, tag)); |
||||||
|
} |
||||||
|
// MethodA2 trailing comment 1 |
||||||
|
private: |
||||||
|
virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0; |
||||||
|
virtual ::grpc::ClientWriterInterface< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) = 0; |
||||||
|
virtual ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) = 0; |
||||||
|
}; |
||||||
|
class Stub GRPC_FINAL : public StubInterface { |
||||||
|
public: |
||||||
|
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); |
||||||
|
::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq)); |
||||||
|
} |
||||||
|
std::unique_ptr< ::grpc::ClientWriter< ::grpc::testing::Request>> MethodA2(::grpc::ClientContext* context, ::grpc::testing::Response* response) { |
||||||
|
return std::unique_ptr< ::grpc::ClientWriter< ::grpc::testing::Request>>(MethodA2Raw(context, response)); |
||||||
|
} |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncWriter< ::grpc::testing::Request>> AsyncMethodA2(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncWriter< ::grpc::testing::Request>>(AsyncMethodA2Raw(context, response, cq, tag)); |
||||||
|
} |
||||||
|
|
||||||
|
private: |
||||||
|
std::shared_ptr< ::grpc::ChannelInterface> channel_; |
||||||
|
::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; |
||||||
|
::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) GRPC_OVERRIDE; |
||||||
|
::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; |
||||||
|
const ::grpc::RpcMethod rpcmethod_MethodA1_; |
||||||
|
const ::grpc::RpcMethod rpcmethod_MethodA2_; |
||||||
|
}; |
||||||
|
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); |
||||||
|
|
||||||
|
class Service : public ::grpc::Service { |
||||||
|
public: |
||||||
|
Service(); |
||||||
|
virtual ~Service(); |
||||||
|
// MethodA1 leading comment 1 |
||||||
|
virtual ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response); |
||||||
|
// MethodA1 trailing comment 1 |
||||||
|
// MethodA2 detached leading comment 1 |
||||||
|
// |
||||||
|
// Method A2 leading comment 1 |
||||||
|
// Method A2 leading comment 2 |
||||||
|
virtual ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response); |
||||||
|
// MethodA2 trailing comment 1 |
||||||
|
}; |
||||||
|
template <class BaseClass> |
||||||
|
class WithAsyncMethod_MethodA1 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithAsyncMethod_MethodA1() { |
||||||
|
::grpc::Service::MarkMethodAsync(0); |
||||||
|
} |
||||||
|
~WithAsyncMethod_MethodA1() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
void RequestMethodA1(::grpc::ServerContext* context, ::grpc::testing::Request* request, ::grpc::ServerAsyncResponseWriter< ::grpc::testing::Response>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { |
||||||
|
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); |
||||||
|
} |
||||||
|
}; |
||||||
|
template <class BaseClass> |
||||||
|
class WithAsyncMethod_MethodA2 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithAsyncMethod_MethodA2() { |
||||||
|
::grpc::Service::MarkMethodAsync(1); |
||||||
|
} |
||||||
|
~WithAsyncMethod_MethodA2() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
void RequestMethodA2(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< ::grpc::testing::Response, ::grpc::testing::Request>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { |
||||||
|
::grpc::Service::RequestAsyncClientStreaming(1, context, reader, new_call_cq, notification_cq, tag); |
||||||
|
} |
||||||
|
}; |
||||||
|
typedef WithAsyncMethod_MethodA1<WithAsyncMethod_MethodA2<Service > > AsyncService; |
||||||
|
template <class BaseClass> |
||||||
|
class WithGenericMethod_MethodA1 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithGenericMethod_MethodA1() { |
||||||
|
::grpc::Service::MarkMethodGeneric(0); |
||||||
|
} |
||||||
|
~WithGenericMethod_MethodA1() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
}; |
||||||
|
template <class BaseClass> |
||||||
|
class WithGenericMethod_MethodA2 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithGenericMethod_MethodA2() { |
||||||
|
::grpc::Service::MarkMethodGeneric(1); |
||||||
|
} |
||||||
|
~WithGenericMethod_MethodA2() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
// ServiceB leading comment 1 |
||||||
|
class ServiceB GRPC_FINAL { |
||||||
|
public: |
||||||
|
class StubInterface { |
||||||
|
public: |
||||||
|
virtual ~StubInterface() {} |
||||||
|
// MethodB1 leading comment 1 |
||||||
|
virtual ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) = 0; |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq)); |
||||||
|
} |
||||||
|
// MethodB1 trailing comment 1 |
||||||
|
private: |
||||||
|
virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0; |
||||||
|
}; |
||||||
|
class Stub GRPC_FINAL : public StubInterface { |
||||||
|
public: |
||||||
|
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); |
||||||
|
::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; |
||||||
|
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { |
||||||
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq)); |
||||||
|
} |
||||||
|
|
||||||
|
private: |
||||||
|
std::shared_ptr< ::grpc::ChannelInterface> channel_; |
||||||
|
::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; |
||||||
|
const ::grpc::RpcMethod rpcmethod_MethodB1_; |
||||||
|
}; |
||||||
|
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); |
||||||
|
|
||||||
|
class Service : public ::grpc::Service { |
||||||
|
public: |
||||||
|
Service(); |
||||||
|
virtual ~Service(); |
||||||
|
// MethodB1 leading comment 1 |
||||||
|
virtual ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response); |
||||||
|
// MethodB1 trailing comment 1 |
||||||
|
}; |
||||||
|
template <class BaseClass> |
||||||
|
class WithAsyncMethod_MethodB1 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithAsyncMethod_MethodB1() { |
||||||
|
::grpc::Service::MarkMethodAsync(0); |
||||||
|
} |
||||||
|
~WithAsyncMethod_MethodB1() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
void RequestMethodB1(::grpc::ServerContext* context, ::grpc::testing::Request* request, ::grpc::ServerAsyncResponseWriter< ::grpc::testing::Response>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { |
||||||
|
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); |
||||||
|
} |
||||||
|
}; |
||||||
|
typedef WithAsyncMethod_MethodB1<Service > AsyncService; |
||||||
|
template <class BaseClass> |
||||||
|
class WithGenericMethod_MethodB1 : public BaseClass { |
||||||
|
private: |
||||||
|
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||||
|
public: |
||||||
|
WithGenericMethod_MethodB1() { |
||||||
|
::grpc::Service::MarkMethodGeneric(0); |
||||||
|
} |
||||||
|
~WithGenericMethod_MethodB1() GRPC_OVERRIDE { |
||||||
|
BaseClassMustBeDerivedFromService(this); |
||||||
|
} |
||||||
|
// disable synchronous version of this method |
||||||
|
::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { |
||||||
|
abort(); |
||||||
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||||
|
} |
||||||
|
}; |
||||||
|
}; |
||||||
|
// ServiceB trailing comment 1 |
||||||
|
|
||||||
|
} // namespace testing |
||||||
|
} // namespace grpc |
||||||
|
|
||||||
|
|
||||||
|
#endif // GRPC_src_2fproto_2fgrpc_2ftesting_2fcompiler_5ftest_2eproto__INCLUDED |
@ -0,0 +1,64 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, 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 <fstream> |
||||||
|
#include <sstream> |
||||||
|
|
||||||
|
#include <gtest/gtest.h> |
||||||
|
|
||||||
|
// These paths rely on the fact that we run our tests under grpc/
|
||||||
|
const char kGeneratedFilePath[] = |
||||||
|
"gens/src/proto/grpc/testing/compiler_test.grpc.pb.h"; |
||||||
|
const char kGoldenFilePath[] = "test/cpp/codegen/compiler_test_golden"; |
||||||
|
|
||||||
|
TEST(GoldenFileTest, TestGeneratedFile) { |
||||||
|
std::ifstream generated(kGeneratedFilePath); |
||||||
|
std::ifstream golden(kGoldenFilePath); |
||||||
|
|
||||||
|
ASSERT_TRUE(generated.good()); |
||||||
|
ASSERT_TRUE(golden.good()); |
||||||
|
|
||||||
|
std::ostringstream gen_oss; |
||||||
|
std::ostringstream gold_oss; |
||||||
|
gen_oss << generated.rdbuf(); |
||||||
|
gold_oss << golden.rdbuf(); |
||||||
|
EXPECT_EQ(gold_oss.str(), gen_oss.str()); |
||||||
|
|
||||||
|
generated.close(); |
||||||
|
golden.close(); |
||||||
|
} |
||||||
|
|
||||||
|
int main(int argc, char **argv) { |
||||||
|
::testing::InitGoogleTest(&argc, argv); |
||||||
|
return RUN_ALL_TESTS(); |
||||||
|
} |
@ -0,0 +1,168 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{57ABD9A2-CE8E-CCA7-5171-35C4534F3595}</ProjectGuid> |
||||||
|
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||||
|
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v100</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v110</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v120</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v140</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\protoc.props" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||||
|
<TargetName>grpc_node_plugin</TargetName> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||||
|
<TargetName>grpc_node_plugin</TargetName> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\src\compiler\node_plugin.cc"> |
||||||
|
</ClCompile> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj"> |
||||||
|
<Project>{B6E81D84-2ACB-41B8-8781-493A944C7817}</Project> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||||
|
<PropertyGroup> |
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||||
|
</PropertyGroup> |
||||||
|
</Target> |
||||||
|
</Project> |
||||||
|
|
@ -0,0 +1,18 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\src\compiler\node_plugin.cc"> |
||||||
|
<Filter>src\compiler</Filter> |
||||||
|
</ClCompile> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<Filter Include="src"> |
||||||
|
<UniqueIdentifier>{089d5d6b-d438-dc98-b30f-bd608e3bbb78}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="src\compiler"> |
||||||
|
<UniqueIdentifier>{1cc34440-c001-7578-c4d3-78f5d98fb602}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
</ItemGroup> |
||||||
|
</Project> |
||||||
|
|
@ -0,0 +1,206 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectGuid>{0ECDE365-D634-4E15-099F-40A38E151C65}</ProjectGuid> |
||||||
|
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||||
|
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v100</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v110</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v120</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||||
|
<PlatformToolset>v140</PlatformToolset> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\cpptest.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||||
|
<TargetName>golden_file_test</TargetName> |
||||||
|
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||||
|
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||||
|
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||||
|
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||||
|
<TargetName>golden_file_test</TargetName> |
||||||
|
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||||
|
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||||
|
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||||
|
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>Disabled</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<Optimization>MaxSpeed</Optimization> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||||
|
<TreatWarningAsError>true</TreatWarningAsError> |
||||||
|
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||||
|
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||||
|
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\compiler_test.pb.cc"> |
||||||
|
</ClCompile> |
||||||
|
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\compiler_test.pb.h"> |
||||||
|
</ClInclude> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\compiler_test.grpc.pb.cc"> |
||||||
|
</ClCompile> |
||||||
|
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\compiler_test.grpc.pb.h"> |
||||||
|
</ClInclude> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\test\cpp\codegen\golden_file_test.cc"> |
||||||
|
</ClCompile> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> |
||||||
|
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||||
|
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||||
|
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="packages.config" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||||
|
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||||
|
</ImportGroup> |
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||||
|
<PropertyGroup> |
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||||
|
</PropertyGroup> |
||||||
|
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||||
|
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||||
|
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||||
|
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||||
|
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||||
|
</Target> |
||||||
|
</Project> |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\compiler_test.proto"> |
||||||
|
<Filter>src\proto\grpc\testing</Filter> |
||||||
|
</ClCompile> |
||||||
|
<ClCompile Include="$(SolutionDir)\..\test\cpp\codegen\golden_file_test.cc"> |
||||||
|
<Filter>test\cpp\codegen</Filter> |
||||||
|
</ClCompile> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<Filter Include="src"> |
||||||
|
<UniqueIdentifier>{cd916cf8-bce0-7051-b6d4-e1cd0bf3894c}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="src\proto"> |
||||||
|
<UniqueIdentifier>{a2d414fe-b561-a38e-58a9-40d8bc68a107}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="src\proto\grpc"> |
||||||
|
<UniqueIdentifier>{edbc155a-ceb8-62b4-2b73-37228e5fa736}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="src\proto\grpc\testing"> |
||||||
|
<UniqueIdentifier>{761a3503-8934-4ee6-8bf1-77ba1385baa7}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="test"> |
||||||
|
<UniqueIdentifier>{4f08cfc5-a59d-7cb4-9ef5-a603b2025936}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="test\cpp"> |
||||||
|
<UniqueIdentifier>{af281cac-e23b-109b-8e63-c7cff85c81f4}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
<Filter Include="test\cpp\codegen"> |
||||||
|
<UniqueIdentifier>{e105f656-566f-3d70-fbe5-e03fee8e612d}</UniqueIdentifier> |
||||||
|
</Filter> |
||||||
|
</ItemGroup> |
||||||
|
</Project> |
||||||
|
|
Loading…
Reference in new issue