Merge github.com:grpc/grpc into we-dont-need-no-backup

Conflicts:
	tools/doxygen/Doxyfile.core.internal
This commit is contained in:
Craig Tiller 2015-06-04 08:44:53 -07:00
commit 73e0e6cf8b
15 changed files with 39 additions and 37 deletions

View File

@ -1,16 +1,22 @@
# Node.js gRPC Library
## Status
Alpha : Ready for early adopters
## Prerequisites
## PREREQUISITES
- `node`: This requires `node` to be installed. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package.
- [homebrew][] on Mac OS X, [linuxbrew][] on Linux. These simplify the installation of the gRPC C core.
This requires `node` to be installed. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package.
## INSTALLATION
On Mac OS X, install [homebrew][]. On Linux, install [linuxbrew][].
Run the following command to install gRPC Node.js.
```sh
$ curl -fsSL https://goo.gl/getgrpc | bash -s nodejs
```
This will download and run the [gRPC install script][], then install the latest version of gRPC Nodejs npm package.
## Installation
1. Clone [the grpc repository](https://github.com/grpc/grpc).
## BUILD FROM SOURCE
1. Clone [the grpc Git Repository](https://github.com/grpc/grpc).
2. Follow the instructions in the `INSTALL` file in the root of that repository to install the C core library that this package depends on.
3. Run `npm install`.
@ -20,12 +26,10 @@ If you install the gRPC C core library in a custom location, then you need to se
CXXFLAGS=-I<custom location>/include LDFLAGS=-L<custom location>/lib npm install [grpc]
```
## Tests
## TESTING
To run the test suite, simply run `npm test` in the install location.
## API
This library internally uses [ProtoBuf.js](https://github.com/dcodeIO/ProtoBuf.js), and some structures it exports match those exported by that library
If you require this module, you will get an object with the following members
@ -82,3 +86,7 @@ ServerCredentials
```
An object with factory methods fro creating credential objects for servers.
[homebrew]:http://brew.sh
[linuxbrew]:https://github.com/Homebrew/linuxbrew#installation
[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install

View File

@ -36,7 +36,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var async = require('async');
var pbjs = require('protobufjs/cli/pbjs');
var parseArgs = require('minimist');

View File

@ -35,7 +35,7 @@
var grpc = require('..');
var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing;
var _ = require('underscore');
var _ = require('lodash');
var interop_server = require('../interop/interop_server.js');
function runTest(iterations, callback) {

View File

@ -37,7 +37,7 @@ var async = require('async');
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/route_guide.proto').examples;
var client = new examples.RouteGuide('localhost:50051');

View File

@ -36,7 +36,7 @@
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/route_guide.proto').examples;

View File

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/stock.proto').examples;

View File

@ -36,6 +36,7 @@
#include <node.h>
#include <nan.h>
#include "grpc/grpc.h"
#include "grpc/byte_buffer_reader.h"
#include "grpc/support/slice.h"
#include "byte_buffer.h"
@ -69,9 +70,10 @@ Handle<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
size_t length = grpc_byte_buffer_length(buffer);
char *result = reinterpret_cast<char *>(calloc(length, sizeof(char)));
size_t offset = 0;
grpc_byte_buffer_reader *reader = grpc_byte_buffer_reader_create(buffer);
grpc_byte_buffer_reader reader;
grpc_byte_buffer_reader_init(&reader, buffer);
gpr_slice next;
while (grpc_byte_buffer_reader_next(reader, &next) != 0) {
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
memcpy(result + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next));
offset += GPR_SLICE_LENGTH(next);
}

View File

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var ProtoBuf = require('protobufjs');

View File

@ -35,7 +35,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
var GoogleAuth = require('google-auth-library');

View File

@ -35,7 +35,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
var Server = grpc.buildServer([testProto.TestService.service]);

View File

@ -25,10 +25,9 @@
},
"dependencies": {
"bindings": "^1.2.0",
"lodash": "^3.9.3",
"nan": "^1.5.0",
"protobufjs": "dcodeIO/ProtoBuf.js",
"underscore": "^1.6.0",
"underscore.string": "^3.0.0"
"protobufjs": "dcodeIO/ProtoBuf.js"
},
"devDependencies": {
"async": "^0.9.0",

View File

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('bindings')('grpc.node');

View File

@ -33,10 +33,7 @@
'use strict';
var _ = require('underscore');
var capitalize = require('underscore.string/capitalize');
var decapitalize = require('underscore.string/decapitalize');
var _ = require('lodash');
/**
* Get a function that deserializes a specific type of protobuf.
@ -81,7 +78,7 @@ function fullyQualifiedName(value) {
}
var name = value.name;
if (value.className === 'Service.RPCMethod') {
name = capitalize(name);
name = _.capitalize(name);
}
if (value.hasOwnProperty('parent')) {
var parent_name = fullyQualifiedName(value.parent);
@ -118,8 +115,8 @@ function wrapIgnoreNull(func) {
function getProtobufServiceAttrs(service) {
var prefix = '/' + fullyQualifiedName(service) + '/';
return _.object(_.map(service.children, function(method) {
return [decapitalize(method.name), {
path: prefix + capitalize(method.name),
return [_.camelCase(method.name), {
path: prefix + _.capitalize(method.name),
requestStream: method.requestStream,
responseStream: method.responseStream,
requestSerialize: serializeCls(method.resolvedRequestType.build()),

View File

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('bindings')('grpc.node');
@ -48,8 +48,6 @@ var util = require('util');
var EventEmitter = require('events').EventEmitter;
var common = require('./common.js');
/**
* Handle an error on a call by sending it as a status
* @param {grpc.Call} call The call to send the error on

View File

@ -45,9 +45,7 @@ var math_proto = ProtoBuf.loadProtoFile(__dirname + '/../examples/math.proto');
var mathService = math_proto.lookup('math.Math');
var capitalize = require('underscore.string/capitalize');
var _ = require('underscore');
var _ = require('lodash');
describe('File loader', function() {
it('Should load a proto file by default', function() {
@ -159,7 +157,7 @@ describe('Generic client and server', function() {
server = new Server({
string: {
capitalize: function(call, callback) {
callback(null, capitalize(call.request));
callback(null, _.capitalize(call.request));
}
}
});