diff options
author | murgatroid99 <mlumish@google.com> | 2015-08-17 14:00:31 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-08-17 14:00:31 -0700 |
commit | 4a1474f12f106123462cfcaf92c3c2e22a0b1404 (patch) | |
tree | b005d8a87fed2cd01e57c640dd32648f58fbf2f0 /src/node | |
parent | 0636d7bb8d8008ac09d09bb8859dee3f98aebaac (diff) |
Moved write flag constants to base module
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/ext/call.cc | 4 | ||||
-rw-r--r-- | src/node/ext/node_grpc.cc | 11 | ||||
-rw-r--r-- | src/node/index.js | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 3256f41dc7..a720f9eed6 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -464,10 +464,6 @@ void Call::Init(Handle<Object> exports) { NanNew<FunctionTemplate>(GetPeer)->GetFunction()); NanAssignPersistent(fun_tpl, tpl); Handle<Function> ctr = tpl->GetFunction(); - ctr->Set(NanNew("WRITE_BUFFER_HINT"), - NanNew<Uint32, uint32_t>(GRPC_WRITE_BUFFER_HINT)); - ctr->Set(NanNew("WRITE_NO_COMPRESS"), - NanNew<Uint32, uint32_t>(GRPC_WRITE_NO_COMPRESS)); exports->Set(NanNew("Call"), ctr); constructor = new NanCallback(ctr); } diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index d93dafda79..0cf30da922 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -196,6 +196,16 @@ void InitConnectivityStateConstants(Handle<Object> exports) { channel_state->Set(NanNew("FATAL_FAILURE"), FATAL_FAILURE); } +void InitWriteFlags(Handle<Object> exports) { + NanScope(); + Handle<Object> write_flags = NanNew<Object>(); + exports->Set(NanNew("writeFlags"), write_flags); + Handle<Value> BUFFER_HINT(NanNew<Uint32, uint32_t>(GRPC_WRITE_BUFFER_HINT)); + write_flags->Set(NanNew("BUFFER_HINT"), BUFFER_HINT); + Handle<Value> NO_COMPRESS(NanNew<Uint32, uint32_t>(GRPC_WRITE_NO_COMPRESS)); + write_flags->Set(NanNew("NO_COMPRESS"), NO_COMPRESS); +} + void init(Handle<Object> exports) { NanScope(); grpc_init(); @@ -204,6 +214,7 @@ void init(Handle<Object> exports) { InitOpTypeConstants(exports); InitPropagateConstants(exports); InitConnectivityStateConstants(exports); + InitWriteFlags(exports); grpc::node::Call::Init(exports); grpc::node::Channel::Init(exports); diff --git a/src/node/index.js b/src/node/index.js index 93c65ac5c4..889b0ac0e9 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -145,6 +145,11 @@ exports.propagate = grpc.propagate; exports.callError = grpc.callError; /** + * Write flag name to code number mapping + */ +exports.writeFlags = grpc.writeFlags; + +/** * Credentials factories */ exports.Credentials = grpc.Credentials; |