Merge remote-tracking branch 'upstream/master' into pubsub

pull/882/head
Yang Gao 10 years ago
commit 91cc48160a
  1. 25
      .travis.yml
  2. 238
      Makefile
  3. 50
      build.json
  4. 6
      examples/pubsub/publisher.h
  5. 6
      examples/pubsub/subscriber.h
  6. 6
      include/grpc++/async_unary_call.h
  7. 6
      include/grpc++/channel_arguments.h
  8. 6
      include/grpc++/channel_interface.h
  9. 6
      include/grpc++/client_context.h
  10. 6
      include/grpc++/completion_queue.h
  11. 6
      include/grpc++/config.h
  12. 6
      include/grpc++/create_channel.h
  13. 6
      include/grpc++/credentials.h
  14. 6
      include/grpc++/impl/call.h
  15. 6
      include/grpc++/impl/client_unary_call.h
  16. 6
      include/grpc++/impl/internal_stub.h
  17. 6
      include/grpc++/impl/rpc_method.h
  18. 6
      include/grpc++/impl/rpc_service_method.h
  19. 6
      include/grpc++/impl/service_type.h
  20. 6
      include/grpc++/server.h
  21. 6
      include/grpc++/server_builder.h
  22. 6
      include/grpc++/server_context.h
  23. 6
      include/grpc++/server_credentials.h
  24. 6
      include/grpc++/status.h
  25. 79
      include/grpc++/status_code_enum.h
  26. 6
      include/grpc++/stream.h
  27. 6
      include/grpc++/thread_pool_interface.h
  28. 6
      include/grpc/byte_buffer.h
  29. 6
      include/grpc/byte_buffer_reader.h
  30. 6
      include/grpc/grpc.h
  31. 6
      include/grpc/grpc_http.h
  32. 6
      include/grpc/grpc_security.h
  33. 79
      include/grpc/status.h
  34. 6
      include/grpc/support/alloc.h
  35. 6
      include/grpc/support/atm.h
  36. 6
      include/grpc/support/atm_gcc_atomic.h
  37. 6
      include/grpc/support/atm_gcc_sync.h
  38. 6
      include/grpc/support/atm_win32.h
  39. 6
      include/grpc/support/cancellable_platform.h
  40. 6
      include/grpc/support/cmdline.h
  41. 6
      include/grpc/support/cpu.h
  42. 6
      include/grpc/support/histogram.h
  43. 6
      include/grpc/support/host_port.h
  44. 6
      include/grpc/support/log.h
  45. 6
      include/grpc/support/log_win32.h
  46. 6
      include/grpc/support/port_platform.h
  47. 6
      include/grpc/support/slice.h
  48. 6
      include/grpc/support/slice_buffer.h
  49. 6
      include/grpc/support/sync.h
  50. 6
      include/grpc/support/sync_generic.h
  51. 6
      include/grpc/support/sync_posix.h
  52. 6
      include/grpc/support/sync_win32.h
  53. 6
      include/grpc/support/thd.h
  54. 6
      include/grpc/support/time.h
  55. 6
      include/grpc/support/useful.h
  56. 16
      src/compiler/cpp_generator.cc
  57. 6
      src/compiler/cpp_generator.h
  58. 6
      src/compiler/cpp_generator_helpers.h
  59. 6
      src/compiler/generator_helpers.h
  60. 204
      src/compiler/python_generator.cc
  61. 6
      src/compiler/python_generator.h
  62. 6
      src/compiler/ruby_generator.h
  63. 6
      src/compiler/ruby_generator_helpers-inl.h
  64. 6
      src/compiler/ruby_generator_map-inl.h
  65. 6
      src/compiler/ruby_generator_string-inl.h
  66. 6
      src/core/channel/census_filter.h
  67. 6
      src/core/channel/channel_args.h
  68. 2
      src/core/channel/channel_stack.c
  69. 10
      src/core/channel/channel_stack.h
  70. 6
      src/core/channel/child_channel.h
  71. 6
      src/core/channel/client_channel.h
  72. 6
      src/core/channel/client_setup.h
  73. 4
      src/core/channel/connected_channel.c
  74. 6
      src/core/channel/connected_channel.h
  75. 6
      src/core/channel/http_client_filter.h
  76. 6
      src/core/channel/http_filter.h
  77. 6
      src/core/channel/http_server_filter.h
  78. 6
      src/core/channel/metadata_buffer.h
  79. 6
      src/core/channel/noop_filter.h
  80. 6
      src/core/compression/algorithm.h
  81. 6
      src/core/compression/message_compress.h
  82. 65
      src/core/debug/trace.c
  83. 29
      src/core/debug/trace.h
  84. 6
      src/core/httpcli/format_request.h
  85. 6
      src/core/httpcli/httpcli.h
  86. 6
      src/core/httpcli/httpcli_security_context.h
  87. 6
      src/core/httpcli/parser.h
  88. 6
      src/core/iomgr/alarm.h
  89. 6
      src/core/iomgr/alarm_heap.h
  90. 6
      src/core/iomgr/alarm_internal.h
  91. 6
      src/core/iomgr/endpoint.h
  92. 6
      src/core/iomgr/endpoint_pair.h
  93. 6
      src/core/iomgr/fd_posix.h
  94. 6
      src/core/iomgr/iocp_windows.h
  95. 6
      src/core/iomgr/iomgr.h
  96. 6
      src/core/iomgr/iomgr_internal.h
  97. 3
      src/core/iomgr/iomgr_posix.c
  98. 6
      src/core/iomgr/iomgr_posix.h
  99. 6
      src/core/iomgr/pollset.h
  100. 6
      src/core/iomgr/pollset_kick.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,14 +1,23 @@
language: cpp language: cpp
before_install: before_install:
- sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:yjwong/gflags -y
- sudo add-apt-repository ppa:h-rayflood/llvm -y
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5
env:
global:
- RUBY_VERSION=2.1
matrix:
- CONFIG=dbg TEST=c
- CONFIG=dbg TEST=c++
- CONFIG=opt TEST=c
- CONFIG=opt TEST=c++
- CONFIG=opt TEST=node
- CONFIG=opt TEST=ruby
- CONFIG=opt TEST=python
script: script:
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c dbg -s 2.0 - rvm use $RUBY_VERSION
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c dbg -s 2.0 - gem install bundler
- make clean - ./tools/run_tests/run_tests.py -l $TEST -t -j 16 -c $CONFIG -s 4.0
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c opt -s 2.0
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c opt -s 2.0
- ./tools/run_tests/run_tests.py -l node -t -j 16 -c opt
notifications: notifications:
email: false email: false

File diff suppressed because one or more lines are too long

@ -79,6 +79,7 @@
"src/core/surface/client.h", "src/core/surface/client.h",
"src/core/surface/completion_queue.h", "src/core/surface/completion_queue.h",
"src/core/surface/event_string.h", "src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h", "src/core/surface/lame_client.h",
"src/core/surface/server.h", "src/core/surface/server.h",
"src/core/surface/surface_trace.h", "src/core/surface/surface_trace.h",
@ -180,6 +181,7 @@
"src/core/surface/server.c", "src/core/surface/server.c",
"src/core/surface/server_chttp2.c", "src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c", "src/core/surface/server_create.c",
"src/core/surface/surface_trace.c",
"src/core/transport/chttp2/alpn.c", "src/core/transport/chttp2/alpn.c",
"src/core/transport/chttp2/bin_encoder.c", "src/core/transport/chttp2/bin_encoder.c",
"src/core/transport/chttp2/frame_data.c", "src/core/transport/chttp2/frame_data.c",
@ -329,6 +331,7 @@
"src/core/security/secure_transport_setup.c", "src/core/security/secure_transport_setup.c",
"src/core/security/security_context.c", "src/core/security/security_context.c",
"src/core/security/server_secure_chttp2.c", "src/core/security/server_secure_chttp2.c",
"src/core/surface/init_secure.c",
"src/core/surface/secure_channel_create.c", "src/core/surface/secure_channel_create.c",
"src/core/surface/secure_server_create.c", "src/core/surface/secure_server_create.c",
"src/core/tsi/fake_transport_security.c", "src/core/tsi/fake_transport_security.c",
@ -372,6 +375,9 @@
"name": "grpc_unsecure", "name": "grpc_unsecure",
"build": "all", "build": "all",
"language": "c", "language": "c",
"src": [
"src/core/surface/init_unsecure.c"
],
"deps": [ "deps": [
"gpr" "gpr"
], ],
@ -572,6 +578,7 @@
}, },
{ {
"name": "census_statistics_multiple_writers_circular_buffer_test", "name": "census_statistics_multiple_writers_circular_buffer_test",
"flaky": true,
"build": "test", "build": "test",
"language": "c", "language": "c",
"src": [ "src": [
@ -628,6 +635,7 @@
}, },
{ {
"name": "census_statistics_small_log_test", "name": "census_statistics_small_log_test",
"flaky": true,
"build": "test", "build": "test",
"language": "c", "language": "c",
"src": [ "src": [
@ -866,8 +874,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "fling_test", "name": "fling_test",
@ -881,8 +888,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "gen_hpack_tables", "name": "gen_hpack_tables",
@ -1816,6 +1822,24 @@
"gpr" "gpr"
] ]
}, },
{
"name": "qps_client_async",
"build": "test",
"run": false,
"language": "c++",
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/client_async.cc"
],
"deps": [
"grpc++_test_util",
"grpc_test_util",
"grpc++",
"grpc",
"gpr_test_util",
"gpr"
]
},
{ {
"name": "qps_server", "name": "qps_server",
"build": "test", "build": "test",
@ -1834,6 +1858,24 @@
"gpr" "gpr"
] ]
}, },
{
"name": "qps_server_async",
"build": "test",
"run": false,
"language": "c++",
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/server_async.cc"
],
"deps": [
"grpc++_test_util",
"grpc_test_util",
"grpc++",
"grpc",
"gpr_test_util",
"gpr"
]
},
{ {
"name": "status_test", "name": "status_test",
"build": "test", "build": "test",

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ #ifndef GRPC_EXAMPLES_PUBSUB_PUBLISHER_H
#define __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ #define GRPC_EXAMPLES_PUBSUB_PUBLISHER_H
#include <grpc++/channel_interface.h> #include <grpc++/channel_interface.h>
#include <grpc++/status.h> #include <grpc++/status.h>
@ -64,4 +64,4 @@ class Publisher {
} // namespace examples } // namespace examples
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ #endif // GRPC_EXAMPLES_PUBSUB_PUBLISHER_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ #ifndef GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H
#define __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ #define GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H
#include <grpc++/channel_interface.h> #include <grpc++/channel_interface.h>
#include <grpc++/status.h> #include <grpc++/status.h>
@ -65,4 +65,4 @@ class Subscriber {
} // namespace examples } // namespace examples
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ #endif // GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_ASYNC_UNARY_CALL_H__ #ifndef GRPCXX_ASYNC_UNARY_CALL_H
#define __GRPCPP_ASYNC_UNARY_CALL_H__ #define GRPCXX_ASYNC_UNARY_CALL_H
#include <grpc++/channel_interface.h> #include <grpc++/channel_interface.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
@ -138,4 +138,4 @@ class ServerAsyncResponseWriter GRPC_FINAL
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_ASYNC_UNARY_CALL_H__ #endif // GRPCXX_ASYNC_UNARY_CALL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CHANNEL_ARGUMENTS_H_ #ifndef GRPCXX_CHANNEL_ARGUMENTS_H
#define __GRPCPP_CHANNEL_ARGUMENTS_H_ #define GRPCXX_CHANNEL_ARGUMENTS_H
#include <vector> #include <vector>
#include <list> #include <list>
@ -82,4 +82,4 @@ class ChannelArguments {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ #endif // GRPCXX_CHANNEL_ARGUMENTS_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CHANNEL_INTERFACE_H__ #ifndef GRPCXX_CHANNEL_INTERFACE_H
#define __GRPCPP_CHANNEL_INTERFACE_H__ #define GRPCXX_CHANNEL_INTERFACE_H
#include <grpc++/status.h> #include <grpc++/status.h>
#include <grpc++/impl/call.h> #include <grpc++/impl/call.h>
@ -63,4 +63,4 @@ class ChannelInterface : public CallHook {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CHANNEL_INTERFACE_H__ #endif // GRPCXX_CHANNEL_INTERFACE_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CLIENT_CONTEXT_H__ #ifndef GRPCXX_CLIENT_CONTEXT_H
#define __GRPCPP_CLIENT_CONTEXT_H__ #define GRPCXX_CLIENT_CONTEXT_H
#include <chrono> #include <chrono>
#include <map> #include <map>
@ -151,4 +151,4 @@ class ClientContext {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CLIENT_CONTEXT_H__ #endif // GRPCXX_CLIENT_CONTEXT_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_COMPLETION_QUEUE_H__ #ifndef GRPCXX_COMPLETION_QUEUE_H
#define __GRPCPP_COMPLETION_QUEUE_H__ #define GRPCXX_COMPLETION_QUEUE_H
#include <grpc++/impl/client_unary_call.h> #include <grpc++/impl/client_unary_call.h>
@ -121,4 +121,4 @@ class CompletionQueue {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_COMPLETION_QUEUE_H__ #endif // GRPCXX_COMPLETION_QUEUE_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CONFIG_H__ #ifndef GRPCXX_CONFIG_H
#define __GRPCPP_CONFIG_H__ #define GRPCXX_CONFIG_H
#include <string> #include <string>
@ -50,4 +50,4 @@ typedef std::string string;
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CONFIG_H__ #endif // GRPCXX_CONFIG_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CREATE_CHANNEL_H__ #ifndef GRPCXX_CREATE_CHANNEL_H
#define __GRPCPP_CREATE_CHANNEL_H__ #define GRPCXX_CREATE_CHANNEL_H
#include <memory> #include <memory>
@ -55,4 +55,4 @@ std::shared_ptr<ChannelInterface> CreateChannel(
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CREATE_CHANNEL_H__ #endif // GRPCXX_CREATE_CHANNEL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CREDENTIALS_H_ #ifndef GRPCXX_CREDENTIALS_H
#define __GRPCPP_CREDENTIALS_H_ #define GRPCXX_CREDENTIALS_H
#include <chrono> #include <chrono>
#include <memory> #include <memory>
@ -133,4 +133,4 @@ class CredentialsFactory {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CREDENTIALS_H_ #endif // GRPCXX_CREDENTIALS_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CALL_H__ #ifndef GRPCXX_IMPL_CALL_H
#define __GRPCPP_CALL_H__ #define GRPCXX_IMPL_CALL_H
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc++/config.h> #include <grpc++/config.h>
@ -143,4 +143,4 @@ class Call GRPC_FINAL {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_CALL_INTERFACE_H__ #endif // GRPCXX_IMPL_CALL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_CLIENT_UNARY_CALL_H__ #ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H
#define __GRPCPP_CLIENT_UNARY_CALL_H__ #define GRPCXX_IMPL_CLIENT_UNARY_CALL_H
namespace google { namespace google {
namespace protobuf { namespace protobuf {
@ -56,4 +56,4 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method,
} // namespace grpc } // namespace grpc
#endif #endif // GRPCXX_IMPL_CLIENT_UNARY_CALL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_IMPL_INTERNAL_STUB_H__ #ifndef GRPCXX_IMPL_INTERNAL_STUB_H
#define __GRPCPP_IMPL_INTERNAL_STUB_H__ #define GRPCXX_IMPL_INTERNAL_STUB_H
#include <memory> #include <memory>
@ -57,4 +57,4 @@ class InternalStub {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ #endif // GRPCXX_IMPL_INTERNAL_STUB_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_IMPL_RPC_METHOD_H__ #ifndef GRPCXX_IMPL_RPC_METHOD_H
#define __GRPCPP_IMPL_RPC_METHOD_H__ #define GRPCXX_IMPL_RPC_METHOD_H
namespace google { namespace google {
namespace protobuf { namespace protobuf {
@ -66,4 +66,4 @@ class RpcMethod {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_IMPL_RPC_METHOD_H__ #endif // GRPCXX_IMPL_RPC_METHOD_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ #ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#define __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ #define GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#include <functional> #include <functional>
#include <map> #include <map>
@ -203,4 +203,4 @@ class RpcService {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ #endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_IMPL_SERVICE_TYPE_H__ #ifndef GRPCXX_IMPL_SERVICE_TYPE_H
#define __GRPCPP_IMPL_SERVICE_TYPE_H__ #define GRPCXX_IMPL_SERVICE_TYPE_H
namespace google { namespace google {
namespace protobuf { namespace protobuf {
@ -128,4 +128,4 @@ class AsynchronousService {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ #endif // GRPCXX_IMPL_SERVICE_TYPE_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_SERVER_H__ #ifndef GRPCXX_SERVER_H
#define __GRPCPP_SERVER_H__ #define GRPCXX_SERVER_H
#include <condition_variable> #include <condition_variable>
#include <list> #include <list>
@ -130,4 +130,4 @@ class Server GRPC_FINAL : private CallHook,
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_SERVER_H__ #endif // GRPCXX_SERVER_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_SERVER_BUILDER_H__ #ifndef GRPCXX_SERVER_BUILDER_H
#define __GRPCPP_SERVER_BUILDER_H__ #define GRPCXX_SERVER_BUILDER_H
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -88,4 +88,4 @@ class ServerBuilder {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_SERVER_BUILDER_H__ #endif // GRPCXX_SERVER_BUILDER_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_SERVER_CONTEXT_H_ #ifndef GRPCXX_SERVER_CONTEXT_H
#define __GRPCPP_SERVER_CONTEXT_H_ #define GRPCXX_SERVER_CONTEXT_H
#include <chrono> #include <chrono>
#include <map> #include <map>
@ -121,4 +121,4 @@ class ServerContext GRPC_FINAL {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_SERVER_CONTEXT_H_ #endif // GRPCXX_SERVER_CONTEXT_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_SERVER_CREDENTIALS_H_ #ifndef GRPCXX_SERVER_CREDENTIALS_H
#define __GRPCPP_SERVER_CREDENTIALS_H_ #define GRPCXX_SERVER_CREDENTIALS_H
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -79,4 +79,4 @@ class ServerCredentialsFactory {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_SERVER_CREDENTIALS_H_ #endif // GRPCXX_SERVER_CREDENTIALS_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_STATUS_H__ #ifndef GRPCXX_STATUS_H
#define __GRPCPP_STATUS_H__ #define GRPCXX_STATUS_H
#include <grpc++/status_code_enum.h> #include <grpc++/status_code_enum.h>
#include <grpc++/config.h> #include <grpc++/config.h>
@ -62,4 +62,4 @@ class Status {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_STATUS_H__ #endif // GRPCXX_STATUS_H

@ -31,57 +31,43 @@
* *
*/ */
#ifndef __GRPCPP_STATUS_CODE_ENUM_H__ #ifndef GRPCXX_STATUS_CODE_ENUM_H
#define __GRPCPP_STATUS_CODE_ENUM_H__ #define GRPCXX_STATUS_CODE_ENUM_H
namespace grpc { namespace grpc {
enum StatusCode { enum StatusCode {
/* Not an error; returned on success /* Not an error; returned on success */
HTTP Mapping: 200 OK */
OK = 0, OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller). */
HTTP Mapping: 499 Client Closed Request */
CANCELLED = 1, CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information errors raised by APIs that do not return enough error information
may be converted to this error. may be converted to this error. */
HTTP Mapping: 500 Internal Server Error */
UNKNOWN = 2, UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name). */
HTTP Mapping: 400 Bad Request */
INVALID_ARGUMENT = 3, INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long successful response from a server could have been delayed long
enough for the deadline to expire. enough for the deadline to expire. */
HTTP Mapping: 504 Gateway Timeout */
DEADLINE_EXCEEDED = 4, DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found. */
HTTP Mapping: 404 Not Found */
NOT_FOUND = 5, NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists. */
HTTP Mapping: 409 Conflict */
ALREADY_EXISTS = 6, ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
@ -89,21 +75,15 @@ enum StatusCode {
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). instead for those errors). */
HTTP Mapping: 403 Forbidden */
PERMISSION_DENIED = 7, PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation. */
HTTP Mapping: 401 Unauthorized */
UNAUTHENTICATED = 16, UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space. */
HTTP Mapping: 429 Too Many Requests */
RESOURCE_EXHAUSTED = 8, RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
@ -124,23 +104,14 @@ enum StatusCode {
(d) Use FAILED_PRECONDITION if the client performs conditional (d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting server does not match the condition. E.g., conflicting
read-modify-write on the same resource. read-modify-write on the same resource. */
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
FAILED_PRECONDITION = 9, FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 409 Conflict */
ABORTED = 10, ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
@ -157,21 +128,15 @@ enum StatusCode {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when a space can easily look for an OUT_OF_RANGE error to detect when
they are done. they are done. */
HTTP Mapping: 400 Bad Request */
OUT_OF_RANGE = 11, OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service. */
HTTP Mapping: 501 Not Implemented */
UNIMPLEMENTED = 12, UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken. */
HTTP Mapping: 500 Internal Server Error */
INTERNAL = 13, INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
@ -179,14 +144,10 @@ enum StatusCode {
a backoff. a backoff.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 503 Service Unavailable */
UNAVAILABLE = 14, UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption. */
HTTP Mapping: 500 Internal Server Error */
DATA_LOSS = 15, DATA_LOSS = 15,
/* Force users to include a default branch: */ /* Force users to include a default branch: */
@ -195,4 +156,4 @@ enum StatusCode {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_STATUS_CODE_ENUM_H_ #endif // GRPCXX_STATUS_CODE_ENUM_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_STREAM_H__ #ifndef GRPCXX_STREAM_H
#define __GRPCPP_STREAM_H__ #define GRPCXX_STREAM_H
#include <grpc++/channel_interface.h> #include <grpc++/channel_interface.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
@ -710,4 +710,4 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_STREAM_H__ #endif // GRPCXX_STREAM_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPCPP_THREAD_POOL_INTERFACE_H__ #ifndef GRPCXX_THREAD_POOL_INTERFACE_H
#define __GRPCPP_THREAD_POOL_INTERFACE_H__ #define GRPCXX_THREAD_POOL_INTERFACE_H
#include <functional> #include <functional>
@ -49,4 +49,4 @@ class ThreadPoolInterface {
} // namespace grpc } // namespace grpc
#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ #endif // GRPCXX_THREAD_POOL_INTERFACE_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_BYTE_BUFFER_H__ #ifndef GRPC_BYTE_BUFFER_H
#define __GRPC_BYTE_BUFFER_H__ #define GRPC_BYTE_BUFFER_H
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/slice_buffer.h> #include <grpc/support/slice_buffer.h>
@ -47,4 +47,4 @@ struct grpc_byte_buffer {
} data; } data;
}; };
#endif /* __GRPC_BYTE_BUFFER_H__ */ #endif /* GRPC_BYTE_BUFFER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_BYTE_BUFFER_READER_H__ #ifndef GRPC_BYTE_BUFFER_READER_H
#define __GRPC_BYTE_BUFFER_READER_H__ #define GRPC_BYTE_BUFFER_READER_H
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/byte_buffer.h> #include <grpc/byte_buffer.h>
@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader {
} current; } current;
}; };
#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ #endif /* GRPC_BYTE_BUFFER_READER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_GRPC_H__ #ifndef GRPC_GRPC_H
#define __GRPC_GRPC_H__ #define GRPC_GRPC_H
#include <grpc/status.h> #include <grpc/status.h>
@ -632,4 +632,4 @@ void grpc_server_destroy(grpc_server *server);
} }
#endif #endif
#endif /* __GRPC_GRPC_H__ */ #endif /* GRPC_GRPC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_GRPC_HTTP_H__ #ifndef GRPC_GRPC_HTTP_H
#define __GRPC_GRPC_HTTP_H__ #define GRPC_GRPC_HTTP_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -64,4 +64,4 @@ typedef struct {
} }
#endif #endif
#endif /* __GRPC_GRPC_HTTP_H__ */ #endif /* GRPC_GRPC_HTTP_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef GRPC_SECURITY_H_ #ifndef GRPC_GRPC_SECURITY_H
#define GRPC_SECURITY_H_ #define GRPC_GRPC_SECURITY_H
#include "grpc.h" #include "grpc.h"
#include "status.h" #include "status.h"
@ -185,4 +185,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr);
} }
#endif #endif
#endif /* GRPC_SECURITY_H_ */ #endif /* GRPC_GRPC_SECURITY_H */

@ -31,59 +31,45 @@
* *
*/ */
#ifndef __GRPC_STATUS_H__ #ifndef GRPC_STATUS_H
#define __GRPC_STATUS_H__ #define GRPC_STATUS_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef enum { typedef enum {
/* Not an error; returned on success /* Not an error; returned on success */
HTTP Mapping: 200 OK */
GRPC_STATUS_OK = 0, GRPC_STATUS_OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller). */
HTTP Mapping: 499 Client Closed Request */
GRPC_STATUS_CANCELLED = 1, GRPC_STATUS_CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information errors raised by APIs that do not return enough error information
may be converted to this error. may be converted to this error. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_UNKNOWN = 2, GRPC_STATUS_UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name). */
HTTP Mapping: 400 Bad Request */
GRPC_STATUS_INVALID_ARGUMENT = 3, GRPC_STATUS_INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long successful response from a server could have been delayed long
enough for the deadline to expire. enough for the deadline to expire. */
HTTP Mapping: 504 Gateway Timeout */
GRPC_STATUS_DEADLINE_EXCEEDED = 4, GRPC_STATUS_DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found. */
HTTP Mapping: 404 Not Found */
GRPC_STATUS_NOT_FOUND = 5, GRPC_STATUS_NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists. */
HTTP Mapping: 409 Conflict */
GRPC_STATUS_ALREADY_EXISTS = 6, GRPC_STATUS_ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
@ -91,21 +77,15 @@ typedef enum {
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). instead for those errors). */
HTTP Mapping: 403 Forbidden */
GRPC_STATUS_PERMISSION_DENIED = 7, GRPC_STATUS_PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation. */
HTTP Mapping: 401 Unauthorized */
GRPC_STATUS_UNAUTHENTICATED = 16, GRPC_STATUS_UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space. */
HTTP Mapping: 429 Too Many Requests */
GRPC_STATUS_RESOURCE_EXHAUSTED = 8, GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
@ -126,23 +106,14 @@ typedef enum {
(d) Use FAILED_PRECONDITION if the client performs conditional (d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting server does not match the condition. E.g., conflicting
read-modify-write on the same resource. read-modify-write on the same resource. */
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
GRPC_STATUS_FAILED_PRECONDITION = 9, GRPC_STATUS_FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 409 Conflict */
GRPC_STATUS_ABORTED = 10, GRPC_STATUS_ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
@ -159,21 +130,15 @@ typedef enum {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when a space can easily look for an OUT_OF_RANGE error to detect when
they are done. they are done. */
HTTP Mapping: 400 Bad Request */
GRPC_STATUS_OUT_OF_RANGE = 11, GRPC_STATUS_OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service. */
HTTP Mapping: 501 Not Implemented */
GRPC_STATUS_UNIMPLEMENTED = 12, GRPC_STATUS_UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_INTERNAL = 13, GRPC_STATUS_INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
@ -181,14 +146,10 @@ typedef enum {
a backoff. a backoff.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 503 Service Unavailable */
GRPC_STATUS_UNAVAILABLE = 14, GRPC_STATUS_UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_DATA_LOSS = 15, GRPC_STATUS_DATA_LOSS = 15,
/* Force users to include a default branch: */ /* Force users to include a default branch: */
@ -199,4 +160,4 @@ typedef enum {
} }
#endif #endif
#endif /* __GRPC_STATUS_H__ */ #endif /* GRPC_STATUS_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_ALLOC_H__ #ifndef GRPC_SUPPORT_ALLOC_H
#define __GRPC_SUPPORT_ALLOC_H__ #define GRPC_SUPPORT_ALLOC_H
#include <stddef.h> #include <stddef.h>
@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_ALLOC_H__ */ #endif /* GRPC_SUPPORT_ALLOC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_ATM_H__ #ifndef GRPC_SUPPORT_ATM_H
#define __GRPC_SUPPORT_ATM_H__ #define GRPC_SUPPORT_ATM_H
/* This interface provides atomic operations and barriers. /* This interface provides atomic operations and barriers.
It is internal to gpr support code and should not be used outside it. It is internal to gpr support code and should not be used outside it.
@ -89,4 +89,4 @@
#error could not determine platform for atm #error could not determine platform for atm
#endif #endif
#endif /* __GRPC_SUPPORT_ATM_H__ */ #endif /* GRPC_SUPPORT_ATM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ #ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
#define __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ #define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
/* atm_platform.h for gcc and gcc-like compilers with the /* atm_platform.h for gcc and gcc-like compilers with the
__atomic_* interface. */ __atomic_* interface. */
@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
__ATOMIC_RELAXED); __ATOMIC_RELAXED);
} }
#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ #endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_ATM_GCC_SYNC_H__ #ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H
#define __GRPC_SUPPORT_ATM_GCC_SYNC_H__ #define GRPC_SUPPORT_ATM_GCC_SYNC_H
/* variant of atm_platform.h for gcc and gcc-like compiers with __sync_* /* variant of atm_platform.h for gcc and gcc-like compiers with __sync_*
interface */ interface */
@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ #endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_ATM_WIN32_H__ #ifndef GRPC_SUPPORT_ATM_WIN32_H
#define __GRPC_SUPPORT_ATM_WIN32_H__ #define GRPC_SUPPORT_ATM_WIN32_H
/* Win32 variant of atm_platform.h */ /* Win32 variant of atm_platform.h */
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
@ -105,4 +105,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) {
return old; return old;
} }
#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ #endif /* GRPC_SUPPORT_ATM_WIN32_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ #ifndef GRPC_SUPPORT_CANCELLABLE_PLATFORM_H
#define __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ #define GRPC_SUPPORT_CANCELLABLE_PLATFORM_H
#include <grpc/support/atm.h> #include <grpc/support/atm.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
@ -53,4 +53,4 @@ typedef struct {
struct gpr_cancellable_list_ waiters; struct gpr_cancellable_list_ waiters;
} gpr_cancellable; } gpr_cancellable;
#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ #endif /* GRPC_SUPPORT_CANCELLABLE_PLATFORM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_CMDLINE_H__ #ifndef GRPC_SUPPORT_CMDLINE_H
#define __GRPC_SUPPORT_CMDLINE_H__ #define GRPC_SUPPORT_CMDLINE_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ #endif /* GRPC_SUPPORT_CMDLINE_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_SUPPORT_CPU_H__ #ifndef GRPC_SUPPORT_CPU_H
#define __GRPC_INTERNAL_SUPPORT_CPU_H__ #define GRPC_SUPPORT_CPU_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void);
} // extern "C" } // extern "C"
#endif #endif
#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ #endif /* GRPC_SUPPORT_CPU_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_HISTOGRAM_H__ #ifndef GRPC_SUPPORT_HISTOGRAM_H
#define __GRPC_SUPPORT_HISTOGRAM_H__ #define GRPC_SUPPORT_HISTOGRAM_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ #endif /* GRPC_SUPPORT_HISTOGRAM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_HOST_PORT_H__ #ifndef GRPC_SUPPORT_HOST_PORT_H
#define __GRPC_SUPPORT_HOST_PORT_H__ #define GRPC_SUPPORT_HOST_PORT_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -59,4 +59,4 @@ void gpr_split_host_port(const char *name, char **host, char **port);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ #endif /* GRPC_SUPPORT_HOST_PORT_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_LOG_H__ #ifndef GRPC_SUPPORT_LOG_H
#define __GRPC_SUPPORT_LOG_H__ #define GRPC_SUPPORT_LOG_H
#include <stdlib.h> /* for abort() */ #include <stdlib.h> /* for abort() */
#include <stdarg.h> #include <stdarg.h>
@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_LOG_H__ */ #endif /* GRPC_SUPPORT_LOG_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_LOG_WIN32_H__ #ifndef GRPC_SUPPORT_LOG_WIN32_H
#define __GRPC_SUPPORT_LOG_WIN32_H__ #define GRPC_SUPPORT_LOG_WIN32_H
#include <windows.h> #include <windows.h>
@ -50,4 +50,4 @@ char *gpr_format_message(DWORD messageid);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_LOG_H__ */ #endif /* GRPC_SUPPORT_LOG_WIN32_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_PORT_PLATFORM_H__ #ifndef GRPC_SUPPORT_PORT_PLATFORM_H
#define __GRPC_SUPPORT_PORT_PLATFORM_H__ #define GRPC_SUPPORT_PORT_PLATFORM_H
/* Override this file with one for your platform if you need to redefine /* Override this file with one for your platform if you need to redefine
things. */ things. */
@ -206,4 +206,4 @@ typedef uintptr_t gpr_uintptr;
power of two */ power of two */
#define GPR_MAX_ALIGNMENT 16 #define GPR_MAX_ALIGNMENT 16
#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ #endif /* GRPC_SUPPORT_PORT_PLATFORM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SLICE_H__ #ifndef GRPC_SUPPORT_SLICE_H
#define __GRPC_SUPPORT_SLICE_H__ #define GRPC_SUPPORT_SLICE_H
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
@ -175,4 +175,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_SLICE_H__ */ #endif /* GRPC_SUPPORT_SLICE_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SLICE_BUFFER_H__ #ifndef GRPC_SUPPORT_SLICE_BUFFER_H
#define __GRPC_SUPPORT_SLICE_BUFFER_H__ #define GRPC_SUPPORT_SLICE_BUFFER_H
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ #endif /* GRPC_SUPPORT_SLICE_BUFFER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SYNC_H__ #ifndef GRPC_SUPPORT_SYNC_H
#define __GRPC_SUPPORT_SYNC_H__ #define GRPC_SUPPORT_SYNC_H
/* Synchronization primitives for GPR. /* Synchronization primitives for GPR.
The type gpr_mu provides a non-reentrant mutex (lock). The type gpr_mu provides a non-reentrant mutex (lock).
@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_SYNC_H__ */ #endif /* GRPC_SUPPORT_SYNC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SYNC_GENERIC_H__ #ifndef GRPC_SUPPORT_SYNC_GENERIC_H
#define __GRPC_SUPPORT_SYNC_GENERIC_H__ #define GRPC_SUPPORT_SYNC_GENERIC_H
/* Generic type defintions for gpr_sync. */ /* Generic type defintions for gpr_sync. */
#include <grpc/support/atm.h> #include <grpc/support/atm.h>
@ -58,4 +58,4 @@ typedef struct {
#define GPR_STATS_INIT \ #define GPR_STATS_INIT \
{ 0 } { 0 }
#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ #endif /* GRPC_SUPPORT_SYNC_GENERIC_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SYNC_POSIX_H__ #ifndef GRPC_SUPPORT_SYNC_POSIX_H
#define __GRPC_SUPPORT_SYNC_POSIX_H__ #define GRPC_SUPPORT_SYNC_POSIX_H
#include <grpc/support/sync_generic.h> #include <grpc/support/sync_generic.h>
@ -44,4 +44,4 @@ typedef pthread_once_t gpr_once;
#define GPR_ONCE_INIT PTHREAD_ONCE_INIT #define GPR_ONCE_INIT PTHREAD_ONCE_INIT
#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ #endif /* GRPC_SUPPORT_SYNC_POSIX_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_SYNC_WIN32_H__ #ifndef GRPC_SUPPORT_SYNC_WIN32_H
#define __GRPC_SUPPORT_SYNC_WIN32_H__ #define GRPC_SUPPORT_SYNC_WIN32_H
#include <grpc/support/sync_generic.h> #include <grpc/support/sync_generic.h>
@ -48,4 +48,4 @@ typedef CONDITION_VARIABLE gpr_cv;
typedef INIT_ONCE gpr_once; typedef INIT_ONCE gpr_once;
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ #endif /* GRPC_SUPPORT_SYNC_WIN32_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_THD_H__ #ifndef GRPC_SUPPORT_THD_H
#define __GRPC_SUPPORT_THD_H__ #define GRPC_SUPPORT_THD_H
/* Thread interface for GPR. /* Thread interface for GPR.
Types Types
@ -73,4 +73,4 @@ gpr_thd_id gpr_thd_currentid(void);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_THD_H__ */ #endif /* GRPC_SUPPORT_THD_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_TIME_H__ #ifndef GRPC_SUPPORT_TIME_H
#define __GRPC_SUPPORT_TIME_H__ #define GRPC_SUPPORT_TIME_H
/* Time support. /* Time support.
We use gpr_timespec, which is analogous to struct timespec. On some We use gpr_timespec, which is analogous to struct timespec. On some
machines, absolute times may be in local time. */ machines, absolute times may be in local time. */
@ -100,4 +100,4 @@ double gpr_timespec_to_micros(gpr_timespec t);
} }
#endif #endif
#endif /* __GRPC_SUPPORT_TIME_H__ */ #endif /* GRPC_SUPPORT_TIME_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_SUPPORT_USEFUL_H__ #ifndef GRPC_SUPPORT_USEFUL_H
#define __GRPC_SUPPORT_USEFUL_H__ #define GRPC_SUPPORT_USEFUL_H
/* useful macros that don't belong anywhere else */ /* useful macros that don't belong anywhere else */
@ -45,4 +45,4 @@
#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
#endif /* __GRPC_SUPPORT_USEFUL_H__ */ #endif /* GRPC_SUPPORT_USEFUL_H */

@ -186,7 +186,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer->Print( printer->Print(
*vars, *vars,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> " "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Method$(::grpc::ClientContext* context, " "Async$Method$(::grpc::ClientContext* context, "
"const $Request$& request, " "const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);\n"); "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ClientOnlyStreaming(method)) { } else if (ClientOnlyStreaming(method)) {
@ -196,7 +196,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, $Response$* response);\n"); "::grpc::ClientContext* context, $Response$* response);\n");
printer->Print( printer->Print(
*vars, *vars,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> $Method$(" "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> Async$Method$("
"::grpc::ClientContext* context, $Response$* response, " "::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag);\n"); "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ServerOnlyStreaming(method)) { } else if (ServerOnlyStreaming(method)) {
@ -206,7 +206,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, const $Request$& request);\n"); "::grpc::ClientContext* context, const $Request$& request);\n");
printer->Print( printer->Print(
*vars, *vars,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> $Method$(" "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> Async$Method$("
"::grpc::ClientContext* context, const $Request$& request, " "::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);\n"); "::grpc::CompletionQueue* cq, void* tag);\n");
} else if (BidiStreaming(method)) { } else if (BidiStreaming(method)) {
@ -217,7 +217,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer->Print(*vars, printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> " "$Request$, $Response$>> "
"$Method$(::grpc::ClientContext* context, " "Async$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag);\n"); "::grpc::CompletionQueue* cq, void* tag);\n");
} }
} }
@ -390,7 +390,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer->Print( printer->Print(
*vars, *vars,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> " "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, " "$Service$::Stub::Async$Method$(::grpc::ClientContext* context, "
"const $Request$& request, " "const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {\n"); "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars, printer->Print(*vars,
@ -416,7 +416,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}\n\n"); "}\n\n");
printer->Print(*vars, printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> " "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> "
"$Service$::Stub::$Method$(" "$Service$::Stub::Async$Method$("
"::grpc::ClientContext* context, $Response$* response, " "::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag) {\n"); "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars, printer->Print(*vars,
@ -443,7 +443,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}\n\n"); "}\n\n");
printer->Print(*vars, printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> " "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
"$Service$::Stub::$Method$(" "$Service$::Stub::Async$Method$("
"::grpc::ClientContext* context, const $Request$& request, " "::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {\n"); "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars, printer->Print(*vars,
@ -471,7 +471,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer->Print(*vars, printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> " "$Request$, $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, " "$Service$::Stub::Async$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag) {\n"); "::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars, printer->Print(*vars,
" return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " " return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_CPP_GENERATOR_H_ #ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
#define NET_GRPC_COMPILER_CPP_GENERATOR_H_ #define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
#include <string> #include <string>
@ -58,4 +58,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_cpp_generator } // namespace grpc_cpp_generator
#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_ #endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ #ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
#define NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ #define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
#include <map> #include <map>
#include <string> #include <string>
@ -69,4 +69,4 @@ inline std::string ClassName(const google::protobuf::Descriptor *descriptor,
} // namespace grpc_cpp_generator } // namespace grpc_cpp_generator
#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ #endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_GENERATOR_HELPERS_H__ #ifndef GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#define NET_GRPC_COMPILER_GENERATOR_HELPERS_H__ #define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#include <map> #include <map>
#include <string> #include <string>
@ -76,4 +76,4 @@ inline std::string StringReplace(std::string str, const std::string &from,
} // namespace grpc_generator } // namespace grpc_generator
#endif // NET_GRPC_COMPILER_GENERATOR_HELPERS_H__ #endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H

@ -237,54 +237,70 @@ bool PrintServerFactory(const ServiceDescriptor* service, Printer* out) {
"Service", service->name()); "Service", service->name());
{ {
IndentScope raii_create_server_indent(out); IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message; map<string, string> method_description_constructors;
out->Print("method_implementations = {\n"); map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) { for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out); const MethodDescriptor* method = service->method(i);
const MethodDescriptor* meth = service->method(i); const string method_description_constructor =
string meth_type = string(method->client_streaming() ? "stream_" : "unary_") +
string(meth->client_streaming() ? "stream" : "unary") + string(method->server_streaming() ? "stream_" : "unary_") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline"; "service_description";
out->Print("\"$Method$\": utilities.$Type$(servicer.$Method$),\n", pair<string, string> input_message_module_and_class;
"Method", meth->name(), if (!GetModuleAndMessagePath(method->input_type(),
"Type", meth_type); &input_message_module_and_class)) {
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* input_type = meth->input_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(input_type, &module_and_message)) {
return false; return false;
} }
method_to_module_and_message.insert( pair<string, string> output_message_module_and_class;
make_pair(meth->name(), module_and_message)); if (!GetModuleAndMessagePath(method->output_type(),
} &output_message_module_and_class)) {
out->Print("}\n"); return false;
// Ensure that we've imported all of the relevant messages. }
for (auto& meth_vals : method_to_module_and_message) { // Import the modules that define the messages used in RPCs.
out->Print("import $Module$\n", out->Print("import $Module$\n", "Module",
"Module", meth_vals.second.first); input_message_module_and_class.first);
} out->Print("import $Module$\n", "Module",
out->Print("request_deserializers = {\n"); output_message_module_and_class.first);
for (auto& meth_vals : method_to_module_and_message) { method_description_constructors.insert(
IndentScope raii_serializers_indent(out); make_pair(method->name(), method_description_constructor));
string full_input_type_path = meth_vals.second.first + "." + input_message_modules_and_classes.insert(
meth_vals.second.second; make_pair(method->name(), input_message_module_and_class));
out->Print("\"$Method$\": $Type$.FromString,\n", output_message_modules_and_classes.insert(
"Method", meth_vals.first, make_pair(method->name(), output_message_module_and_class));
"Type", full_input_type_path);
} }
out->Print("}\n"); out->Print("method_service_descriptions = {\n");
out->Print("response_serializers = {\n"); for (auto& name_and_description_constructor :
for (auto& meth_vals : method_to_module_and_message) { method_description_constructors) {
IndentScope raii_serializers_indent(out); IndentScope raii_descriptions_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n", const string method_name = name_and_description_constructor.first;
"Method", meth_vals.first); auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print("servicer.$Method$,\n", "Method", method_name);
out->Print(
"$InputTypeModule$.$InputTypeClass$.FromString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.SerializeToString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
}
out->Print("),\n");
} }
out->Print("}\n"); out->Print("}\n");
out->Print("link = fore.activated_fore_link(port, request_deserializers, " // out->Print("return implementations.insecure_server("
"response_serializers, root_certificates, key_chain_pairs)\n"); // "method_service_descriptions, port)\n");
out->Print("return implementations.assemble_service(" out->Print(
"method_implementations, link)\n"); "return implementations.secure_server("
"method_service_descriptions, port, root_certificates,"
" key_chain_pairs)\n");
} }
return true; return true;
} }
@ -296,66 +312,74 @@ bool PrintStubFactory(const ServiceDescriptor* service, Printer* out) {
out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n"); out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n");
{ {
IndentScope raii_create_server_indent(out); IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message; map<string, string> method_description_constructors;
out->Print("method_implementations = {\n"); map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) { for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out); const MethodDescriptor* method = service->method(i);
const MethodDescriptor* meth = service->method(i); const string method_description_constructor =
string meth_type = string(method->client_streaming() ? "stream_" : "unary_") +
string(meth->client_streaming() ? "stream" : "unary") + string(method->server_streaming() ? "stream_" : "unary_") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline"; "invocation_description";
// TODO(atash): once the expected input to assemble_dynamic_inline_stub is pair<string, string> input_message_module_and_class;
// cleaned up, change this to the expected argument's dictionary values. if (!GetModuleAndMessagePath(method->input_type(),
out->Print("\"$Method$\": utilities.$Type$(None),\n", &input_message_module_and_class)) {
"Method", meth->name(),
"Type", meth_type);
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* output_type = meth->output_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(output_type, &module_and_message)) {
return false; return false;
} }
method_to_module_and_message.insert( pair<string, string> output_message_module_and_class;
make_pair(meth->name(), module_and_message)); if (!GetModuleAndMessagePath(method->output_type(),
} &output_message_module_and_class)) {
out->Print("}\n"); return false;
// Ensure that we've imported all of the relevant messages. }
for (auto& meth_vals : method_to_module_and_message) { // Import the modules that define the messages used in RPCs.
out->Print("import $Module$\n", out->Print("import $Module$\n", "Module",
"Module", meth_vals.second.first); input_message_module_and_class.first);
} out->Print("import $Module$\n", "Module",
out->Print("response_deserializers = {\n"); output_message_module_and_class.first);
for (auto& meth_vals : method_to_module_and_message) { method_description_constructors.insert(
IndentScope raii_serializers_indent(out); make_pair(method->name(), method_description_constructor));
string full_output_type_path = meth_vals.second.first + "." + input_message_modules_and_classes.insert(
meth_vals.second.second; make_pair(method->name(), input_message_module_and_class));
out->Print("\"$Method$\": $Type$.FromString,\n", output_message_modules_and_classes.insert(
"Method", meth_vals.first, make_pair(method->name(), output_message_module_and_class));
"Type", full_output_type_path);
} }
out->Print("}\n"); out->Print("method_invocation_descriptions = {\n");
out->Print("request_serializers = {\n"); for (auto& name_and_description_constructor :
for (auto& meth_vals : method_to_module_and_message) { method_description_constructors) {
IndentScope raii_serializers_indent(out); IndentScope raii_descriptions_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n", const string method_name = name_and_description_constructor.first;
"Method", meth_vals.first); auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print(
"$InputTypeModule$.$InputTypeClass$.SerializeToString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.FromString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
}
out->Print("),\n");
} }
out->Print("}\n"); out->Print("}\n");
out->Print("link = rear.activated_rear_link(" out->Print(
"host, port, request_serializers, response_deserializers)\n"); "return implementations.insecure_stub("
out->Print("return implementations.assemble_dynamic_inline_stub(" "method_invocation_descriptions, host, port)\n");
"method_implementations, link)\n");
} }
return true; return true;
} }
bool PrintPreamble(const FileDescriptor* file, Printer* out) { bool PrintPreamble(const FileDescriptor* file, Printer* out) {
out->Print("import abc\n"); out->Print("import abc\n");
out->Print("from grpc._adapter import fore\n"); out->Print("from grpc.early_adopter import implementations\n");
out->Print("from grpc._adapter import rear\n"); out->Print("from grpc.early_adopter import utilities\n");
out->Print("from grpc.framework.assembly import implementations\n");
out->Print("from grpc.framework.assembly import utilities\n");
return true; return true;
} }

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_COMPILER_PYTHON_GENERATOR_H__ #ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
#define __GRPC_COMPILER_PYTHON_GENERATOR_H__ #define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
#include <string> #include <string>
#include <utility> #include <utility>
@ -49,4 +49,4 @@ std::pair<bool, std::string> GetServices(const google::protobuf::FileDescriptor*
} // namespace grpc_python_generator } // namespace grpc_python_generator
#endif // __GRPC_COMPILER_PYTHON_GENERATOR_H__ #endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_H_ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
#define NET_GRPC_COMPILER_RUBY_GENERATOR_H_ #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
#include <string> #include <string>
@ -48,4 +48,4 @@ std::string GetServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_ruby_generator } // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_ #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
#define NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
#include <string> #include <string>
@ -64,4 +64,4 @@ inline std::string MessagesRequireName(
} // namespace grpc_ruby_generator } // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
#define NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
#include <iostream> #include <iostream>
#include <initializer_list> #include <initializer_list>
@ -69,4 +69,4 @@ inline std::map<std::string, std::string> ListToDict(
} // namespace grpc_ruby_generator } // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
#define NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
#include <algorithm> #include <algorithm>
#include <string> #include <string>
@ -130,4 +130,4 @@ inline std::string RubyTypeOf(const std::string &a_type,
} // namespace grpc_ruby_generator } // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H
#define __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@
extern const grpc_channel_filter grpc_client_census_filter; extern const grpc_channel_filter grpc_client_census_filter;
extern const grpc_channel_filter grpc_server_census_filter; extern const grpc_channel_filter grpc_server_census_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#define __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#include <grpc/grpc.h> #include <grpc/grpc.h>
@ -51,4 +51,4 @@ void grpc_channel_args_destroy(grpc_channel_args *a);
is specified in channel args, otherwise returns 0. */ is specified in channel args, otherwise returns 0. */
int grpc_channel_args_is_census_enabled(const grpc_channel_args *a); int grpc_channel_args_is_census_enabled(const grpc_channel_args *a);
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H */

@ -36,6 +36,8 @@
#include <stdlib.h> #include <stdlib.h>
int grpc_trace_channel = 0;
/* Memory layouts. /* Memory layouts.
Channel stack is laid out as: { Channel stack is laid out as: {

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
#define __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
/* A channel filter defines how operations on a channel are implemented. /* A channel filter defines how operations on a channel are implemented.
Channel filters are chained together to create full channels, and if those Channel filters are chained together to create full channels, and if those
@ -298,7 +298,9 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem,
void grpc_call_element_send_cancel(grpc_call_element *cur_elem); void grpc_call_element_send_cancel(grpc_call_element *cur_elem);
void grpc_call_element_send_finish(grpc_call_element *cur_elem); void grpc_call_element_send_finish(grpc_call_element *cur_elem);
extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \ #define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_bits & GRPC_TRACE_CHANNEL) grpc_call_log_op(sev, elem, op) if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H
#define __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ #define GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -61,4 +61,4 @@ grpc_child_call *grpc_child_channel_create_call(grpc_child_channel *channel,
grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call); grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call);
void grpc_child_call_destroy(grpc_child_call *call); void grpc_child_call_destroy(grpc_child_call *call);
#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#define __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -59,4 +59,4 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete(
grpc_channel_filter const **channel_filters, size_t num_channel_filters, grpc_channel_filter const **channel_filters, size_t num_channel_filters,
grpc_mdctx *mdctx); grpc_mdctx *mdctx);
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H
#define __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H
#include "src/core/channel/client_channel.h" #include "src/core/channel/client_channel.h"
#include "src/core/transport/metadata.h" #include "src/core/transport/metadata.h"
@ -70,4 +70,4 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r);
grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r); grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r);
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H */

@ -48,12 +48,12 @@
/* the protobuf library will (by default) start warning at 100megs */ /* the protobuf library will (by default) start warning at 100megs */
#define DEFAULT_MAX_MESSAGE_LENGTH (100 * 1024 * 1024) #define DEFAULT_MAX_MESSAGE_LENGTH (100 * 1024 * 1024)
typedef struct { typedef struct connected_channel_channel_data {
grpc_transport *transport; grpc_transport *transport;
gpr_uint32 max_message_length; gpr_uint32 max_message_length;
} channel_data; } channel_data;
typedef struct { typedef struct connected_channel_call_data {
grpc_call_element *elem; grpc_call_element *elem;
grpc_stream_op_buffer outgoing_sopb; grpc_stream_op_buffer outgoing_sopb;

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#define __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ #define GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -46,4 +46,4 @@ extern const grpc_channel_filter grpc_connected_channel_filter;
grpc_transport_setup_result grpc_connected_channel_bind_transport( grpc_transport_setup_result grpc_connected_channel_bind_transport(
grpc_channel_stack *channel_stack, grpc_transport *transport); grpc_channel_stack *channel_stack, grpc_transport *transport);
#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#define __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_http_client_filter;
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H
#define __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -40,4 +40,4 @@
transports. */ transports. */
extern const grpc_channel_filter grpc_http_filter; extern const grpc_channel_filter grpc_http_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H */

@ -31,12 +31,12 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#define __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
/* Processes metadata on the client side for HTTP2 transports */ /* Processes metadata on the client side for HTTP2 transports */
extern const grpc_channel_filter grpc_http_server_filter; extern const grpc_channel_filter grpc_http_server_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H
#define __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -67,4 +67,4 @@ grpc_metadata *grpc_metadata_buffer_extract_elements(
grpc_metadata_buffer *buffer); grpc_metadata_buffer *buffer);
void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error); void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error);
#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ #ifndef GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#define __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ #define GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#include "src/core/channel/channel_stack.h" #include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@
customize for their own filters */ customize for their own filters */
extern const grpc_channel_filter grpc_no_op_filter; extern const grpc_channel_filter grpc_no_op_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ #ifndef GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H
#define __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ #define GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H
/* The various compression algorithms supported by GRPC */ /* The various compression algorithms supported by GRPC */
typedef enum { typedef enum {
@ -46,4 +46,4 @@ typedef enum {
const char *grpc_compression_algorithm_name( const char *grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm); grpc_compression_algorithm algorithm);
#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */ #endif /* GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ #ifndef GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#define __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ #define GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#include "src/core/compression/algorithm.h" #include "src/core/compression/algorithm.h"
#include <grpc/support/slice_buffer.h> #include <grpc/support/slice_buffer.h>
@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
int grpc_msg_decompress(grpc_compression_algorithm algorithm, int grpc_msg_decompress(grpc_compression_algorithm algorithm,
gpr_slice_buffer *input, gpr_slice_buffer *output); gpr_slice_buffer *input, gpr_slice_buffer *output);
#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */ #endif /* GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H */

@ -39,8 +39,21 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/support/env.h" #include "src/core/support/env.h"
#if GRPC_ENABLE_TRACING typedef struct tracer {
gpr_uint32 grpc_trace_bits = 0; const char *name;
int *flag;
struct tracer *next;
} tracer;
static tracer *tracers;
void grpc_register_tracer(const char *name, int *flag) {
tracer *t = gpr_malloc(sizeof(*t));
t->name = name;
t->flag = flag;
t->next = tracers;
*flag = 0;
tracers = t;
}
static void add(const char *beg, const char *end, char ***ss, size_t *ns) { static void add(const char *beg, const char *end, char ***ss, size_t *ns) {
size_t n = *ns; size_t n = *ns;
@ -67,26 +80,26 @@ static void parse(const char *s) {
char **strings = NULL; char **strings = NULL;
size_t nstrings = 0; size_t nstrings = 0;
size_t i; size_t i;
tracer *t;
split(s, &strings, &nstrings); split(s, &strings, &nstrings);
grpc_trace_bits = 0;
for (i = 0; i < nstrings; i++) { for (i = 0; i < nstrings; i++) {
const char *s = strings[i]; const char *s = strings[i];
if (0 == strcmp(s, "surface")) { if (0 == strcmp(s, "all")) {
grpc_trace_bits |= GRPC_TRACE_SURFACE; for (t = tracers; t; t = t->next) {
} else if (0 == strcmp(s, "channel")) { *t->flag = 1;
grpc_trace_bits |= GRPC_TRACE_CHANNEL; }
} else if (0 == strcmp(s, "tcp")) {
grpc_trace_bits |= GRPC_TRACE_TCP;
} else if (0 == strcmp(s, "secure_endpoint")) {
grpc_trace_bits |= GRPC_TRACE_SECURE_ENDPOINT;
} else if (0 == strcmp(s, "http")) {
grpc_trace_bits |= GRPC_TRACE_HTTP;
} else if (0 == strcmp(s, "all")) {
grpc_trace_bits = -1;
} else { } else {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s); int found = 0;
for (t = tracers; t; t = t->next) {
if (0 == strcmp(s, t->name)) {
*t->flag = 1;
found = 1;
}
}
if (!found) {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
}
} }
} }
@ -96,17 +109,15 @@ static void parse(const char *s) {
gpr_free(strings); gpr_free(strings);
} }
void grpc_init_trace_bits() { void grpc_tracer_init(const char *env_var) {
char *e = gpr_getenv("GRPC_TRACE"); char *e = gpr_getenv(env_var);
if (e == NULL) { if (e != NULL) {
grpc_trace_bits = 0;
} else {
parse(e); parse(e);
gpr_free(e); gpr_free(e);
} }
while (tracers) {
tracer *t = tracers;
tracers = t->next;
gpr_free(t);
}
} }
#else
void grpc_init_trace_bits() {
}
#endif

@ -31,31 +31,12 @@
* *
*/ */
#ifndef GRPC_CORE_DEBUG_TRACE_H #ifndef GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#define GRPC_CORE_DEBUG_TRACE_H #define GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
/* set to zero to remove all debug trace code */ void grpc_register_tracer(const char *name, int *flag);
#ifndef GRPC_ENABLE_TRACING void grpc_tracer_init(const char *env_var_name);
# define GRPC_ENABLE_TRACING 1
#endif
typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
extern gpr_uint32 grpc_trace_bits;
#else
# define grpc_trace_bits 0
#endif
void grpc_init_trace_bits();
#endif
#endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ #ifndef GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#define __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ #define GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#include "src/core/httpcli/httpcli.h" #include "src/core/httpcli/httpcli.h"
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes, const char *body_bytes,
size_t body_size); size_t body_size);
#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */ #endif /* GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ #ifndef GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H
#define __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ #define GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H
#include <stddef.h> #include <stddef.h>
@ -115,4 +115,4 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request,
void grpc_httpcli_set_override(grpc_httpcli_get_override get, void grpc_httpcli_set_override(grpc_httpcli_get_override get,
grpc_httpcli_post_override post); grpc_httpcli_post_override post);
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */ #endif /* GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ #ifndef GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H
#define __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ #define GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H
#include "src/core/security/security_context.h" #include "src/core/security/security_context.h"
@ -40,4 +40,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create(
const unsigned char *pem_root_certs, size_t pem_root_certs_size, const unsigned char *pem_root_certs, size_t pem_root_certs_size,
const char *secure_peer_name, grpc_channel_security_context **ctx); const char *secure_peer_name, grpc_channel_security_context **ctx);
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */ #endif /* GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_HTTPCLI_PARSER_H__ #ifndef GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H
#define __GRPC_INTERNAL_HTTPCLI_PARSER_H__ #define GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H
#include "src/core/httpcli/httpcli.h" #include "src/core/httpcli/httpcli.h"
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
@ -61,4 +61,4 @@ void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser);
int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice); int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice);
int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser); int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser);
#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */ #endif /* GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_H__ #ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#define __GRPC_INTERNAL_IOMGR_ALARM_H__ #define GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#include "src/core/iomgr/iomgr.h" #include "src/core/iomgr/iomgr.h"
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
@ -86,4 +86,4 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
Requires: cancel() must happen after add() on a given alarm */ Requires: cancel() must happen after add() on a given alarm */
void grpc_alarm_cancel(grpc_alarm *alarm); void grpc_alarm_cancel(grpc_alarm *alarm);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#define __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ #define GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#include "src/core/iomgr/alarm.h" #include "src/core/iomgr/alarm.h"
@ -54,4 +54,4 @@ void grpc_alarm_heap_pop(grpc_alarm_heap *heap);
int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap); int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#define __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ #define GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
@ -59,4 +59,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void);
void grpc_kick_poller(void); void grpc_kick_poller(void);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ #ifndef GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H
#define __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ #define GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H
#include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset.h"
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
@ -103,4 +103,4 @@ struct grpc_endpoint {
const grpc_endpoint_vtable *vtable; const grpc_endpoint_vtable *vtable;
}; };
#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H
#define __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ #define GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H
#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/endpoint.h"
@ -43,4 +43,4 @@ typedef struct {
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size); grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size);
#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H
#define __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ #define GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H
#include "src/core/iomgr/iomgr.h" #include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset.h"
@ -143,4 +143,4 @@ void grpc_fd_unref(grpc_fd *fd);
void grpc_fd_global_init(void); void grpc_fd_global_init(void);
void grpc_fd_global_shutdown(void); void grpc_fd_global_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#define __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ #define GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#include <windows.h> #include <windows.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
@ -49,4 +49,4 @@ void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success
void grpc_socket_notify_on_read(grpc_winsocket *, void(*cb)(void *, int success), void grpc_socket_notify_on_read(grpc_winsocket *, void(*cb)(void *, int success),
void *opaque); void *opaque);
#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_IOMGR_H__ #ifndef GRPC_INTERNAL_CORE_IOMGR_IOMGR_H
#define __GRPC_INTERNAL_IOMGR_IOMGR_H__ #define GRPC_INTERNAL_CORE_IOMGR_IOMGR_H
/* gRPC Callback definition */ /* gRPC Callback definition */
typedef void (*grpc_iomgr_cb_func)(void *arg, int success); typedef void (*grpc_iomgr_cb_func)(void *arg, int success);
@ -44,4 +44,4 @@ void grpc_iomgr_shutdown(void);
and causes the invocation of a callback at some point in the future */ and causes the invocation of a callback at some point in the future */
void grpc_iomgr_add_callback(grpc_iomgr_cb_func cb, void *cb_arg); void grpc_iomgr_add_callback(grpc_iomgr_cb_func cb, void *cb_arg);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_IOMGR_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_IOMGR_INTERNAL_H
#define __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ #define GRPC_INTERNAL_CORE_IOMGR_IOMGR_INTERNAL_H
#include "src/core/iomgr/iomgr.h" #include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/iomgr_internal.h"
@ -48,4 +48,4 @@ void grpc_iomgr_unref(void);
void grpc_iomgr_platform_init(void); void grpc_iomgr_platform_init(void);
void grpc_iomgr_platform_shutdown(void); void grpc_iomgr_platform_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_IOMGR_INTERNAL_H */

@ -36,11 +36,14 @@
#ifdef GPR_POSIX_SOCKET #ifdef GPR_POSIX_SOCKET
#include "src/core/iomgr/iomgr_posix.h" #include "src/core/iomgr/iomgr_posix.h"
#include "src/core/debug/trace.h"
#include "src/core/iomgr/fd_posix.h" #include "src/core/iomgr/fd_posix.h"
#include "src/core/iomgr/tcp_posix.h"
void grpc_iomgr_platform_init(void) { void grpc_iomgr_platform_init(void) {
grpc_fd_global_init(); grpc_fd_global_init();
grpc_pollset_global_init(); grpc_pollset_global_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
} }
void grpc_iomgr_platform_shutdown(void) { void grpc_iomgr_platform_shutdown(void) {

@ -31,12 +31,12 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_IOMGR_POSIX_H
#define __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ #define GRPC_INTERNAL_CORE_IOMGR_IOMGR_POSIX_H
#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/iomgr_internal.h"
void grpc_pollset_global_init(void); void grpc_pollset_global_init(void);
void grpc_pollset_global_shutdown(void); void grpc_pollset_global_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_IOMGR_POSIX_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_POLLSET_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_H
#define __GRPC_INTERNAL_IOMGR_POLLSET_H_ #define GRPC_INTERNAL_CORE_IOMGR_POLLSET_H
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
@ -71,4 +71,4 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline);
Requires GRPC_POLLSET_MU(pollset) locked. */ Requires GRPC_POLLSET_MU(pollset) locked. */
void grpc_pollset_kick(grpc_pollset *pollset); void grpc_pollset_kick(grpc_pollset *pollset);
#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_H */

@ -31,8 +31,8 @@
* *
*/ */
#ifndef __GRPC_INTERNAL_IOMGR_POLLSET_KICK_H_ #ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H
#define __GRPC_INTERNAL_IOMGR_POLLSET_KICK_H_ #define GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
@ -71,4 +71,4 @@ void grpc_pollset_kick_post_poll(grpc_pollset_kick_state *kick_state);
void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state); void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state);
#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_KICK_H_ */ #endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save