Merge github.com:grpc/grpc into fix_something

pull/5417/head
Craig Tiller 9 years ago
commit 5389dc334e
  1. 211
      BUILD
  2. 2
      CONTRIBUTING.md
  3. 2
      INSTALL.md
  4. 651
      Makefile
  5. 6
      binding.gyp
  6. 111
      build.yaml
  7. 6
      config.m4
  8. 2
      examples/cpp/helloworld/README.md
  9. 5
      examples/node/package.json
  10. 4
      examples/ruby/route_guide/route_guide_client.rb
  11. 28
      gRPC.podspec
  12. 22
      grpc.gemspec
  13. 2
      include/grpc++/alarm.h
  14. 2
      include/grpc++/channel.h
  15. 29
      include/grpc++/impl/codegen/async_stream.h
  16. 9
      include/grpc++/impl/codegen/async_unary_call.h
  17. 82
      include/grpc++/impl/codegen/call.h
  18. 3
      include/grpc++/impl/codegen/client_context.h
  19. 3
      include/grpc++/impl/codegen/client_unary_call.h
  20. 43
      include/grpc++/impl/codegen/completion_queue.h
  21. 6
      include/grpc++/impl/codegen/completion_queue_tag.h
  22. 97
      include/grpc++/impl/codegen/core_codegen_interface.h
  23. 24
      include/grpc++/impl/codegen/grpc_library.h
  24. 463
      include/grpc++/impl/codegen/impl/async_stream.h
  25. 152
      include/grpc++/impl/codegen/impl/status_code_enum.h
  26. 25
      include/grpc++/impl/codegen/impl/sync.h
  27. 5
      include/grpc++/impl/codegen/method_handler_impl.h
  28. 23
      include/grpc++/impl/codegen/proto_utils.h
  29. 7
      include/grpc++/impl/codegen/server_interface.h
  30. 20
      include/grpc++/impl/codegen/service_type.h
  31. 72
      include/grpc++/impl/codegen/string_ref.h
  32. 21
      include/grpc++/impl/codegen/sync_stream.h
  33. 14
      include/grpc++/impl/grpc_library.h
  34. 6
      include/grpc++/impl/proto_utils.h
  35. 6
      include/grpc++/security/auth_context.h
  36. 8
      include/grpc++/security/auth_metadata_processor.h
  37. 10
      include/grpc++/security/credentials.h
  38. 8
      include/grpc++/security/server_credentials.h
  39. 2
      include/grpc++/server.h
  40. 6
      include/grpc/census.h
  41. 6
      include/grpc/compression.h
  42. 1
      include/grpc/grpc_security.h
  43. 35
      include/grpc/impl/codegen/port_platform.h
  44. 6
      include/grpc/impl/codegen/propagation_bits.h
  45. 6
      include/grpc/support/atm_gcc_atomic.h
  46. 2
      include/grpc/support/subprocess.h
  47. 4
      include/grpc/support/tls.h
  48. 48
      include/grpc/support/tls_gcc.h
  49. 8
      include/grpc/support/tls_msvc.h
  50. 4
      include/grpc/support/tls_pthread.h
  51. 22
      package.json
  52. 22
      package.xml
  53. 7
      setup.py
  54. 8
      src/core/census/aggregation.h
  55. 8
      src/core/census/grpc_filter.h
  56. 72
      src/core/census/grpc_plugin.c
  57. 40
      src/core/census/grpc_plugin.h
  58. 6
      src/core/census/mlog.h
  59. 8
      src/core/census/rpc_metric_id.h
  60. 6
      src/core/channel/channel_args.h
  61. 8
      src/core/channel/channel_stack.h
  62. 259
      src/core/channel/channel_stack_builder.c
  63. 155
      src/core/channel/channel_stack_builder.h
  64. 8
      src/core/channel/client_channel.h
  65. 12
      src/core/channel/client_uchannel.c
  66. 8
      src/core/channel/client_uchannel.h
  67. 8
      src/core/channel/compress_filter.h
  68. 31
      src/core/channel/connected_channel.c
  69. 23
      src/core/channel/connected_channel.h
  70. 8
      src/core/channel/context.h
  71. 8
      src/core/channel/http_client_filter.h
  72. 8
      src/core/channel/http_server_filter.h
  73. 8
      src/core/channel/subchannel_call_holder.h
  74. 8
      src/core/client_config/client_config.h
  75. 9
      src/core/client_config/connector.h
  76. 8
      src/core/client_config/initial_connect_string.h
  77. 6
      src/core/client_config/lb_policies/load_balancer_api.h
  78. 8
      src/core/client_config/lb_policies/pick_first.h
  79. 8
      src/core/client_config/lb_policies/round_robin.h
  80. 6
      src/core/client_config/lb_policy.h
  81. 8
      src/core/client_config/lb_policy_factory.h
  82. 8
      src/core/client_config/lb_policy_registry.h
  83. 8
      src/core/client_config/resolver.h
  84. 8
      src/core/client_config/resolver_factory.h
  85. 8
      src/core/client_config/resolver_registry.h
  86. 8
      src/core/client_config/resolvers/dns_resolver.h
  87. 8
      src/core/client_config/resolvers/sockaddr_resolver.h
  88. 8
      src/core/client_config/resolvers/zookeeper_resolver.h
  89. 114
      src/core/client_config/subchannel.c
  90. 6
      src/core/client_config/subchannel.h
  91. 8
      src/core/client_config/subchannel_factory.h
  92. 1
      src/core/client_config/subchannel_index.c
  93. 6
      src/core/client_config/subchannel_index.h
  94. 8
      src/core/client_config/uri_parser.h
  95. 8
      src/core/compression/algorithm_metadata.h
  96. 47
      src/core/compression/compression_algorithm.c
  97. 8
      src/core/compression/message_compress.h
  98. 8
      src/core/debug/trace.h
  99. 8
      src/core/httpcli/format_request.h
  100. 6
      src/core/httpcli/httpcli.h
  101. Some files were not shown because too many files have changed in this diff Show More

211
BUILD

@ -45,6 +45,7 @@ cc_library(
name = "gpr",
srcs = [
"src/core/profiling/timers.h",
"src/core/support/backoff.h",
"src/core/support/block_annotate.h",
"src/core/support/env.h",
"src/core/support/load_file.h",
@ -59,6 +60,7 @@ cc_library(
"src/core/profiling/stap_timers.c",
"src/core/support/alloc.c",
"src/core/support/avl.c",
"src/core/support/backoff.c",
"src/core/support/cmdline.c",
"src/core/support/cpu_iphone.c",
"src/core/support/cpu_linux.c",
@ -156,8 +158,10 @@ cc_library(
name = "grpc",
srcs = [
"src/core/census/grpc_filter.h",
"src/core/census/grpc_plugin.h",
"src/core/channel/channel_args.h",
"src/core/channel/channel_stack.h",
"src/core/channel/channel_stack_builder.h",
"src/core/channel/client_channel.h",
"src/core/channel/client_uchannel.h",
"src/core/channel/compress_filter.h",
@ -237,9 +241,12 @@ cc_library(
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/channel_init.h",
"src/core/surface/channel_stack_type.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
"src/core/transport/byte_stream.h",
@ -293,8 +300,10 @@ cc_library(
"third_party/nanopb/pb_encode.h",
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
"src/core/census/grpc_plugin.c",
"src/core/channel/channel_args.c",
"src/core/channel/channel_stack.c",
"src/core/channel/channel_stack_builder.c",
"src/core/channel/client_channel.c",
"src/core/channel/client_uchannel.c",
"src/core/channel/compress_filter.c",
@ -382,7 +391,9 @@ cc_library(
"src/core/surface/channel.c",
"src/core/surface/channel_connectivity.c",
"src/core/surface/channel_create.c",
"src/core/surface/channel_init.c",
"src/core/surface/channel_ping.c",
"src/core/surface/channel_stack_type.c",
"src/core/surface/completion_queue.c",
"src/core/surface/event_string.c",
"src/core/surface/init.c",
@ -390,7 +401,6 @@ cc_library(
"src/core/surface/metadata_array.c",
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/validate_metadata.c",
"src/core/surface/version.c",
"src/core/transport/byte_stream.c",
@ -454,17 +464,17 @@ cc_library(
],
hdrs = [
"include/grpc/grpc_security.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/census.h",
],
includes = [
@ -482,12 +492,50 @@ cc_library(
)
cc_library(
name = "grpc_codegen_lib",
srcs = [
],
hdrs = [
"include/grpc/impl/codegen/alloc.h",
"include/grpc/impl/codegen/atm.h",
"include/grpc/impl/codegen/atm_gcc_atomic.h",
"include/grpc/impl/codegen/atm_gcc_sync.h",
"include/grpc/impl/codegen/atm_win32.h",
"include/grpc/impl/codegen/log.h",
"include/grpc/impl/codegen/port_platform.h",
"include/grpc/impl/codegen/slice.h",
"include/grpc/impl/codegen/slice_buffer.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",
"include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
],
includes = [
"include",
".",
],
deps = [
"//external:protobuf_compiler",
],
)
cc_library(
name = "grpc_unsecure",
srcs = [
"src/core/census/grpc_filter.h",
"src/core/census/grpc_plugin.h",
"src/core/channel/channel_args.h",
"src/core/channel/channel_stack.h",
"src/core/channel/channel_stack_builder.h",
"src/core/channel/client_channel.h",
"src/core/channel/client_uchannel.h",
"src/core/channel/compress_filter.h",
@ -567,9 +615,12 @@ cc_library(
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/channel_init.h",
"src/core/surface/channel_stack_type.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
"src/core/transport/byte_stream.h",
@ -610,8 +661,10 @@ cc_library(
"src/core/surface/init_unsecure.c",
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
"src/core/census/grpc_plugin.c",
"src/core/channel/channel_args.c",
"src/core/channel/channel_stack.c",
"src/core/channel/channel_stack_builder.c",
"src/core/channel/client_channel.c",
"src/core/channel/client_uchannel.c",
"src/core/channel/compress_filter.c",
@ -699,7 +752,9 @@ cc_library(
"src/core/surface/channel.c",
"src/core/surface/channel_connectivity.c",
"src/core/surface/channel_create.c",
"src/core/surface/channel_init.c",
"src/core/surface/channel_ping.c",
"src/core/surface/channel_stack_type.c",
"src/core/surface/completion_queue.c",
"src/core/surface/event_string.c",
"src/core/surface/init.c",
@ -707,7 +762,6 @@ cc_library(
"src/core/surface/metadata_array.c",
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/validate_metadata.c",
"src/core/surface/version.c",
"src/core/transport/byte_stream.c",
@ -799,9 +853,11 @@ cc_library(
name = "grpc++",
srcs = [
"src/cpp/client/secure_credentials.h",
"src/cpp/common/core_codegen.h",
"src/cpp/common/secure_auth_context.h",
"src/cpp/server/secure_server_credentials.h",
"src/cpp/client/create_channel_internal.h",
"src/cpp/common/core_codegen.h",
"src/cpp/common/create_auth_context.h",
"src/cpp/server/dynamic_thread_pool.h",
"src/cpp/server/thread_pool_interface.h",
@ -818,11 +874,10 @@ cc_library(
"src/cpp/client/credentials.cc",
"src/cpp/client/generic_stub.cc",
"src/cpp/client/insecure_credentials.cc",
"src/cpp/common/call.cc",
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/core_codegen.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/async_generic_service.cc",
"src/cpp/server/create_default_thread_pool.cc",
"src/cpp/server/dynamic_thread_pool.cc",
@ -836,7 +891,7 @@ cc_library(
"src/cpp/util/status.cc",
"src/cpp/util/string_ref.cc",
"src/cpp/util/time.cc",
"src/cpp/codegen/grpc_library.cc",
"src/cpp/codegen/codegen_init.cc",
],
hdrs = [
"include/grpc++/alarm.h",
@ -894,6 +949,7 @@ cc_library(
"include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/config.h",
"include/grpc++/impl/codegen/config_protobuf.h",
"include/grpc++/impl/codegen/core_codegen_interface.h",
"include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h",
@ -926,10 +982,79 @@ cc_library(
)
cc_library(
name = "grpc++_codegen_lib",
srcs = [
"src/cpp/codegen/codegen_init.cc",
],
hdrs = [
"include/grpc/impl/codegen/alloc.h",
"include/grpc/impl/codegen/atm.h",
"include/grpc/impl/codegen/atm_gcc_atomic.h",
"include/grpc/impl/codegen/atm_gcc_sync.h",
"include/grpc/impl/codegen/atm_win32.h",
"include/grpc/impl/codegen/log.h",
"include/grpc/impl/codegen/port_platform.h",
"include/grpc/impl/codegen/slice.h",
"include/grpc/impl/codegen/slice_buffer.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",
"include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc++/impl/codegen/async_stream.h",
"include/grpc++/impl/codegen/async_unary_call.h",
"include/grpc++/impl/codegen/call.h",
"include/grpc++/impl/codegen/call_hook.h",
"include/grpc++/impl/codegen/channel_interface.h",
"include/grpc++/impl/codegen/client_context.h",
"include/grpc++/impl/codegen/client_unary_call.h",
"include/grpc++/impl/codegen/completion_queue.h",
"include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/config.h",
"include/grpc++/impl/codegen/config_protobuf.h",
"include/grpc++/impl/codegen/core_codegen_interface.h",
"include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h",
"include/grpc++/impl/codegen/rpc_method.h",
"include/grpc++/impl/codegen/rpc_service_method.h",
"include/grpc++/impl/codegen/security/auth_context.h",
"include/grpc++/impl/codegen/serialization_traits.h",
"include/grpc++/impl/codegen/server_context.h",
"include/grpc++/impl/codegen/server_interface.h",
"include/grpc++/impl/codegen/service_type.h",
"include/grpc++/impl/codegen/status.h",
"include/grpc++/impl/codegen/status_code_enum.h",
"include/grpc++/impl/codegen/string_ref.h",
"include/grpc++/impl/codegen/stub_options.h",
"include/grpc++/impl/codegen/sync.h",
"include/grpc++/impl/codegen/sync_cxx11.h",
"include/grpc++/impl/codegen/sync_no_cxx11.h",
"include/grpc++/impl/codegen/sync_stream.h",
"include/grpc++/impl/codegen/time.h",
],
includes = [
"include",
".",
],
deps = [
"//external:protobuf_compiler",
],
)
cc_library(
name = "grpc++_unsecure",
srcs = [
"src/cpp/client/create_channel_internal.h",
"src/cpp/common/core_codegen.h",
"src/cpp/common/create_auth_context.h",
"src/cpp/server/dynamic_thread_pool.h",
"src/cpp/server/thread_pool_interface.h",
@ -941,11 +1066,10 @@ cc_library(
"src/cpp/client/credentials.cc",
"src/cpp/client/generic_stub.cc",
"src/cpp/client/insecure_credentials.cc",
"src/cpp/common/call.cc",
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/core_codegen.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/async_generic_service.cc",
"src/cpp/server/create_default_thread_pool.cc",
"src/cpp/server/dynamic_thread_pool.cc",
@ -959,7 +1083,7 @@ cc_library(
"src/cpp/util/status.cc",
"src/cpp/util/string_ref.cc",
"src/cpp/util/time.cc",
"src/cpp/codegen/grpc_library.cc",
"src/cpp/codegen/codegen_init.cc",
],
hdrs = [
"include/grpc++/alarm.h",
@ -1017,6 +1141,7 @@ cc_library(
"include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/config.h",
"include/grpc++/impl/codegen/config_protobuf.h",
"include/grpc++/impl/codegen/core_codegen_interface.h",
"include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h",
@ -1072,45 +1197,8 @@ cc_library(
"src/compiler/objective_c_generator.cc",
"src/compiler/python_generator.cc",
"src/compiler/ruby_generator.cc",
"src/cpp/codegen/grpc_library.cc",
],
hdrs = [
"include/grpc++/impl/codegen/async_stream.h",
"include/grpc++/impl/codegen/async_unary_call.h",
"include/grpc++/impl/codegen/call.h",
"include/grpc++/impl/codegen/call_hook.h",
"include/grpc++/impl/codegen/channel_interface.h",
"include/grpc++/impl/codegen/client_context.h",
"include/grpc++/impl/codegen/client_unary_call.h",
"include/grpc++/impl/codegen/completion_queue.h",
"include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/config.h",
"include/grpc++/impl/codegen/config_protobuf.h",
"include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h",
"include/grpc++/impl/codegen/rpc_method.h",
"include/grpc++/impl/codegen/rpc_service_method.h",
"include/grpc++/impl/codegen/security/auth_context.h",
"include/grpc++/impl/codegen/serialization_traits.h",
"include/grpc++/impl/codegen/server_context.h",
"include/grpc++/impl/codegen/server_interface.h",
"include/grpc++/impl/codegen/service_type.h",
"include/grpc++/impl/codegen/status.h",
"include/grpc++/impl/codegen/status_code_enum.h",
"include/grpc++/impl/codegen/string_ref.h",
"include/grpc++/impl/codegen/stub_options.h",
"include/grpc++/impl/codegen/sync.h",
"include/grpc++/impl/codegen/sync_cxx11.h",
"include/grpc++/impl/codegen/sync_no_cxx11.h",
"include/grpc++/impl/codegen/sync_stream.h",
"include/grpc++/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/impl/codegen/alloc.h",
"include/grpc/impl/codegen/atm.h",
"include/grpc/impl/codegen/atm_gcc_atomic.h",
@ -1132,6 +1220,7 @@ cc_library(
],
deps = [
"//external:protobuf_compiler",
":grpc++_codegen_lib",
],
)
@ -1162,6 +1251,7 @@ objc_library(
"src/core/profiling/stap_timers.c",
"src/core/support/alloc.c",
"src/core/support/avl.c",
"src/core/support/backoff.c",
"src/core/support/cmdline.c",
"src/core/support/cpu_iphone.c",
"src/core/support/cpu_linux.c",
@ -1246,6 +1336,7 @@ objc_library(
"include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h",
"src/core/profiling/timers.h",
"src/core/support/backoff.h",
"src/core/support/block_annotate.h",
"src/core/support/env.h",
"src/core/support/load_file.h",
@ -1271,8 +1362,10 @@ objc_library(
srcs = [
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
"src/core/census/grpc_plugin.c",
"src/core/channel/channel_args.c",
"src/core/channel/channel_stack.c",
"src/core/channel/channel_stack_builder.c",
"src/core/channel/client_channel.c",
"src/core/channel/client_uchannel.c",
"src/core/channel/compress_filter.c",
@ -1360,7 +1453,9 @@ objc_library(
"src/core/surface/channel.c",
"src/core/surface/channel_connectivity.c",
"src/core/surface/channel_create.c",
"src/core/surface/channel_init.c",
"src/core/surface/channel_ping.c",
"src/core/surface/channel_stack_type.c",
"src/core/surface/completion_queue.c",
"src/core/surface/event_string.c",
"src/core/surface/init.c",
@ -1368,7 +1463,6 @@ objc_library(
"src/core/surface/metadata_array.c",
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/validate_metadata.c",
"src/core/surface/version.c",
"src/core/transport/byte_stream.c",
@ -1432,21 +1526,23 @@ objc_library(
],
hdrs = [
"include/grpc/grpc_security.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/census.h",
"src/core/census/grpc_filter.h",
"src/core/census/grpc_plugin.h",
"src/core/channel/channel_args.h",
"src/core/channel/channel_stack.h",
"src/core/channel/channel_stack_builder.h",
"src/core/channel/client_channel.h",
"src/core/channel/client_uchannel.h",
"src/core/channel/compress_filter.h",
@ -1526,9 +1622,12 @@ objc_library(
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/channel_init.h",
"src/core/surface/channel_stack_type.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
"src/core/transport/byte_stream.h",

@ -59,7 +59,7 @@ Each language uses its own build system to work. Currently, the root's Makefile
and the Visual Studio project files are building only the C and C++ source code.
In order to ease the maintenance of these files, we have a
template system. Please do not contribute manual changes to any of the generated
files. Instead, modify the template files, or the build.json file, and
files. Instead, modify the template files, or the build.yaml file, and
re-generate the project files using the following command:
`./tools/buildgen/generate_projects.sh`

@ -52,6 +52,6 @@ gRPC C Core library.
$ git clone https://github.com/grpc/grpc.git
$ cd grpc
$ git submodule update --init
$ make
$ make
$ [sudo] make install
```

File diff suppressed because it is too large Load Diff

@ -496,6 +496,7 @@
'src/core/profiling/stap_timers.c',
'src/core/support/alloc.c',
'src/core/support/avl.c',
'src/core/support/backoff.c',
'src/core/support/cmdline.c',
'src/core/support/cpu_iphone.c',
'src/core/support/cpu_linux.c',
@ -559,8 +560,10 @@
'sources': [
'src/core/census/grpc_context.c',
'src/core/census/grpc_filter.c',
'src/core/census/grpc_plugin.c',
'src/core/channel/channel_args.c',
'src/core/channel/channel_stack.c',
'src/core/channel/channel_stack_builder.c',
'src/core/channel/client_channel.c',
'src/core/channel/client_uchannel.c',
'src/core/channel/compress_filter.c',
@ -648,7 +651,9 @@
'src/core/surface/channel.c',
'src/core/surface/channel_connectivity.c',
'src/core/surface/channel_create.c',
'src/core/surface/channel_init.c',
'src/core/surface/channel_ping.c',
'src/core/surface/channel_stack_type.c',
'src/core/surface/completion_queue.c',
'src/core/surface/event_string.c',
'src/core/surface/init.c',
@ -656,7 +661,6 @@
'src/core/surface/metadata_array.c',
'src/core/surface/server.c',
'src/core/surface/server_chttp2.c',
'src/core/surface/server_create.c',
'src/core/surface/validate_metadata.c',
'src/core/surface/version.c',
'src/core/transport/byte_stream.c',

@ -55,6 +55,7 @@ filegroups:
- include/grpc/support/useful.h
headers:
- src/core/profiling/timers.h
- src/core/support/backoff.h
- src/core/support/block_annotate.h
- src/core/support/env.h
- src/core/support/load_file.h
@ -70,6 +71,7 @@ filegroups:
- src/core/profiling/stap_timers.c
- src/core/support/alloc.c
- src/core/support/avl.c
- src/core/support/backoff.c
- src/core/support/cmdline.c
- src/core/support/cpu_iphone.c
- src/core/support/cpu_linux.c
@ -173,6 +175,7 @@ filegroups:
- include/grpc++/support/time.h
headers:
- src/cpp/client/create_channel_internal.h
- src/cpp/common/core_codegen.h
- src/cpp/common/create_auth_context.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/thread_pool_interface.h
@ -184,11 +187,10 @@ filegroups:
- src/cpp/client/credentials.cc
- src/cpp/client/generic_stub.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/common/call.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue.cc
- src/cpp/common/core_codegen.cc
- src/cpp/common/rpc_method.cc
- src/cpp/proto/proto_utils.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/dynamic_thread_pool.cc
@ -215,6 +217,7 @@ filegroups:
- include/grpc++/impl/codegen/completion_queue_tag.h
- include/grpc++/impl/codegen/config.h
- include/grpc++/impl/codegen/config_protobuf.h
- include/grpc++/impl/codegen/core_codegen_interface.h
- include/grpc++/impl/codegen/grpc_library.h
- include/grpc++/impl/codegen/method_handler_impl.h
- include/grpc++/impl/codegen/proto_utils.h
@ -235,7 +238,7 @@ filegroups:
- include/grpc++/impl/codegen/sync_stream.h
- include/grpc++/impl/codegen/time.h
src:
- src/cpp/codegen/grpc_library.cc
- src/cpp/codegen/codegen_init.cc
- name: grpc_base
public_headers:
- include/grpc/byte_buffer.h
@ -245,8 +248,10 @@ filegroups:
- include/grpc/status.h
headers:
- src/core/census/grpc_filter.h
- src/core/census/grpc_plugin.h
- src/core/channel/channel_args.h
- src/core/channel/channel_stack.h
- src/core/channel/channel_stack_builder.h
- src/core/channel/client_channel.h
- src/core/channel/client_uchannel.h
- src/core/channel/compress_filter.h
@ -326,9 +331,12 @@ filegroups:
- src/core/surface/call.h
- src/core/surface/call_test_only.h
- src/core/surface/channel.h
- src/core/surface/channel_init.h
- src/core/surface/channel_stack_type.h
- src/core/surface/completion_queue.h
- src/core/surface/event_string.h
- src/core/surface/init.h
- src/core/surface/lame_client.h
- src/core/surface/server.h
- src/core/surface/surface_trace.h
- src/core/transport/byte_stream.h
@ -362,8 +370,10 @@ filegroups:
src:
- src/core/census/grpc_context.c
- src/core/census/grpc_filter.c
- src/core/census/grpc_plugin.c
- src/core/channel/channel_args.c
- src/core/channel/channel_stack.c
- src/core/channel/channel_stack_builder.c
- src/core/channel/client_channel.c
- src/core/channel/client_uchannel.c
- src/core/channel/compress_filter.c
@ -451,7 +461,9 @@ filegroups:
- src/core/surface/channel.c
- src/core/surface/channel_connectivity.c
- src/core/surface/channel_create.c
- src/core/surface/channel_init.c
- src/core/surface/channel_ping.c
- src/core/surface/channel_stack_type.c
- src/core/surface/completion_queue.c
- src/core/surface/event_string.c
- src/core/surface/init.c
@ -459,7 +471,6 @@ filegroups:
- src/core/surface/metadata_array.c
- src/core/surface/server.c
- src/core/surface/server_chttp2.c
- src/core/surface/server_create.c
- src/core/surface/validate_metadata.c
- src/core/surface/version.c
- src/core/transport/byte_stream.c
@ -544,6 +555,7 @@ filegroups:
- test/core/util/grpc_profiler.h
- test/core/util/parse_hexstring.h
- test/core/util/port.h
- test/core/util/port_server_client.h
- test/core/util/slice_splitter.h
src:
- test/core/end2end/cq_verifier.c
@ -552,6 +564,7 @@ filegroups:
- test/core/util/grpc_profiler.c
- test/core/util/parse_hexstring.c
- test/core/util/port_posix.c
- test/core/util/port_server_client.c
- test/core/util/port_windows.c
- test/core/util/slice_splitter.c
- name: nanopb
@ -595,9 +608,9 @@ libs:
deps_linkage: static
dll: true
filegroups:
- grpc_codegen
- grpc_base
- grpc_secure
- grpc_codegen
- census
- nanopb
secure: true
@ -605,6 +618,16 @@ libs:
- grpc.dependencies.openssl
- grpc.dependencies.zlib
vs_project_guid: '{29D16885-7228-4C31-81ED-5F9187C7F2A9}'
- name: grpc_codegen_lib
build: protoc
language: c
headers: []
src: []
filegroups:
- gpr_codegen
- grpc_codegen
secure: false
vs_project_guid: '{A828FD72-44CE-4EA5-8966-6E4624458D58}'
- name: grpc_dll
build: private
language: c
@ -719,6 +742,7 @@ libs:
language: c++
headers:
- src/cpp/client/secure_credentials.h
- src/cpp/common/core_codegen.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/secure_server_credentials.h
src:
@ -737,6 +761,17 @@ libs:
- grpc++_codegen
secure: check
vs_project_guid: '{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}'
- name: grpc++_codegen_lib
build: protoc
language: c++
headers: []
src: []
filegroups:
- gpr_codegen
- grpc_codegen
- grpc++_codegen
secure: false
vs_project_guid: '{AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}'
- name: grpc++_test_config
build: private
language: c++
@ -809,10 +844,9 @@ libs:
- src/compiler/objective_c_generator.cc
- src/compiler/python_generator.cc
- src/compiler/ruby_generator.cc
deps: []
deps:
- grpc++_codegen_lib
filegroups:
- grpc++_codegen
- grpc_codegen
- gpr_codegen
secure: false
vs_project_guid: '{B6E81D84-2ACB-41B8-8781-493A944C7817}'
@ -1215,6 +1249,14 @@ targets:
deps:
- gpr_test_util
- gpr
- name: gpr_backoff_test
build: test
language: c
src:
- test/core/support/backoff_test.c
deps:
- gpr_test_util
- gpr
- name: gpr_cmdline_test
build: test
language: c
@ -1639,6 +1681,7 @@ targets:
- gpr
- name: lb_policies_test
cpu_cost: 0.1
flaky: true
build: test
language: c
src:
@ -2100,6 +2143,20 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: codegen_test
gtest: true
build: test
language: c++
src:
- src/proto/grpc/testing/control.proto
- src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/payloads.proto
- src/proto/grpc/testing/perf_db.proto
- src/proto/grpc/testing/services.proto
- src/proto/grpc/testing/stats.proto
- test/cpp/codegen/codegen_test.cc
deps:
- grpc++_codegen_lib
- name: credentials_test
gtest: true
build: test
@ -2400,7 +2457,7 @@ targets:
- linux
- posix
- name: qps_openloop_test
cpu_cost: 10
cpu_cost: 0.5
build: test
language: c++
src:
@ -2414,6 +2471,8 @@ targets:
- gpr_test_util
- gpr
- grpc++_test_config
exclude_configs:
- tsan
platforms:
- mac
- linux
@ -2433,6 +2492,8 @@ targets:
- gpr_test_util
- gpr
- grpc++_test_config
exclude_configs:
- tsan
platforms:
- mac
- linux
@ -2745,6 +2806,36 @@ configs:
dbg:
CPPFLAGS: -O0
DEFINES: _DEBUG DEBUG
easan:
CC: clang
CPPFLAGS: -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument
-DGPR_NO_DIRECT_SYSCALLS
CXX: clang++
DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER
LD: clang
LDFLAGS: -fsanitize=address
LDXX: clang++
compile_the_world: true
test_environ:
ASAN_OPTIONS: detect_leaks=1:color=always
LSAN_OPTIONS: suppressions=tools/lsan_suppressions.txt:report_objects=1
timeout_multiplier: 3
edbg:
CPPFLAGS: -O0
DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER
etsan:
CC: clang
CPPFLAGS: -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument
-fPIE -pie -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++
DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER
LD: clang
LDFLAGS: -fsanitize=thread -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,)
LDXX: clang++
compile_the_world: true
test_environ:
TSAN_OPTIONS: suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
timeout_multiplier: 5
gcov:
CC: gcc
CPPFLAGS: -O0 -fprofile-arcs -ftest-coverage -Wno-return-type
@ -2859,7 +2950,7 @@ node_modules:
- src/node/ext/server_credentials.cc
- src/node/ext/timeval.cc
openssl_fallback:
base_uri: http://openssl.org/source/
base_uri: https://openssl.org/source/old/1.0.2/
extraction_dir: openssl-1.0.2f
tarball: openssl-1.0.2f.tar.gz
php_config_m4:

@ -40,6 +40,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/profiling/stap_timers.c \
src/core/support/alloc.c \
src/core/support/avl.c \
src/core/support/backoff.c \
src/core/support/cmdline.c \
src/core/support/cpu_iphone.c \
src/core/support/cpu_linux.c \
@ -81,8 +82,10 @@ if test "$PHP_GRPC" != "no"; then
src/core/support/wrap_memcpy.c \
src/core/census/grpc_context.c \
src/core/census/grpc_filter.c \
src/core/census/grpc_plugin.c \
src/core/channel/channel_args.c \
src/core/channel/channel_stack.c \
src/core/channel/channel_stack_builder.c \
src/core/channel/client_channel.c \
src/core/channel/client_uchannel.c \
src/core/channel/compress_filter.c \
@ -170,7 +173,9 @@ if test "$PHP_GRPC" != "no"; then
src/core/surface/channel.c \
src/core/surface/channel_connectivity.c \
src/core/surface/channel_create.c \
src/core/surface/channel_init.c \
src/core/surface/channel_ping.c \
src/core/surface/channel_stack_type.c \
src/core/surface/completion_queue.c \
src/core/surface/event_string.c \
src/core/surface/init.c \
@ -178,7 +183,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/surface/metadata_array.c \
src/core/surface/server.c \
src/core/surface/server_chttp2.c \
src/core/surface/server_create.c \
src/core/surface/validate_metadata.c \
src/core/surface/version.c \
src/core/transport/byte_stream.c \

@ -207,7 +207,7 @@ completion queue to return the tag. The basic flow is
helloworld::Greeter::AsyncService service;
ServerBuilder builder;
builder.AddListeningPort("0.0.0.0:50051", InsecureServerCredentials());
builder.RegisterAsyncService(&service);
builder.RegisterService(&service);
auto cq = builder.AddCompletionQueue();
auto server = builder.BuildAndStart();
```

@ -2,6 +2,9 @@
"name": "grpc-examples",
"version": "0.1.0",
"dependencies": {
"grpc": "0.13.0"
"async": "^1.5.2",
"grpc": "0.13.0",
"lodash": "^4.6.1",
"minimist": "^1.2.0"
}
}

@ -38,6 +38,7 @@ lib_dir = File.join(File.dirname(this_dir), 'lib')
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
require 'grpc'
require 'multi_json'
require 'route_guide_services'
include Routeguide
@ -115,9 +116,8 @@ def run_record_route(stub, features)
p 'RecordRoute'
p '-----------'
points_on_route = 10 # arbitrary
deadline = points_on_route # as delay b/w each is max 1 second
reqs = RandomRoute.new(features, points_on_route)
resp = stub.record_route(reqs.each, deadline)
resp = stub.record_route(reqs.each)
p "summary: #{resp.inspect}"
end

@ -64,6 +64,7 @@ Pod::Spec.new do |s|
# Core cross-platform gRPC library, written in C.
s.subspec 'C-Core' do |ss|
ss.source_files = 'src/core/profiling/timers.h',
'src/core/support/backoff.h',
'src/core/support/block_annotate.h',
'src/core/support/env.h',
'src/core/support/load_file.h',
@ -120,6 +121,7 @@ Pod::Spec.new do |s|
'src/core/profiling/stap_timers.c',
'src/core/support/alloc.c',
'src/core/support/avl.c',
'src/core/support/backoff.c',
'src/core/support/cmdline.c',
'src/core/support/cpu_iphone.c',
'src/core/support/cpu_linux.c',
@ -160,8 +162,10 @@ Pod::Spec.new do |s|
'src/core/support/tmpfile_win32.c',
'src/core/support/wrap_memcpy.c',
'src/core/census/grpc_filter.h',
'src/core/census/grpc_plugin.h',
'src/core/channel/channel_args.h',
'src/core/channel/channel_stack.h',
'src/core/channel/channel_stack_builder.h',
'src/core/channel/client_channel.h',
'src/core/channel/client_uchannel.h',
'src/core/channel/compress_filter.h',
@ -241,9 +245,12 @@ Pod::Spec.new do |s|
'src/core/surface/call.h',
'src/core/surface/call_test_only.h',
'src/core/surface/channel.h',
'src/core/surface/channel_init.h',
'src/core/surface/channel_stack_type.h',
'src/core/surface/completion_queue.h',
'src/core/surface/event_string.h',
'src/core/surface/init.h',
'src/core/surface/lame_client.h',
'src/core/surface/server.h',
'src/core/surface/surface_trace.h',
'src/core/transport/byte_stream.h',
@ -296,22 +303,24 @@ Pod::Spec.new do |s|
'third_party/nanopb/pb_decode.h',
'third_party/nanopb/pb_encode.h',
'include/grpc/grpc_security.h',
'include/grpc/byte_buffer.h',
'include/grpc/byte_buffer_reader.h',
'include/grpc/compression.h',
'include/grpc/grpc.h',
'include/grpc/status.h',
'include/grpc/impl/codegen/byte_buffer.h',
'include/grpc/impl/codegen/compression_types.h',
'include/grpc/impl/codegen/connectivity_state.h',
'include/grpc/impl/codegen/grpc_types.h',
'include/grpc/impl/codegen/propagation_bits.h',
'include/grpc/impl/codegen/status.h',
'include/grpc/byte_buffer.h',
'include/grpc/byte_buffer_reader.h',
'include/grpc/compression.h',
'include/grpc/grpc.h',
'include/grpc/status.h',
'include/grpc/census.h',
'src/core/census/grpc_context.c',
'src/core/census/grpc_filter.c',
'src/core/census/grpc_plugin.c',
'src/core/channel/channel_args.c',
'src/core/channel/channel_stack.c',
'src/core/channel/channel_stack_builder.c',
'src/core/channel/client_channel.c',
'src/core/channel/client_uchannel.c',
'src/core/channel/compress_filter.c',
@ -399,7 +408,9 @@ Pod::Spec.new do |s|
'src/core/surface/channel.c',
'src/core/surface/channel_connectivity.c',
'src/core/surface/channel_create.c',
'src/core/surface/channel_init.c',
'src/core/surface/channel_ping.c',
'src/core/surface/channel_stack_type.c',
'src/core/surface/completion_queue.c',
'src/core/surface/event_string.c',
'src/core/surface/init.c',
@ -407,7 +418,6 @@ Pod::Spec.new do |s|
'src/core/surface/metadata_array.c',
'src/core/surface/server.c',
'src/core/surface/server_chttp2.c',
'src/core/surface/server_create.c',
'src/core/surface/validate_metadata.c',
'src/core/surface/version.c',
'src/core/transport/byte_stream.c',
@ -470,6 +480,7 @@ Pod::Spec.new do |s|
'third_party/nanopb/pb_encode.c'
ss.private_header_files = 'src/core/profiling/timers.h',
'src/core/support/backoff.h',
'src/core/support/block_annotate.h',
'src/core/support/env.h',
'src/core/support/load_file.h',
@ -481,8 +492,10 @@ Pod::Spec.new do |s|
'src/core/support/time_precise.h',
'src/core/support/tmpfile.h',
'src/core/census/grpc_filter.h',
'src/core/census/grpc_plugin.h',
'src/core/channel/channel_args.h',
'src/core/channel/channel_stack.h',
'src/core/channel/channel_stack_builder.h',
'src/core/channel/client_channel.h',
'src/core/channel/client_uchannel.h',
'src/core/channel/compress_filter.h',
@ -562,9 +575,12 @@ Pod::Spec.new do |s|
'src/core/surface/call.h',
'src/core/surface/call_test_only.h',
'src/core/surface/channel.h',
'src/core/surface/channel_init.h',
'src/core/surface/channel_stack_type.h',
'src/core/surface/completion_queue.h',
'src/core/surface/event_string.h',
'src/core/surface/init.h',
'src/core/surface/lame_client.h',
'src/core/surface/server.h',
'src/core/surface/surface_trace.h',
'src/core/transport/byte_stream.h',

@ -89,6 +89,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/sync_win32.h )
s.files += %w( include/grpc/impl/codegen/time.h )
s.files += %w( src/core/profiling/timers.h )
s.files += %w( src/core/support/backoff.h )
s.files += %w( src/core/support/block_annotate.h )
s.files += %w( src/core/support/env.h )
s.files += %w( src/core/support/load_file.h )
@ -103,6 +104,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/profiling/stap_timers.c )
s.files += %w( src/core/support/alloc.c )
s.files += %w( src/core/support/avl.c )
s.files += %w( src/core/support/backoff.c )
s.files += %w( src/core/support/cmdline.c )
s.files += %w( src/core/support/cpu_iphone.c )
s.files += %w( src/core/support/cpu_linux.c )
@ -143,21 +145,23 @@ Gem::Specification.new do |s|
s.files += %w( src/core/support/tmpfile_win32.c )
s.files += %w( src/core/support/wrap_memcpy.c )
s.files += %w( include/grpc/grpc_security.h )
s.files += %w( include/grpc/byte_buffer.h )
s.files += %w( include/grpc/byte_buffer_reader.h )
s.files += %w( include/grpc/compression.h )
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer.h )
s.files += %w( include/grpc/impl/codegen/compression_types.h )
s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
s.files += %w( include/grpc/impl/codegen/grpc_types.h )
s.files += %w( include/grpc/impl/codegen/propagation_bits.h )
s.files += %w( include/grpc/impl/codegen/status.h )
s.files += %w( include/grpc/byte_buffer.h )
s.files += %w( include/grpc/byte_buffer_reader.h )
s.files += %w( include/grpc/compression.h )
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/census.h )
s.files += %w( src/core/census/grpc_filter.h )
s.files += %w( src/core/census/grpc_plugin.h )
s.files += %w( src/core/channel/channel_args.h )
s.files += %w( src/core/channel/channel_stack.h )
s.files += %w( src/core/channel/channel_stack_builder.h )
s.files += %w( src/core/channel/client_channel.h )
s.files += %w( src/core/channel/client_uchannel.h )
s.files += %w( src/core/channel/compress_filter.h )
@ -237,9 +241,12 @@ Gem::Specification.new do |s|
s.files += %w( src/core/surface/call.h )
s.files += %w( src/core/surface/call_test_only.h )
s.files += %w( src/core/surface/channel.h )
s.files += %w( src/core/surface/channel_init.h )
s.files += %w( src/core/surface/channel_stack_type.h )
s.files += %w( src/core/surface/completion_queue.h )
s.files += %w( src/core/surface/event_string.h )
s.files += %w( src/core/surface/init.h )
s.files += %w( src/core/surface/lame_client.h )
s.files += %w( src/core/surface/server.h )
s.files += %w( src/core/surface/surface_trace.h )
s.files += %w( src/core/transport/byte_stream.h )
@ -293,8 +300,10 @@ Gem::Specification.new do |s|
s.files += %w( third_party/nanopb/pb_encode.h )
s.files += %w( src/core/census/grpc_context.c )
s.files += %w( src/core/census/grpc_filter.c )
s.files += %w( src/core/census/grpc_plugin.c )
s.files += %w( src/core/channel/channel_args.c )
s.files += %w( src/core/channel/channel_stack.c )
s.files += %w( src/core/channel/channel_stack_builder.c )
s.files += %w( src/core/channel/client_channel.c )
s.files += %w( src/core/channel/client_uchannel.c )
s.files += %w( src/core/channel/compress_filter.c )
@ -382,7 +391,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/surface/channel.c )
s.files += %w( src/core/surface/channel_connectivity.c )
s.files += %w( src/core/surface/channel_create.c )
s.files += %w( src/core/surface/channel_init.c )
s.files += %w( src/core/surface/channel_ping.c )
s.files += %w( src/core/surface/channel_stack_type.c )
s.files += %w( src/core/surface/completion_queue.c )
s.files += %w( src/core/surface/event_string.c )
s.files += %w( src/core/surface/init.c )
@ -390,7 +401,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/surface/metadata_array.c )
s.files += %w( src/core/surface/server.c )
s.files += %w( src/core/surface/server_chttp2.c )
s.files += %w( src/core/surface/server_create.c )
s.files += %w( src/core/surface/validate_metadata.c )
s.files += %w( src/core/surface/version.c )
s.files += %w( src/core/transport/byte_stream.c )

@ -50,7 +50,7 @@ namespace grpc {
class CompletionQueue;
/// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h).
class Alarm : private GrpcLibrary {
class Alarm : private GrpcLibraryCodegen {
public:
/// Create a completion queue alarm instance associated to \a cq.
///

@ -49,7 +49,7 @@ namespace grpc {
class Channel GRPC_FINAL : public ChannelInterface,
public CallHook,
public std::enable_shared_from_this<Channel>,
private GrpcLibrary {
private GrpcLibraryCodegen {
public:
~Channel();

@ -34,10 +34,11 @@
#ifndef GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
#define GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/call.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/server_context.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
namespace grpc {
@ -109,13 +110,13 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
init_ops_.set_output_tag(tag);
init_ops_.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
GPR_ASSERT(init_ops_.SendMessage(request).ok());
GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
init_ops_.ClientSendClose();
call_.PerformOps(&init_ops_);
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -177,7 +178,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -187,7 +188,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@ -243,7 +244,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -262,7 +263,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@ -300,7 +301,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -331,7 +332,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
}
void FinishWithError(const Status& status, void* tag) {
GPR_ASSERT(!status.ok());
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -360,7 +361,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -375,7 +376,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@ -409,7 +410,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -430,7 +431,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}

@ -45,6 +45,7 @@
namespace grpc {
class CompletionQueue;
extern CoreCodegenInterface* g_core_codegen_interface;
template <class R>
class ClientAsyncResponseReaderInterface {
@ -68,13 +69,13 @@ class ClientAsyncResponseReader GRPC_FINAL
collection_->init_buf_.SetCollection(collection_);
collection_->init_buf_.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
GPR_ASSERT(collection_->init_buf_.SendMessage(request).ok());
GPR_CODEGEN_ASSERT(collection_->init_buf_.SendMessage(request).ok());
collection_->init_buf_.ClientSendClose();
call_.PerformOps(&collection_->init_buf_);
}
void ReadInitialMetadata(void* tag) {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
collection_->meta_buf_.SetCollection(collection_);
collection_->meta_buf_.set_output_tag(tag);
@ -116,7 +117,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag);
meta_buf_.SendInitialMetadata(ctx_->initial_metadata_);
@ -141,7 +142,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
}
void FinishWithError(const Status& status, void* tag) {
GPR_ASSERT(!status.ok());
GPR_CODEGEN_ASSERT(!status.ok());
finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_buf_.SendInitialMetadata(ctx_->initial_metadata_);

@ -34,19 +34,21 @@
#ifndef GRPCXX_IMPL_CODEGEN_CALL_H
#define GRPCXX_IMPL_CODEGEN_CALL_H
#include <cstring>
#include <functional>
#include <memory>
#include <map>
#include <cstring>
#include <memory>
#include <grpc/impl/codegen/alloc.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc++/impl/codegen/client_context.h>
#include <grpc++/impl/codegen/call_hook.h>
#include <grpc++/impl/codegen/client_context.h>
#include <grpc++/impl/codegen/completion_queue_tag.h>
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/string_ref.h>
#include <grpc/impl/codegen/alloc.h>
#include <grpc/impl/codegen/grpc_types.h>
struct grpc_byte_buffer;
@ -56,12 +58,39 @@ class ByteBuffer;
class Call;
class CallHook;
class CompletionQueue;
extern CoreCodegenInterface* g_core_codegen_interface;
void FillMetadataMap(
inline void FillMetadataMap(
grpc_metadata_array* arr,
std::multimap<grpc::string_ref, grpc::string_ref>* metadata);
grpc_metadata* FillMetadataArray(
const std::multimap<grpc::string, grpc::string>& metadata);
std::multimap<grpc::string_ref, grpc::string_ref>* metadata) {
for (size_t i = 0; i < arr->count; i++) {
// TODO(yangg) handle duplicates?
metadata->insert(std::pair<grpc::string_ref, grpc::string_ref>(
arr->metadata[i].key, grpc::string_ref(arr->metadata[i].value,
arr->metadata[i].value_length)));
}
g_core_codegen_interface->grpc_metadata_array_destroy(arr);
g_core_codegen_interface->grpc_metadata_array_init(arr);
}
// TODO(yangg) if the map is changed before we send, the pointers will be a
// mess. Make sure it does not happen.
inline grpc_metadata* FillMetadataArray(
const std::multimap<grpc::string, grpc::string>& metadata) {
if (metadata.empty()) {
return nullptr;
}
grpc_metadata* metadata_array =
(grpc_metadata*)(g_core_codegen_interface->gpr_malloc(
metadata.size() * sizeof(grpc_metadata)));
size_t i = 0;
for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) {
metadata_array[i].key = iter->first.c_str();
metadata_array[i].value = iter->second.c_str();
metadata_array[i].value_length = iter->second.size();
}
return metadata_array;
}
/// Per-message write options.
class WriteOptions {
@ -170,7 +199,7 @@ class CallOpSendInitialMetadata {
}
void FinishOp(bool* status, int max_message_size) {
if (!send_) return;
gpr_free(initial_metadata_);
g_core_codegen_interface->gpr_free(initial_metadata_);
send_ = false;
}
@ -204,7 +233,7 @@ class CallOpSendMessage {
write_options_.Clear();
}
void FinishOp(bool* status, int max_message_size) {
if (own_buf_) grpc_byte_buffer_destroy(send_buf_);
if (own_buf_) g_core_codegen_interface->grpc_byte_buffer_destroy(send_buf_);
send_buf_ = nullptr;
}
@ -254,7 +283,7 @@ class CallOpRecvMessage {
max_message_size).ok();
} else {
got_message = false;
grpc_byte_buffer_destroy(recv_buf_);
g_core_codegen_interface->grpc_byte_buffer_destroy(recv_buf_);
}
} else {
got_message = false;
@ -321,7 +350,7 @@ class CallOpGenericRecvMessage {
*status = deserialize_->Deserialize(recv_buf_, max_message_size).ok();
} else {
got_message = false;
grpc_byte_buffer_destroy(recv_buf_);
g_core_codegen_interface->grpc_byte_buffer_destroy(recv_buf_);
}
} else {
got_message = false;
@ -386,7 +415,7 @@ class CallOpServerSendStatus {
void FinishOp(bool* status, int max_message_size) {
if (!send_status_available_) return;
gpr_free(trailing_metadata_);
g_core_codegen_interface->gpr_free(trailing_metadata_);
send_status_available_ = false;
}
@ -462,7 +491,7 @@ class CallOpClientRecvStatus {
*recv_status_ = Status(
static_cast<StatusCode>(status_code_),
status_details_ ? grpc::string(status_details_) : grpc::string());
gpr_free(status_details_);
g_core_codegen_interface->gpr_free(status_details_);
recv_status_ = nullptr;
}
@ -576,11 +605,22 @@ class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
class Call GRPC_FINAL {
public:
/* call is owned by the caller */
Call(grpc_call* call, CallHook* call_hook_, CompletionQueue* cq);
Call(grpc_call* call, CallHook* call_hook_, CompletionQueue* cq,
int max_message_size);
void PerformOps(CallOpSetInterface* ops);
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
: call_hook_(call_hook), cq_(cq), call_(call), max_message_size_(-1) {}
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
int max_message_size)
: call_hook_(call_hook),
cq_(cq),
call_(call),
max_message_size_(max_message_size) {}
void PerformOps(CallOpSetInterface* ops) {
if (max_message_size_ > 0) {
ops->set_max_message_size(max_message_size_);
}
call_hook_->PerformOpsOnCall(ops, this);
}
grpc_call* call() { return call_; }
CompletionQueue* cq() { return cq_; }

@ -54,6 +54,7 @@
#include <string>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/security/auth_context.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/string_ref.h>
@ -192,7 +193,7 @@ class ClientContext {
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() {
GPR_ASSERT(initial_metadata_received_);
GPR_CODEGEN_ASSERT(initial_metadata_received_);
return recv_initial_metadata_;
}

@ -37,6 +37,7 @@
#include <grpc++/impl/codegen/call.h>
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/status.h>
namespace grpc {
@ -66,7 +67,7 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
ops.ClientSendClose();
ops.ClientRecvStatus(context, &status);
call.PerformOps(&ops);
GPR_ASSERT((cq.Pluck(&ops) && ops.got_message) || !status.ok());
GPR_CODEGEN_ASSERT((cq.Pluck(&ops) && ops.got_message) || !status.ok());
return status;
}

@ -36,9 +36,12 @@
#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
#include <grpc++/impl/codegen/completion_queue_tag.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/time.h>
#include <grpc/impl/codegen/time.h>
struct grpc_completion_queue;
@ -76,13 +79,17 @@ class Server;
class ServerBuilder;
class ServerContext;
extern CoreCodegenInterface* g_core_codegen_interface;
/// A thin wrapper around \a grpc_completion_queue (see / \a
/// src/core/surface/completion_queue.h).
class CompletionQueue : private GrpcLibrary {
class CompletionQueue : private GrpcLibraryCodegen {
public:
/// Default constructor. Implicitly creates a \a grpc_completion_queue
/// instance.
CompletionQueue();
CompletionQueue() {
cq_ = g_core_codegen_interface->grpc_completion_queue_create(nullptr);
}
/// Wrap \a take, taking ownership of the instance.
///
@ -90,7 +97,9 @@ class CompletionQueue : private GrpcLibrary {
explicit CompletionQueue(grpc_completion_queue* take);
/// Destructor. Destroys the owned wrapped completion queue / instance.
~CompletionQueue();
~CompletionQueue() {
g_core_codegen_interface->grpc_completion_queue_destroy(cq_);
}
/// Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
enum NextStatus {
@ -124,8 +133,8 @@ class CompletionQueue : private GrpcLibrary {
///
/// \return true if read a regular event, false if the queue is shutting down.
bool Next(void** tag, bool* ok) {
return (AsyncNextInternal(tag, ok, gpr_inf_future(GPR_CLOCK_REALTIME)) !=
SHUTDOWN);
return (AsyncNextInternal(tag, ok, g_core_codegen_interface->gpr_inf_future(
GPR_CLOCK_REALTIME)) != SHUTDOWN);
}
/// Request the shutdown of the queue.
@ -181,11 +190,31 @@ class CompletionQueue : private GrpcLibrary {
/// Wraps \a grpc_completion_queue_pluck.
/// \warning Must not be mixed with calls to \a Next.
bool Pluck(CompletionQueueTag* tag);
bool Pluck(CompletionQueueTag* tag) {
auto deadline =
g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME);
auto ev = g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr);
bool ok = ev.success != 0;
void* ignored = tag;
GPR_CODEGEN_ASSERT(tag->FinalizeResult(&ignored, &ok));
GPR_CODEGEN_ASSERT(ignored == tag);
// Ignore mutations by FinalizeResult: Pluck returns the C API status
return ev.success != 0;
}
/// Performs a single polling pluck on \a tag.
/// \warning Must not be mixed with calls to \a Next.
void TryPluck(CompletionQueueTag* tag);
void TryPluck(CompletionQueueTag* tag) {
auto deadline = gpr_time_0(GPR_CLOCK_REALTIME);
auto ev = g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr);
if (ev.type == GRPC_QUEUE_TIMEOUT) return;
bool ok = ev.success != 0;
void* ignored = tag;
// the tag must be swallowed if using TryPluck
GPR_CODEGEN_ASSERT(!tag->FinalizeResult(&ignored, &ok));
}
grpc_completion_queue* cq_; // owned
};

@ -31,8 +31,8 @@
*
*/
#ifndef GRPCXX_COMPLETION_QUEUE_TAG_H
#define GRPCXX_COMPLETION_QUEUE_TAG_H
#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
namespace grpc {
@ -49,4 +49,4 @@ class CompletionQueueTag {
} // namespace grpc
#endif // GRPCXX_COMPLETION_QUEUE_TAG_H
#endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H

@ -0,0 +1,97 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#include <grpc++/impl/codegen/config_protobuf.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc/impl/codegen/grpc_types.h>
namespace grpc {
/// Interface between the codegen library and the minimal subset of core
/// features required by the generated code.
///
/// All undocumented methods are simply forwarding the call to their namesakes.
/// Please refer to their corresponding documentation for details.
///
/// \warning This interface should be considered internal and private.
class CoreCodegenInterface {
public:
// Serialize the msg into a buffer created inside the function. The caller
// should destroy the returned buffer when done with it. If serialization
// fails,
// false is returned and buffer is left unchanged.
virtual Status SerializeProto(const grpc::protobuf::Message& msg,
grpc_byte_buffer** buffer) = 0;
// The caller keeps ownership of buffer and msg.
virtual Status DeserializeProto(grpc_byte_buffer* buffer,
grpc::protobuf::Message* msg,
int max_message_size) = 0;
/// Upon a failed assertion, log the error.
virtual void assert_fail(const char* failed_assertion) = 0;
virtual grpc_completion_queue* grpc_completion_queue_create(
void* reserved) = 0;
virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0;
virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq,
void* tag,
gpr_timespec deadline,
void* reserved) = 0;
virtual void* gpr_malloc(size_t size) = 0;
virtual void gpr_free(void* p) = 0;
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0;
virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;
virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0;
virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0;
};
extern CoreCodegenInterface* g_core_codegen_interface;
/// Codegen specific version of \a GPR_ASSERT.
#define GPR_CODEGEN_ASSERT(x) \
do { \
if (!(x)) { \
grpc::g_core_codegen_interface->assert_fail(#x); \
} \
} while (0)
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H

@ -34,6 +34,7 @@
#ifndef GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
#define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc/impl/codegen/log.h>
namespace grpc {
@ -44,24 +45,27 @@ class GrpcLibraryInterface {
virtual void shutdown() = 0;
};
/// Initialized by \a grpc::GrpcLibraryInitializer from
/// <grpc++/impl/grpc_library.h>
extern GrpcLibraryInterface* g_glip;
class GrpcLibrary {
/// Classes that require gRPC to be initialized should inherit from this class.
class GrpcLibraryCodegen {
public:
GrpcLibrary() {
GPR_ASSERT(g_glip &&
"gRPC library not initialized. See "
"grpc::internal::GrpcLibraryInitializer.");
GrpcLibraryCodegen() {
GPR_CODEGEN_ASSERT(g_glip &&
"gRPC library not initialized. See "
"grpc::internal::GrpcLibraryInitializer.");
g_glip->init();
}
virtual ~GrpcLibrary() {
GPR_ASSERT(g_glip &&
"gRPC library not initialized. See "
"grpc::internal::GrpcLibraryInitializer.");
virtual ~GrpcLibraryCodegen() {
GPR_CODEGEN_ASSERT(g_glip &&
"gRPC library not initialized. See "
"grpc::internal::GrpcLibraryInitializer.");
g_glip->shutdown();
}
};
} // namespace grpc
#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
#endif // GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H

@ -0,0 +1,463 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPCXX_IMPL_CODEGEN_IMPL_ASYNC_STREAM_H
#define GRPCXX_IMPL_CODEGEN_IMPL_ASYNC_STREAM_H
#include <grpc++/impl/codegen/call.h>
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/server_context.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
namespace grpc {
class CompletionQueue;
/// Common interface for all client side asynchronous streaming.
class ClientAsyncStreamingInterface {
public:
virtual ~ClientAsyncStreamingInterface() {}
/// Request notification of the reading of the initial metadata. Completion
/// will be notified by \a tag on the associated completion queue.
///
/// \param[in] tag Tag identifying this request.
virtual void ReadInitialMetadata(void* tag) = 0;
/// Request notification completion.
///
/// \param[out] status To be updated with the operation status.
/// \param[in] tag Tag identifying this request.
virtual void Finish(Status* status, void* tag) = 0;
};
/// An interface that yields a sequence of messages of type \a R.
template <class R>
class AsyncReaderInterface {
public:
virtual ~AsyncReaderInterface() {}
/// Read a message of type \a R into \a msg. Completion will be notified by \a
/// tag on the associated completion queue.
///
/// \param[out] msg Where to eventually store the read message.
/// \param[in] tag The tag identifying the operation.
virtual void Read(R* msg, void* tag) = 0;
};
/// An interface that can be fed a sequence of messages of type \a W.
template <class W>
class AsyncWriterInterface {
public:
virtual ~AsyncWriterInterface() {}
/// Request the writing of \a msg with identifying tag \a tag.
///
/// Only one write may be outstanding at any given time. This means that
/// after calling Write, one must wait to receive \a tag from the completion
/// queue BEFORE calling Write again.
///
/// \param[in] msg The message to be written.
/// \param[in] tag The tag identifying the operation.
virtual void Write(const W& msg, void* tag) = 0;
};
template <class R>
class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {};
template <class R>
class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
public:
/// Create a stream and write the first request out.
template <class W>
ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const W& request, void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_ops_.set_output_tag(tag);
init_ops_.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
init_ops_.ClientSendClose();
call_.PerformOps(&init_ops_);
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
call_.PerformOps(&meta_ops_);
}
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
}
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
}
finish_ops_.ClientRecvStatus(context_, status);
call_.PerformOps(&finish_ops_);
}
private:
ClientContext* context_;
Call call_;
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpClientSendClose>
init_ops_;
CallOpSet<CallOpRecvInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> read_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpClientRecvStatus> finish_ops_;
};
/// Common interface for client side asynchronous writing.
template <class W>
class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
/// Signal the client is done with the writes.
///
/// \param[in] tag The tag identifying the operation.
virtual void WritesDone(void* tag) = 0;
};
template <class W>
class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
public:
template <class R>
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
R* response, void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
finish_ops_.RecvMessage(response);
init_ops_.set_output_tag(tag);
init_ops_.SendInitialMetadata(context->send_initial_metadata_);
call_.PerformOps(&init_ops_);
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
call_.PerformOps(&meta_ops_);
}
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) GRPC_OVERRIDE {
writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_);
}
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
}
finish_ops_.ClientRecvStatus(context_, status);
call_.PerformOps(&finish_ops_);
}
private:
ClientContext* context_;
Call call_;
CallOpSet<CallOpSendInitialMetadata> init_ops_;
CallOpSet<CallOpRecvInitialMetadata> meta_ops_;
CallOpSet<CallOpSendMessage> write_ops_;
CallOpSet<CallOpClientSendClose> writes_done_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage,
CallOpClientRecvStatus> finish_ops_;
};
/// Client-side interface for asynchronous bi-directional streaming.
template <class W, class R>
class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
/// Signal the client is done with the writes.
///
/// \param[in] tag The tag identifying the operation.
virtual void WritesDone(void* tag) = 0;
};
template <class W, class R>
class ClientAsyncReaderWriter GRPC_FINAL
: public ClientAsyncReaderWriterInterface<W, R> {
public:
ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_ops_.set_output_tag(tag);
init_ops_.SendInitialMetadata(context->send_initial_metadata_);
call_.PerformOps(&init_ops_);
}
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
call_.PerformOps(&meta_ops_);
}
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
}
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) GRPC_OVERRIDE {
writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_);
}
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
}
finish_ops_.ClientRecvStatus(context_, status);
call_.PerformOps(&finish_ops_);
}
private:
ClientContext* context_;
Call call_;
CallOpSet<CallOpSendInitialMetadata> init_ops_;
CallOpSet<CallOpRecvInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> read_ops_;
CallOpSet<CallOpSendMessage> write_ops_;
CallOpSet<CallOpClientSendClose> writes_done_ops_;
CallOpSet<CallOpRecvInitialMetadata, CallOpClientRecvStatus> finish_ops_;
};
template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
void Finish(const W& msg, const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
// The response is dropped if the status is not OK.
if (status.ok()) {
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_,
finish_ops_.SendMessage(msg));
} else {
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
}
call_.PerformOps(&finish_ops_);
}
void FinishWithError(const Status& status, void* tag) {
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
call_.PerformOps(&finish_ops_);
}
private:
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
CallOpSet<CallOpSendInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvMessage<R>> read_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpServerSendStatus> finish_ops_;
};
template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
call_.PerformOps(&finish_ops_);
}
private:
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
CallOpSet<CallOpSendInitialMetadata> meta_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> write_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> finish_ops_;
};
/// Server-side interface for asynchronous bi-directional streaming.
template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
call_.PerformOps(&finish_ops_);
}
private:
friend class ::grpc::Server;
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
CallOpSet<CallOpSendInitialMetadata> meta_ops_;
CallOpSet<CallOpRecvMessage<R>> read_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> write_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> finish_ops_;
};
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_IMPL_ASYNC_STREAM_H

@ -0,0 +1,152 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPCXX_IMPL_CODEGEN_IMPL_STATUS_CODE_ENUM_H
#define GRPCXX_IMPL_CODEGEN_IMPL_STATUS_CODE_ENUM_H
namespace grpc {
enum StatusCode {
/// Not an error; returned on success.
OK = 0,
/// The operation was cancelled (typically by the caller).
CANCELLED = 1,
/// Unknown error. An example of where this error may be returned is if a
/// Status value received from another address space belongs to an error-space
/// that is not known in this address space. Also errors raised by APIs that
/// do not return enough error information may be converted to this error.
UNKNOWN = 2,
/// Client specified an invalid argument. Note that this differs from
/// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are
/// problematic regardless of the state of the system (e.g., a malformed file
/// name).
INVALID_ARGUMENT = 3,
/// Deadline expired before operation could complete. For operations that
/// change the state of the system, this error may be returned even if the
/// operation has completed successfully. For example, a successful response
/// from a server could have been delayed long enough for the deadline to
/// expire.
DEADLINE_EXCEEDED = 4,
/// Some requested entity (e.g., file or directory) was not found.
NOT_FOUND = 5,
/// Some entity that we attempted to create (e.g., file or directory) already
/// exists.
ALREADY_EXISTS = 6,
/// The caller does not have permission to execute the specified operation.
/// PERMISSION_DENIED must not be used for rejections caused by exhausting
/// some resource (use RESOURCE_EXHAUSTED instead for those errors).
/// PERMISSION_DENIED must not be used if the caller can not be identified
/// (use UNAUTHENTICATED instead for those errors).
PERMISSION_DENIED = 7,
/// The request does not have valid authentication credentials for the
/// operation.
UNAUTHENTICATED = 16,
/// Some resource has been exhausted, perhaps a per-user quota, or perhaps the
/// entire file system is out of space.
RESOURCE_EXHAUSTED = 8,
/// Operation was rejected because the system is not in a state required for
/// the operation's execution. For example, directory to be deleted may be
/// non-empty, an rmdir operation is applied to a non-directory, etc.
///
/// A litmus test that may help a service implementor in deciding
/// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
/// (a) Use UNAVAILABLE if the client can retry just the failing call.
/// (b) Use ABORTED if the client should retry at a higher-level
/// (e.g., restarting a read-modify-write sequence).
/// (c) Use FAILED_PRECONDITION if the client should not retry until
/// the system state has been explicitly fixed. E.g., if an "rmdir"
/// fails because the directory is non-empty, FAILED_PRECONDITION
/// should be returned since the client should not retry unless
/// they have first fixed up the directory by deleting files from it.
/// (d) Use FAILED_PRECONDITION if the client performs conditional
/// REST Get/Update/Delete on a resource and the resource on the
/// server does not match the condition. E.g., conflicting
/// read-modify-write on the same resource.
FAILED_PRECONDITION = 9,
/// The operation was aborted, typically due to a concurrency issue like
/// sequencer check failures, transaction aborts, etc.
///
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
/// and UNAVAILABLE.
ABORTED = 10,
/// Operation was attempted past the valid range. E.g., seeking or reading
/// past end of file.
///
/// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed
/// if the system state changes. For example, a 32-bit file system will
/// generate INVALID_ARGUMENT if asked to read at an offset that is not in the
/// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from
/// an offset past the current file size.
///
/// There is a fair bit of overlap between FAILED_PRECONDITION and
/// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific 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 they are done.
OUT_OF_RANGE = 11,
/// Operation is not implemented or not supported/enabled in this service.
UNIMPLEMENTED = 12,
/// Internal errors. Means some invariants expected by underlying System has
/// been broken. If you see one of these errors, Something is very broken.
INTERNAL = 13,
/// The service is currently unavailable. This is a most likely a transient
/// condition and may be corrected by retrying with a backoff.
///
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
/// and UNAVAILABLE.
UNAVAILABLE = 14,
/// Unrecoverable data loss or corruption.
DATA_LOSS = 15,
/// Force users to include a default branch:
DO_NOT_USE = -1
};
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_IMPL_STATUS_CODE_ENUM_H

@ -31,18 +31,15 @@
*
*/
#include <grpc/grpc.h>
#include "src/core/census/grpc_filter.h"
#include "src/core/channel/channel_args.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/surface/api_trace.h"
#include "src/core/surface/completion_queue.h"
#include "src/core/surface/server.h"
#ifndef GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H
#define GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H
grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) {
const grpc_channel_filter *filters[3];
size_t num_filters = 0;
filters[num_filters++] = &grpc_compress_filter;
GRPC_API_TRACE("grpc_server_create(%p, %p)", 2, (args, reserved));
return grpc_server_create_from_filters(filters, num_filters, args);
}
#include <grpc++/impl/codegen/config.h>
#ifdef GRPC_CXX0X_NO_THREAD
#include <grpc++/impl/codegen/sync_no_cxx11.h>
#else
#include <grpc++/impl/codegen/sync_cxx11.h>
#endif
#endif // GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H

@ -34,6 +34,7 @@
#ifndef GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
#define GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/rpc_service_method.h>
#include <grpc++/impl/codegen/sync_stream.h>
@ -58,7 +59,7 @@ class RpcMethodHandler : public MethodHandler {
status = func_(service_, param.server_context, &req, &rsp);
}
GPR_ASSERT(!param.server_context->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpServerSendStatus> ops;
ops.SendInitialMetadata(param.server_context->initial_metadata_);
@ -93,7 +94,7 @@ class ClientStreamingHandler : public MethodHandler {
ResponseType rsp;
Status status = func_(service_, param.server_context, &reader, &rsp);
GPR_ASSERT(!param.server_context->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpServerSendStatus> ops;
ops.SendInitialMetadata(param.server_context->initial_metadata_);

@ -36,22 +36,16 @@
#include <type_traits>
#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/config_protobuf.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc/impl/codegen/log.h>
namespace grpc {
// Serialize the msg into a buffer created inside the function. The caller
// should destroy the returned buffer when done with it. If serialization fails,
// false is returned and buffer is left unchanged.
Status SerializeProto(const grpc::protobuf::Message& msg,
grpc_byte_buffer** buffer);
// The caller keeps ownership of buffer and msg.
Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
int max_message_size);
extern CoreCodegenInterface* g_core_codegen_interface;
template <class T>
class SerializationTraits<T, typename std::enable_if<std::is_base_of<
@ -60,14 +54,13 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of<
static Status Serialize(const grpc::protobuf::Message& msg,
grpc_byte_buffer** buffer, bool* own_buffer) {
*own_buffer = true;
return SerializeProto(msg, buffer);
return g_core_codegen_interface->SerializeProto(msg, buffer);
}
static Status Deserialize(grpc_byte_buffer* buffer,
grpc::protobuf::Message* msg,
int max_message_size) {
auto status = DeserializeProto(buffer, msg, max_message_size);
grpc_byte_buffer_destroy(buffer);
return status;
return g_core_codegen_interface->DeserializeProto(buffer, msg,
max_message_size);
}
};

@ -34,10 +34,11 @@
#ifndef GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
#define GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc++/impl/codegen/call_hook.h>
#include <grpc++/impl/codegen/completion_queue_tag.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/rpc_service_method.h>
#include <grpc/impl/codegen/grpc_types.h>
namespace grpc {
@ -223,7 +224,7 @@ class ServerInterface : public CallHook {
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq, void* tag,
Message* message) {
GPR_ASSERT(method);
GPR_CODEGEN_ASSERT(method);
new PayloadAsyncRequest<Message>(method->server_tag(), this, context,
stream, call_cq, notification_cq, tag,
message);
@ -233,7 +234,7 @@ class ServerInterface : public CallHook {
ServerAsyncStreamingInterface* stream,
CompletionQueue* call_cq,
ServerCompletionQueue* notification_cq, void* tag) {
GPR_ASSERT(method);
GPR_CODEGEN_ASSERT(method);
new NoPayloadAsyncRequest(method->server_tag(), this, context, stream,
call_cq, notification_cq, tag);
}

@ -35,6 +35,7 @@
#define GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/rpc_service_method.h>
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/server_interface.h>
@ -131,21 +132,18 @@ class Service {
void AddMethod(RpcServiceMethod* method) { methods_.emplace_back(method); }
void MarkMethodAsync(int index) {
if (methods_[index].get() == nullptr) {
gpr_log(GPR_ERROR,
"Cannot mark the method as 'async' because it has already been "
"marked as 'generic'.");
return;
}
GPR_CODEGEN_ASSERT(
methods_[index].get() != nullptr &&
"Cannot mark the method as 'async' because it has already been "
"marked as 'generic'.");
methods_[index]->ResetHandler();
}
void MarkMethodGeneric(int index) {
if (methods_[index]->handler() == nullptr) {
gpr_log(GPR_ERROR,
"Cannot mark the method as 'generic' because it has already been "
"marked as 'async'.");
}
GPR_CODEGEN_ASSERT(
methods_[index]->handler() != nullptr &&
"Cannot mark the method as 'generic' because it has already been "
"marked as 'async'.");
methods_[index].reset();
}

@ -34,8 +34,12 @@
#ifndef GRPCXX_IMPL_CODEGEN_STRING_REF_H
#define GRPCXX_IMPL_CODEGEN_STRING_REF_H
#include <iterator>
#include <string.h>
#include <algorithm>
#include <iosfwd>
#include <iostream>
#include <iterator>
#include <grpc++/impl/codegen/config.h>
@ -62,8 +66,13 @@ class string_ref {
string_ref() : data_(nullptr), length_(0) {}
string_ref(const string_ref& other)
: data_(other.data_), length_(other.length_) {}
string_ref& operator=(const string_ref& rhs);
string_ref(const char* s);
string_ref& operator=(const string_ref& rhs) {
data_ = rhs.data_;
length_ = rhs.length_;
return *this;
}
string_ref(const char* s) : data_(s), length_(strlen(s)) {}
string_ref(const char* s, size_t l) : data_(s), length_(l) {}
string_ref(const grpc::string& s) : data_(s.data()), length_(s.length()) {}
@ -95,13 +104,40 @@ class string_ref {
const char* data() const { return data_; }
// string operations
int compare(string_ref x) const;
bool starts_with(string_ref x) const;
bool ends_with(string_ref x) const;
size_t find(string_ref s) const;
size_t find(char c) const;
int compare(string_ref x) const {
size_t min_size = length_ < x.length_ ? length_ : x.length_;
int r = memcmp(data_, x.data_, min_size);
if (r < 0) return -1;
if (r > 0) return 1;
if (length_ < x.length_) return -1;
if (length_ > x.length_) return 1;
return 0;
}
bool starts_with(string_ref x) const {
return length_ >= x.length_ && (memcmp(data_, x.data_, x.length_) == 0);
}
string_ref substr(size_t pos, size_t n = npos) const;
bool ends_with(string_ref x) const {
return length_ >= x.length_ &&
(memcmp(data_ + (length_ - x.length_), x.data_, x.length_) == 0);
}
size_t find(string_ref s) const {
auto it = std::search(cbegin(), cend(), s.cbegin(), s.cend());
return it == cend() ? npos : std::distance(cbegin(), it);
}
size_t find(char c) const {
auto it = std::find(cbegin(), cend(), c);
return it == cend() ? npos : std::distance(cbegin(), it);
}
string_ref substr(size_t pos, size_t n = npos) const {
if (pos > length_) pos = length_;
if (n > (length_ - pos)) n = length_ - pos;
return string_ref(data_ + pos, n);
}
private:
const char* data_;
@ -109,14 +145,16 @@ class string_ref {
};
// Comparison operators
bool operator==(string_ref x, string_ref y);
bool operator!=(string_ref x, string_ref y);
bool operator<(string_ref x, string_ref y);
bool operator>(string_ref x, string_ref y);
bool operator<=(string_ref x, string_ref y);
bool operator>=(string_ref x, string_ref y);
std::ostream& operator<<(std::ostream& stream, const string_ref& string);
inline bool operator==(string_ref x, string_ref y) { return x.compare(y) == 0; }
inline bool operator!=(string_ref x, string_ref y) { return x.compare(y) != 0; }
inline bool operator<(string_ref x, string_ref y) { return x.compare(y) < 0; }
inline bool operator<=(string_ref x, string_ref y) { return x.compare(y) <= 0; }
inline bool operator>(string_ref x, string_ref y) { return x.compare(y) > 0; }
inline bool operator>=(string_ref x, string_ref y) { return x.compare(y) >= 0; }
inline std::ostream& operator<<(std::ostream& out, const string_ref& string) {
return out << grpc::string(string.begin(), string.end());
}
} // namespace grpc

@ -38,6 +38,7 @@
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/client_context.h>
#include <grpc++/impl/codegen/completion_queue.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/server_context.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
@ -125,14 +126,14 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
CallOpClientSendClose> ops;
ops.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
GPR_ASSERT(ops.SendMessage(request).ok());
GPR_CODEGEN_ASSERT(ops.SendMessage(request).ok());
ops.ClientSendClose();
call_.PerformOps(&ops);
cq_.Pluck(&ops);
}
void WaitForInitialMetadata() GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
CallOpSet<CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -155,7 +156,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
GPR_ASSERT(cq_.Pluck(&ops));
GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
return status;
}
@ -194,7 +195,7 @@ class ClientWriter : public ClientWriterInterface<W> {
}
void WaitForInitialMetadata() {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
CallOpSet<CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -227,7 +228,7 @@ class ClientWriter : public ClientWriterInterface<W> {
}
finish_ops_.ClientRecvStatus(context_, &status);
call_.PerformOps(&finish_ops_);
GPR_ASSERT(cq_.Pluck(&finish_ops_));
GPR_CODEGEN_ASSERT(cq_.Pluck(&finish_ops_));
return status;
}
@ -271,7 +272,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
}
void WaitForInitialMetadata() GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
CallOpSet<CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -312,7 +313,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
GPR_ASSERT(cq_.Pluck(&ops));
GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
return status;
}
@ -328,7 +329,7 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(ctx_->initial_metadata_);
@ -355,7 +356,7 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(ctx_->initial_metadata_);
@ -391,7 +392,7 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(ctx_->initial_metadata_);

@ -40,21 +40,31 @@
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc/grpc.h>
#include "src/cpp/common/core_codegen.h"
namespace grpc {
namespace internal {
class GrpcLibrary GRPC_FINAL : public GrpcLibraryInterface {
public:
void init() GRPC_OVERRIDE { grpc_init(); }
void shutdown() GRPC_OVERRIDE { grpc_shutdown(); }
};
static GrpcLibrary g_gli;
static CoreCodegen g_core_codegen;
/// Instantiating this class ensures the proper initialization of gRPC.
class GrpcLibraryInitializer GRPC_FINAL {
public:
GrpcLibraryInitializer() { grpc::g_glip = &g_gli; }
GrpcLibraryInitializer() {
if (grpc::g_glip == nullptr) {
grpc::g_glip = &g_gli;
}
if (grpc::g_core_codegen_interface == nullptr) {
grpc::g_core_codegen_interface = &g_core_codegen;
}
}
/// A no-op method to force the linker to reference this class, which will
/// take care of initializing and shutting down the gRPC runtime.

@ -31,9 +31,9 @@
*
*/
#ifndef GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H
#define GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H
#ifndef GRPCXX_IMPL_PROTO_UTILS_H
#define GRPCXX_IMPL_PROTO_UTILS_H
#include <grpc++/impl/codegen/proto_utils.h>
#endif // GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H
#endif // GRPCXX_IMPL_PROTO_UTILS_H

@ -31,9 +31,9 @@
*
*/
#ifndef GRPCXX_SUPPORT_AUTH_CONTEXT_H
#define GRPCXX_SUPPORT_AUTH_CONTEXT_H
#ifndef GRPCXX_SECURITY_AUTH_CONTEXT_H
#define GRPCXX_SECURITY_AUTH_CONTEXT_H
#include <grpc++/impl/codegen/security/auth_context.h>
#endif // GRPCXX_SUPPORT_AUTH_CONTEXT_H
#endif // GRPCXX_SECURITY_AUTH_CONTEXT_H

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPCXX_AUTH_METADATA_PROCESSOR_H_
#define GRPCXX_AUTH_METADATA_PROCESSOR_H_
#ifndef GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
#define GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
#include <map>
@ -70,4 +70,4 @@ class AuthMetadataProcessor {
} // namespace grpc
#endif // GRPCXX_AUTH_METADATA_PROCESSOR_H_
#endif // GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H

@ -31,8 +31,8 @@
*
*/
#ifndef GRPCXX_CREDENTIALS_H
#define GRPCXX_CREDENTIALS_H
#ifndef GRPCXX_SECURITY_CREDENTIALS_H
#define GRPCXX_SECURITY_CREDENTIALS_H
#include <map>
#include <memory>
@ -57,7 +57,7 @@ class SecureCallCredentials;
/// for all the calls on that channel.
///
/// \see http://www.grpc.io/docs/guides/auth.html
class ChannelCredentials : private GrpcLibrary {
class ChannelCredentials : private GrpcLibraryCodegen {
public:
ChannelCredentials();
~ChannelCredentials();
@ -83,7 +83,7 @@ class ChannelCredentials : private GrpcLibrary {
/// authenticate with a server for a given call on a channel.
///
/// \see http://www.grpc.io/docs/guides/auth.html
class CallCredentials : private GrpcLibrary {
class CallCredentials : private GrpcLibraryCodegen {
public:
CallCredentials();
~CallCredentials();
@ -229,4 +229,4 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
} // namespace grpc
#endif // GRPCXX_CREDENTIALS_H
#endif // GRPCXX_SECURITY_CREDENTIALS_H

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPCXX_SERVER_CREDENTIALS_H
#define GRPCXX_SERVER_CREDENTIALS_H
#ifndef GRPCXX_SECURITY_SERVER_CREDENTIALS_H
#define GRPCXX_SECURITY_SERVER_CREDENTIALS_H
#include <memory>
#include <vector>
@ -89,4 +89,4 @@ std::shared_ptr<ServerCredentials> InsecureServerCredentials();
} // namespace grpc
#endif // GRPCXX_SERVER_CREDENTIALS_H
#endif // GRPCXX_SECURITY_SERVER_CREDENTIALS_H

@ -62,7 +62,7 @@ class ThreadPoolInterface;
/// Models a gRPC server.
///
/// Servers are configured and started via \a grpc::ServerBuilder.
class Server GRPC_FINAL : public ServerInterface, private GrpcLibrary {
class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
public:
~Server();

@ -35,8 +35,8 @@
* they can (ultimately) be used in many different RPC systems (with differing
* implementations). */
#ifndef CENSUS_CENSUS_H
#define CENSUS_CENSUS_H
#ifndef GRPC_CENSUS_H
#define GRPC_CENSUS_H
#include <grpc/grpc.h>
@ -537,4 +537,4 @@ CENSUSAPI void census_view_reset(census_view *view);
}
#endif
#endif /* CENSUS_CENSUS_H */
#endif /* GRPC_CENSUS_H */

@ -55,11 +55,13 @@ GRPCAPI int grpc_compression_algorithm_parse(
GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, char **name);
/** Returns the compression algorithm corresponding to \a level.
/** Returns the compression algorithm corresponding to \a level for the
* compression algorithms encoded in the \a accepted_encodings bitset.
*
* It abort()s for unknown levels . */
GRPCAPI grpc_compression_algorithm
grpc_compression_algorithm_for_level(grpc_compression_level level);
grpc_compression_algorithm_for_level(grpc_compression_level level,
uint32_t accepted_encodings);
GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts);

@ -48,6 +48,7 @@ extern "C" {
#define GRPC_X509_CN_PROPERTY_NAME "x509_common_name"
#define GRPC_X509_SAN_PROPERTY_NAME "x509_subject_alternative_name"
#define GRPC_X509_PEM_CERT_PROPERTY_NAME "x509_pem_cert"
typedef struct grpc_auth_context grpc_auth_context;

@ -247,8 +247,41 @@
#else /* _LP64 */
#define GPR_ARCH_32 1
#endif /* _LP64 */
#elif defined(__native_client__)
#define GPR_PLATFORM_STRING "nacl"
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#define GPR_CPU_POSIX 1
#define GPR_GCC_ATOMIC 1
#define GPR_GCC_TLS 1
#define GPR_POSIX_LOG 1
#define GPR_POSIX_MULTIPOLL_WITH_POLL 1
#define GPR_POSIX_WAKEUP_FD 1
#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1
#define GPR_POSIX_SOCKET 1
#define GPR_POSIX_SOCKETADDR 1
#define GPR_POSIX_SOCKETUTILS 1
#define GPR_POSIX_ENV 1
#define GPR_POSIX_FILE 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
#ifdef _LP64
#define GPR_ARCH_64 1
#else /* _LP64 */
#define GPR_ARCH_32 1
#endif /* _LP64 */
#else
#error Could not auto-detect platform
#error "Could not auto-detect platform"
#endif
#endif /* GPR_NO_AUTODETECT_PLATFORM */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_IMPL_CODEGEN_H
#define GRPC_IMPL_CODEGEN_H
#ifndef GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
#define GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
#include <grpc/impl/codegen/port_platform.h>
@ -64,4 +64,4 @@ extern "C" {
}
#endif
#endif /* GRPC_IMPL_CODEGEN_H */
#endif /* GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H */

@ -31,9 +31,9 @@
*
*/
#ifndef GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
#define GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
#include <grpc/impl/codegen/atm_gcc_atomic.h>
#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */
#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */

@ -56,4 +56,4 @@ GPRAPI void gpr_subprocess_interrupt(gpr_subprocess *p);
} // extern "C"
#endif
#endif
#endif /* GRPC_SUPPORT_SUBPROCESS_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -74,4 +74,4 @@
#include <grpc/support/tls_pthread.h>
#endif
#endif
#endif /* GRPC_SUPPORT_TLS_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,9 +34,51 @@
#ifndef GRPC_SUPPORT_TLS_GCC_H
#define GRPC_SUPPORT_TLS_GCC_H
#include <stdbool.h>
#include <grpc/support/log.h>
/* Thread local storage based on gcc compiler primitives.
#include tls.h to use this - and see that file for documentation */
#ifndef NDEBUG
struct gpr_gcc_thread_local {
intptr_t value;
bool *inited;
};
#define GPR_TLS_DECL(name) \
static bool name##_inited = false; \
static __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)}
#define gpr_tls_init(tls) \
do { \
GPR_ASSERT(*((tls)->inited) == false); \
*((tls)->inited) = true; \
} while (0)
/* It is allowed to call gpr_tls_init after gpr_tls_destroy is called. */
#define gpr_tls_destroy(tls) \
do { \
GPR_ASSERT(*((tls)->inited)); \
*((tls)->inited) = false; \
} while (0)
#define gpr_tls_set(tls, new_value) \
do { \
GPR_ASSERT(*((tls)->inited)); \
(tls)->value = (new_value); \
} while (0)
#define gpr_tls_get(tls) \
({ \
GPR_ASSERT(*((tls)->inited)); \
(tls)->value; \
})
#else /* NDEBUG */
struct gpr_gcc_thread_local {
intptr_t value;
};
@ -53,4 +95,6 @@ struct gpr_gcc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)
#endif
#endif /* NDEBUG */
#endif /* GRPC_SUPPORT_TLS_GCC_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_SUPPORT_TLS_GCC_H
#define GRPC_SUPPORT_TLS_GCC_H
#ifndef GRPC_SUPPORT_TLS_MSVC_H
#define GRPC_SUPPORT_TLS_MSVC_H
/* Thread local storage based on ms visual c compiler primitives.
#include tls.h to use this - and see that file for documentation */
@ -53,4 +53,4 @@ struct gpr_msvc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)
#endif
#endif /* GRPC_SUPPORT_TLS_MSVC_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -57,4 +57,4 @@ intptr_t gpr_tls_set(struct gpr_pthread_thread_local *tls, intptr_t value);
}
#endif
#endif
#endif /* GRPC_SUPPORT_TLS_PTHREAD_H */

@ -87,21 +87,23 @@
"src/node/src/metadata.js",
"src/node/src/server.js",
"include/grpc/grpc_security.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer.h",
"include/grpc/impl/codegen/compression_types.h",
"include/grpc/impl/codegen/connectivity_state.h",
"include/grpc/impl/codegen/grpc_types.h",
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
"include/grpc/grpc.h",
"include/grpc/status.h",
"include/grpc/census.h",
"src/core/census/grpc_filter.h",
"src/core/census/grpc_plugin.h",
"src/core/channel/channel_args.h",
"src/core/channel/channel_stack.h",
"src/core/channel/channel_stack_builder.h",
"src/core/channel/client_channel.h",
"src/core/channel/client_uchannel.h",
"src/core/channel/compress_filter.h",
@ -181,9 +183,12 @@
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/channel_init.h",
"src/core/surface/channel_stack_type.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
"src/core/transport/byte_stream.h",
@ -237,8 +242,10 @@
"third_party/nanopb/pb_encode.h",
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
"src/core/census/grpc_plugin.c",
"src/core/channel/channel_args.c",
"src/core/channel/channel_stack.c",
"src/core/channel/channel_stack_builder.c",
"src/core/channel/client_channel.c",
"src/core/channel/client_uchannel.c",
"src/core/channel/compress_filter.c",
@ -326,7 +333,9 @@
"src/core/surface/channel.c",
"src/core/surface/channel_connectivity.c",
"src/core/surface/channel_create.c",
"src/core/surface/channel_init.c",
"src/core/surface/channel_ping.c",
"src/core/surface/channel_stack_type.c",
"src/core/surface/completion_queue.c",
"src/core/surface/event_string.c",
"src/core/surface/init.c",
@ -334,7 +343,6 @@
"src/core/surface/metadata_array.c",
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/validate_metadata.c",
"src/core/surface/version.c",
"src/core/transport/byte_stream.c",
@ -865,6 +873,7 @@
"include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h",
"src/core/profiling/timers.h",
"src/core/support/backoff.h",
"src/core/support/block_annotate.h",
"src/core/support/env.h",
"src/core/support/load_file.h",
@ -879,6 +888,7 @@
"src/core/profiling/stap_timers.c",
"src/core/support/alloc.c",
"src/core/support/avl.c",
"src/core/support/backoff.c",
"src/core/support/cmdline.c",
"src/core/support/cpu_iphone.c",
"src/core/support/cpu_linux.c",

@ -93,6 +93,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/time.h" role="src" />
<file baseinstalldir="/" name="src/core/profiling/timers.h" role="src" />
<file baseinstalldir="/" name="src/core/support/backoff.h" role="src" />
<file baseinstalldir="/" name="src/core/support/block_annotate.h" role="src" />
<file baseinstalldir="/" name="src/core/support/env.h" role="src" />
<file baseinstalldir="/" name="src/core/support/load_file.h" role="src" />
@ -107,6 +108,7 @@
<file baseinstalldir="/" name="src/core/profiling/stap_timers.c" role="src" />
<file baseinstalldir="/" name="src/core/support/alloc.c" role="src" />
<file baseinstalldir="/" name="src/core/support/avl.c" role="src" />
<file baseinstalldir="/" name="src/core/support/backoff.c" role="src" />
<file baseinstalldir="/" name="src/core/support/cmdline.c" role="src" />
<file baseinstalldir="/" name="src/core/support/cpu_iphone.c" role="src" />
<file baseinstalldir="/" name="src/core/support/cpu_linux.c" role="src" />
@ -147,21 +149,23 @@
<file baseinstalldir="/" name="src/core/support/tmpfile_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/support/wrap_memcpy.c" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_security.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/compression.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/grpc_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/propagation_bits.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/compression.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/census.h" role="src" />
<file baseinstalldir="/" name="src/core/census/grpc_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/census/grpc_plugin.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_args.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_stack.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_stack_builder.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/client_channel.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/client_uchannel.h" role="src" />
<file baseinstalldir="/" name="src/core/channel/compress_filter.h" role="src" />
@ -241,9 +245,12 @@
<file baseinstalldir="/" name="src/core/surface/call.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/call_test_only.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_init.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_stack_type.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/completion_queue.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/event_string.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/init.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/lame_client.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/server.h" role="src" />
<file baseinstalldir="/" name="src/core/surface/surface_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/transport/byte_stream.h" role="src" />
@ -297,8 +304,10 @@
<file baseinstalldir="/" name="third_party/nanopb/pb_encode.h" role="src" />
<file baseinstalldir="/" name="src/core/census/grpc_context.c" role="src" />
<file baseinstalldir="/" name="src/core/census/grpc_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/census/grpc_plugin.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_args.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_stack.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/channel_stack_builder.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/client_channel.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/client_uchannel.c" role="src" />
<file baseinstalldir="/" name="src/core/channel/compress_filter.c" role="src" />
@ -386,7 +395,9 @@
<file baseinstalldir="/" name="src/core/surface/channel.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_connectivity.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_create.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_init.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_ping.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/channel_stack_type.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/completion_queue.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/event_string.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/init.c" role="src" />
@ -394,7 +405,6 @@
<file baseinstalldir="/" name="src/core/surface/metadata_array.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/server.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/server_chttp2.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/server_create.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/validate_metadata.c" role="src" />
<file baseinstalldir="/" name="src/core/surface/version.c" role="src" />
<file baseinstalldir="/" name="src/core/transport/byte_stream.c" role="src" />

@ -42,6 +42,7 @@ from setuptools.command import egg_info
# Redirect the manifest template from MANIFEST.in to PYTHON-MANIFEST.in.
egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in'
PY3 = sys.version_info.major == 3
PYTHON_STEM = './src/python/grpcio'
CORE_INCLUDE = ('./include', '.',)
BORINGSSL_INCLUDE = ('./third_party/boringssl/include',)
@ -103,7 +104,11 @@ if "linux" in sys.platform:
LDFLAGS += ('-Wl,-wrap,memcpy',)
if "linux" in sys.platform or "darwin" in sys.platform:
CFLAGS += ('-fvisibility=hidden',)
DEFINE_MACROS += (('PyMODINIT_FUNC', '__attribute__((visibility ("default"))) void'),)
pymodinit_type = 'PyObject*' if PY3 else 'void'
pymodinit = '__attribute__((visibility ("default"))) {}'.format(pymodinit_type)
DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),)
def cython_extensions(package_names, module_names, extra_sources, include_dirs,

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,8 +33,8 @@
#include <stddef.h>
#ifndef GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H
#define GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H
#ifndef GRPC_CORE_CENSUS_AGGREGATION_H
#define GRPC_CORE_CENSUS_AGGREGATION_H
/** Structure used to describe an aggregation type. */
struct census_aggregation_ops {
@ -63,4 +63,4 @@ struct census_aggregation_ops {
size_t (*print)(const void *aggregation, char *buffer, size_t n);
};
#endif /* GRPC_INTERNAL_CORE_CENSUS_AGGREGATION_H */
#endif /* GRPC_CORE_CENSUS_AGGREGATION_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CENSUS_GRPC_FILTER_H
#define GRPC_INTERNAL_CORE_CENSUS_GRPC_FILTER_H
#ifndef GRPC_CORE_CENSUS_GRPC_FILTER_H
#define GRPC_CORE_CENSUS_GRPC_FILTER_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_server_census_filter;
#endif /* GRPC_INTERNAL_CORE_CENSUS_GRPC_FILTER_H */
#endif /* GRPC_CORE_CENSUS_GRPC_FILTER_H */

@ -0,0 +1,72 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/census/grpc_plugin.h"
#include <limits.h>
#include <grpc/census.h>
#include "src/core/census/grpc_filter.h"
#include "src/core/surface/channel_init.h"
#include "src/core/channel/channel_stack_builder.h"
static bool maybe_add_census_filter(grpc_channel_stack_builder *builder,
void *arg_must_be_null) {
const grpc_channel_args *args =
grpc_channel_stack_builder_get_channel_arguments(builder);
if (grpc_channel_args_is_census_enabled(args)) {
return grpc_channel_stack_builder_prepend_filter(
builder, &grpc_client_census_filter, NULL, NULL);
}
return true;
}
void census_grpc_plugin_init(void) {
/* Only initialize census if no one else has and some features are
* available. */
if (census_enabled() == CENSUS_FEATURE_NONE &&
census_supported() != CENSUS_FEATURE_NONE) {
if (census_initialize(census_supported())) { /* enable all features. */
gpr_log(GPR_ERROR, "Could not initialize census.");
}
}
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
maybe_add_census_filter, NULL);
grpc_channel_init_register_stage(GRPC_CLIENT_UCHANNEL, INT_MAX,
maybe_add_census_filter, NULL);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_census_filter, NULL);
}
void census_grpc_plugin_destroy(void) { census_shutdown(); }

@ -0,0 +1,40 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_CENSUS_GRPC_PLUGIN_H
#define GRPC_CORE_CENSUS_GRPC_PLUGIN_H
void census_grpc_plugin_init(void);
void census_grpc_plugin_destroy(void);
#endif /* GRPC_CORE_CENSUS_GRPC_PLUGIN_H */

@ -33,8 +33,8 @@
/* A very fast in-memory log, optimized for multiple writers. */
#ifndef GRPC_INTERNAL_CORE_CENSUS_MLOG_H
#define GRPC_INTERNAL_CORE_CENSUS_MLOG_H
#ifndef GRPC_CORE_CENSUS_MLOG_H
#define GRPC_CORE_CENSUS_MLOG_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
@ -92,4 +92,4 @@ size_t census_log_remaining_space(void);
out-of-space. */
int64_t census_log_out_of_space_count(void);
#endif /* GRPC_INTERNAL_CORE_CENSUS_LOG_H */
#endif /* GRPC_CORE_CENSUS_MLOG_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef CENSUS_RPC_METRIC_ID_H
#define CENSUS_RPC_METRIC_ID_H
#ifndef GRPC_CORE_CENSUS_RPC_METRIC_ID_H
#define GRPC_CORE_CENSUS_RPC_METRIC_ID_H
/* Metric ID's used for RPC measurements. */
/* Count of client requests sent. */
@ -48,4 +48,4 @@
/* Server side request latency. */
#define CENSUS_METRIC_RPC_SERVER_LATENCY ((uint32_t)5)
#endif /* CENSUS_RPC_METRIC_ID_H */
#endif /* GRPC_CORE_CENSUS_RPC_METRIC_ID_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#ifndef GRPC_CORE_CHANNEL_CHANNEL_ARGS_H
#define GRPC_CORE_CHANNEL_CHANNEL_ARGS_H
#include <grpc/compression.h>
#include <grpc/grpc.h>
@ -91,4 +91,4 @@ int grpc_channel_args_compression_algorithm_get_states(
int grpc_channel_args_compare(const grpc_channel_args *a,
const grpc_channel_args *b);
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H */
#endif /* GRPC_CORE_CHANNEL_CHANNEL_ARGS_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
#define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
#ifndef GRPC_CORE_CHANNEL_CHANNEL_STACK_H
#define GRPC_CORE_CHANNEL_CHANNEL_STACK_H
/* A channel filter defines how operations on a channel are implemented.
Channel filters are chained together to create full channels, and if those
@ -257,4 +257,4 @@ extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */
#endif /* GRPC_CORE_CHANNEL_CHANNEL_STACK_H */

@ -0,0 +1,259 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/channel/channel_stack_builder.h"
#include <string.h>
#include <grpc/support/alloc.h>
int grpc_trace_channel_stack_builder = 0;
typedef struct filter_node {
struct filter_node *next;
struct filter_node *prev;
const grpc_channel_filter *filter;
grpc_post_filter_create_init_func init;
void *init_arg;
} filter_node;
struct grpc_channel_stack_builder {
// sentinel nodes for filters that have been added
filter_node begin;
filter_node end;
// various set/get-able parameters
const grpc_channel_args *args;
grpc_transport *transport;
const char *name;
};
struct grpc_channel_stack_builder_iterator {
grpc_channel_stack_builder *builder;
filter_node *node;
};
grpc_channel_stack_builder *grpc_channel_stack_builder_create(void) {
grpc_channel_stack_builder *b = gpr_malloc(sizeof(*b));
memset(b, 0, sizeof(*b));
b->begin.filter = NULL;
b->end.filter = NULL;
b->begin.next = &b->end;
b->begin.prev = &b->end;
b->end.next = &b->begin;
b->end.prev = &b->begin;
return b;
}
static grpc_channel_stack_builder_iterator *create_iterator_at_filter_node(
grpc_channel_stack_builder *builder, filter_node *node) {
grpc_channel_stack_builder_iterator *it = gpr_malloc(sizeof(*it));
it->builder = builder;
it->node = node;
return it;
}
void grpc_channel_stack_builder_iterator_destroy(
grpc_channel_stack_builder_iterator *it) {
gpr_free(it);
}
grpc_channel_stack_builder_iterator *
grpc_channel_stack_builder_create_iterator_at_first(
grpc_channel_stack_builder *builder) {
return create_iterator_at_filter_node(builder, &builder->begin);
}
grpc_channel_stack_builder_iterator *
grpc_channel_stack_builder_create_iterator_at_last(
grpc_channel_stack_builder *builder) {
return create_iterator_at_filter_node(builder, &builder->end);
}
bool grpc_channel_stack_builder_move_next(
grpc_channel_stack_builder_iterator *iterator) {
if (iterator->node == &iterator->builder->end) return false;
iterator->node = iterator->node->next;
return true;
}
bool grpc_channel_stack_builder_move_prev(
grpc_channel_stack_builder_iterator *iterator) {
if (iterator->node == &iterator->builder->begin) return false;
iterator->node = iterator->node->prev;
return true;
}
bool grpc_channel_stack_builder_move_prev(
grpc_channel_stack_builder_iterator *iterator);
void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder,
const char *name) {
GPR_ASSERT(builder->name == NULL);
builder->name = name;
}
void grpc_channel_stack_builder_set_channel_arguments(
grpc_channel_stack_builder *builder, const grpc_channel_args *args) {
GPR_ASSERT(builder->args == NULL);
builder->args = args;
}
void grpc_channel_stack_builder_set_transport(
grpc_channel_stack_builder *builder, grpc_transport *transport) {
GPR_ASSERT(builder->transport == NULL);
builder->transport = transport;
}
grpc_transport *grpc_channel_stack_builder_get_transport(
grpc_channel_stack_builder *builder) {
return builder->transport;
}
const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments(
grpc_channel_stack_builder *builder) {
return builder->args;
}
bool grpc_channel_stack_builder_append_filter(
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func, void *user_data) {
grpc_channel_stack_builder_iterator *it =
grpc_channel_stack_builder_create_iterator_at_last(builder);
bool ok = grpc_channel_stack_builder_add_filter_before(
it, filter, post_init_func, user_data);
grpc_channel_stack_builder_iterator_destroy(it);
return ok;
}
bool grpc_channel_stack_builder_prepend_filter(
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func, void *user_data) {
grpc_channel_stack_builder_iterator *it =
grpc_channel_stack_builder_create_iterator_at_first(builder);
bool ok = grpc_channel_stack_builder_add_filter_after(
it, filter, post_init_func, user_data);
grpc_channel_stack_builder_iterator_destroy(it);
return ok;
}
static void add_after(filter_node *before, const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func,
void *user_data) {
filter_node *new = gpr_malloc(sizeof(*new));
new->next = before->next;
new->prev = before;
new->next->prev = new->prev->next = new;
new->filter = filter;
new->init = post_init_func;
new->init_arg = user_data;
}
bool grpc_channel_stack_builder_add_filter_before(
grpc_channel_stack_builder_iterator *iterator,
const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func, void *user_data) {
if (iterator->node == &iterator->builder->begin) return false;
add_after(iterator->node->prev, filter, post_init_func, user_data);
return true;
}
bool grpc_channel_stack_builder_add_filter_after(
grpc_channel_stack_builder_iterator *iterator,
const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func, void *user_data) {
if (iterator->node == &iterator->builder->end) return false;
add_after(iterator->node, filter, post_init_func, user_data);
return true;
}
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder) {
filter_node *p = builder->begin.next;
while (p != &builder->end) {
filter_node *next = p->next;
gpr_free(p);
p = next;
}
gpr_free(builder);
}
void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
size_t prefix_bytes, int initial_refs,
grpc_iomgr_cb_func destroy,
void *destroy_arg) {
// count the number of filters
size_t num_filters = 0;
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) {
gpr_log(GPR_DEBUG, "%d: %s", num_filters, p->filter->name);
num_filters++;
}
// create an array of filters
const grpc_channel_filter **filters =
gpr_malloc(sizeof(*filters) * num_filters);
size_t i = 0;
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) {
filters[i++] = p->filter;
}
// calculate the size of the channel stack
size_t channel_stack_size = grpc_channel_stack_size(filters, num_filters);
// allocate memory, with prefix_bytes followed by channel_stack_size
char *result = gpr_malloc(prefix_bytes + channel_stack_size);
// fetch a pointer to the channel stack
grpc_channel_stack *channel_stack =
(grpc_channel_stack *)(result + prefix_bytes);
// and initialize it
grpc_channel_stack_init(exec_ctx, initial_refs, destroy,
destroy_arg == NULL ? result : destroy_arg, filters,
num_filters, builder->args, builder->name,
channel_stack);
// run post-initialization functions
i = 0;
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) {
if (p->init != NULL) {
p->init(channel_stack, grpc_channel_stack_element(channel_stack, i),
p->init_arg);
}
i++;
}
grpc_channel_stack_builder_destroy(builder);
gpr_free((grpc_channel_filter **)filters);
return result;
}

@ -0,0 +1,155 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H
#define GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H
#include <stdbool.h>
#include "src/core/channel/channel_args.h"
#include "src/core/channel/channel_stack.h"
/// grpc_channel_stack_builder offers a programmatic interface to selected
/// and order channel filters
typedef struct grpc_channel_stack_builder grpc_channel_stack_builder;
typedef struct grpc_channel_stack_builder_iterator
grpc_channel_stack_builder_iterator;
/// Create a new channel stack builder
grpc_channel_stack_builder *grpc_channel_stack_builder_create(void);
/// Assign a name to the channel stack: \a name must be statically allocated
void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder,
const char *name);
/// Attach \a transport to the builder (does not take ownership)
void grpc_channel_stack_builder_set_transport(
grpc_channel_stack_builder *builder, grpc_transport *transport);
/// Fetch attached transport
grpc_transport *grpc_channel_stack_builder_get_transport(
grpc_channel_stack_builder *builder);
/// Set channel arguments: \a args must continue to exist until after
/// grpc_channel_stack_builder_finish returns
void grpc_channel_stack_builder_set_channel_arguments(
grpc_channel_stack_builder *builder, const grpc_channel_args *args);
/// Return a borrowed pointer to the channel arguments
const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments(
grpc_channel_stack_builder *builder);
/// Begin iterating over already defined filters in the builder at the beginning
grpc_channel_stack_builder_iterator *
grpc_channel_stack_builder_create_iterator_at_first(
grpc_channel_stack_builder *builder);
/// Begin iterating over already defined filters in the builder at the end
grpc_channel_stack_builder_iterator *
grpc_channel_stack_builder_create_iterator_at_last(
grpc_channel_stack_builder *builder);
/// Is an iterator at the first element?
bool grpc_channel_stack_builder_iterator_is_first(
grpc_channel_stack_builder_iterator *iterator);
/// Is an iterator at the end?
bool grpc_channel_stack_builder_iterator_is_end(
grpc_channel_stack_builder_iterator *iterator);
/// Move an iterator to the next item
bool grpc_channel_stack_builder_move_next(
grpc_channel_stack_builder_iterator *iterator);
/// Move an iterator to the previous item
bool grpc_channel_stack_builder_move_prev(
grpc_channel_stack_builder_iterator *iterator);
typedef void (*grpc_post_filter_create_init_func)(
grpc_channel_stack *channel_stack, grpc_channel_element *elem, void *arg);
/// Add \a filter to the stack, after \a iterator.
/// Call \a post_init_func(..., \a user_data) once the channel stack is
/// created.
bool grpc_channel_stack_builder_add_filter_after(
grpc_channel_stack_builder_iterator *iterator,
const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func,
void *user_data) GRPC_MUST_USE_RESULT;
/// Add \a filter to the stack, before \a iterator.
/// Call \a post_init_func(..., \a user_data) once the channel stack is
/// created.
bool grpc_channel_stack_builder_add_filter_before(
grpc_channel_stack_builder_iterator *iterator,
const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func,
void *user_data) GRPC_MUST_USE_RESULT;
/// Add \a filter to the beginning of the filter list.
/// Call \a post_init_func(..., \a user_data) once the channel stack is
/// created.
bool grpc_channel_stack_builder_prepend_filter(
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func,
void *user_data) GRPC_MUST_USE_RESULT;
/// Add \a filter to the end of the filter list.
/// Call \a post_init_func(..., \a user_data) once the channel stack is
/// created.
bool grpc_channel_stack_builder_append_filter(
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter,
grpc_post_filter_create_init_func post_init_func,
void *user_data) GRPC_MUST_USE_RESULT;
/// Terminate iteration and destroy \a iterator
void grpc_channel_stack_builder_iterator_destroy(
grpc_channel_stack_builder_iterator *iterator);
/// Destroy the builder, return the freshly minted channel stack
/// Allocates \a prefix_bytes bytes before the channel stack
/// Returns the base pointer of the allocated block
/// \a initial_refs, \a destroy, \a destroy_arg are as per
/// grpc_channel_stack_init
void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
size_t prefix_bytes, int initial_refs,
grpc_iomgr_cb_func destroy,
void *destroy_arg);
/// Destroy the builder without creating a channel stack
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder);
extern int grpc_trace_channel_stack_builder;
#endif /* GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#ifndef GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H
#define GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H
#include "src/core/channel/channel_stack.h"
#include "src/core/client_config/resolver.h"
@ -60,4 +60,4 @@ void grpc_client_channel_watch_connectivity_state(
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
grpc_connectivity_state *state, grpc_closure *on_complete);
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H */
#endif /* GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H */

@ -212,20 +212,10 @@ void grpc_client_uchannel_watch_connectivity_state(
grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel,
grpc_channel_args *args) {
grpc_channel *channel = NULL;
#define MAX_FILTERS 3
const grpc_channel_filter *filters[MAX_FILTERS];
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
size_t n = 0;
if (grpc_channel_args_is_census_enabled(args)) {
filters[n++] = &grpc_client_census_filter;
}
filters[n++] = &grpc_compress_filter;
filters[n++] = &grpc_client_uchannel_filter;
GPR_ASSERT(n <= MAX_FILTERS);
channel =
grpc_channel_create_from_filters(&exec_ctx, NULL, filters, n, args, 1);
grpc_channel_create(&exec_ctx, NULL, args, GRPC_CLIENT_UCHANNEL, NULL);
return channel;
}

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H
#ifndef GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H
#define GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H
#include "src/core/channel/channel_stack.h"
#include "src/core/client_config/resolver.h"
@ -57,4 +57,4 @@ grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel,
void grpc_client_uchannel_set_connected_subchannel(
grpc_channel *uchannel, grpc_connected_subchannel *connected_subchannel);
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H */
#endif /* GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_COMPRESS_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_COMPRESS_FILTER_H
#ifndef GRPC_CORE_CHANNEL_COMPRESS_FILTER_H
#define GRPC_CORE_CHANNEL_COMPRESS_FILTER_H
#include "src/core/channel/channel_stack.h"
@ -62,4 +62,4 @@
extern const grpc_channel_filter grpc_compress_filter;
#endif /* GRPC_INTERNAL_CORE_CHANNEL_COMPRESS_FILTER_H */
#endif /* GRPC_CORE_CHANNEL_COMPRESS_FILTER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,7 +67,6 @@ static void con_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
grpc_transport_stream_op *op) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
grpc_transport_perform_stream_op(exec_ctx, chand->transport,
@ -88,7 +87,6 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
channel_data *chand = elem->channel_data;
int r;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
r = grpc_transport_init_stream(
exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld),
&args->call_stack->refcount, args->server_transport_data);
@ -108,7 +106,6 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
grpc_transport_destroy_stream(exec_ctx, chand->transport,
TRANSPORT_STREAM_FROM_CALL_DATA(calld));
}
@ -119,7 +116,6 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element_args *args) {
channel_data *cd = (channel_data *)elem->channel_data;
GPR_ASSERT(args->is_last);
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
cd->transport = NULL;
}
@ -127,7 +123,6 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {
channel_data *cd = (channel_data *)elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
grpc_transport_destroy(exec_ctx, cd->transport);
}
@ -136,21 +131,18 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
return grpc_transport_get_peer(exec_ctx, chand->transport);
}
const grpc_channel_filter grpc_connected_channel_filter = {
static const grpc_channel_filter connected_channel_filter = {
con_start_transport_stream_op, con_start_transport_op, sizeof(call_data),
init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data),
init_channel_elem, destroy_channel_elem, con_get_peer, "connected",
};
void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack,
grpc_transport *transport) {
/* Assumes that the connected channel filter is always the last filter
in a channel stack */
grpc_channel_element *elem = grpc_channel_stack_last_element(channel_stack);
static void bind_transport(grpc_channel_stack *channel_stack,
grpc_channel_element *elem, void *t) {
channel_data *cd = (channel_data *)elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
GPR_ASSERT(elem->filter == &connected_channel_filter);
GPR_ASSERT(cd->transport == NULL);
cd->transport = transport;
cd->transport = t;
/* HACK(ctiller): increase call stack size for the channel to make space
for channel data. We need a cleaner (but performant) way to do this,
@ -158,7 +150,16 @@ void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack,
This is only "safe" because call stacks place no additional data after
the last call element, and the last call element MUST be the connected
channel. */
channel_stack->call_stack_size += grpc_transport_stream_size(transport);
channel_stack->call_stack_size += grpc_transport_stream_size(t);
}
bool grpc_add_connected_filter(grpc_channel_stack_builder *builder,
void *arg_must_be_null) {
GPR_ASSERT(arg_must_be_null == NULL);
grpc_transport *t = grpc_channel_stack_builder_get_transport(builder);
GPR_ASSERT(t != NULL);
return grpc_channel_stack_builder_append_filter(
builder, &connected_channel_filter, bind_transport, t);
}
grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem) {

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,21 +31,12 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#ifndef GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H
#define GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H
#include "src/core/channel/channel_stack.h"
#include "src/core/channel/channel_stack_builder.h"
/* A channel filter representing a channel that is on a connected transport.
This filter performs actual sending and receiving of messages. */
bool grpc_add_connected_filter(grpc_channel_stack_builder *builder,
void *arg_must_be_null);
extern const grpc_channel_filter grpc_connected_channel_filter;
/* Post construction fixup: set the transport in the connected channel.
Must be called before any call stack using this filter is used. */
void grpc_connected_channel_bind_transport(grpc_channel_stack* channel_stack,
grpc_transport* transport);
grpc_stream* grpc_connected_channel_get_stream(grpc_call_element* elem);
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H */
#endif /* GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CONTEXT_H
#define GRPC_INTERNAL_CORE_CHANNEL_CONTEXT_H
#ifndef GRPC_CORE_CHANNEL_CONTEXT_H
#define GRPC_CORE_CHANNEL_CONTEXT_H
/* Call object context pointers */
typedef enum {
@ -46,4 +46,4 @@ typedef struct {
void (*destroy)(void *);
} grpc_call_context_element;
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CONTEXT_H */
#endif /* GRPC_CORE_CHANNEL_CONTEXT_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#ifndef GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#define GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_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"
#endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H */
#endif /* GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,12 +31,12 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#ifndef GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#define GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#include "src/core/channel/channel_stack.h"
/* Processes metadata on the client side for HTTP2 transports */
extern const grpc_channel_filter grpc_http_server_filter;
#endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H */
#endif /* GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
#define GRPC_INTERNAL_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
#ifndef GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
#define GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
#include "src/core/client_config/subchannel.h"
@ -95,4 +95,4 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
char *grpc_subchannel_call_holder_get_peer(grpc_exec_ctx *exec_ctx,
grpc_subchannel_call_holder *holder);
#endif
#endif /* GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
#ifndef GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
#define GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
#include "src/core/client_config/lb_policy.h"
@ -50,4 +50,4 @@ void grpc_client_config_set_lb_policy(grpc_client_config *client_config,
grpc_lb_policy *grpc_client_config_get_lb_policy(
grpc_client_config *client_config);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONNECTOR_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONNECTOR_H
#ifndef GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H
#define GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H
#include "src/core/channel/channel_stack.h"
#include "src/core/iomgr/sockaddr.h"
@ -62,9 +62,6 @@ typedef struct {
typedef struct {
/** the connected transport */
grpc_transport *transport;
/** any additional filters (owned by the caller of connect) */
const grpc_channel_filter **filters;
size_t num_filters;
/** channel arguments (to be passed to the filters) */
const grpc_channel_args *channel_args;
@ -92,4 +89,4 @@ void grpc_connector_connect(grpc_exec_ctx *exec_ctx, grpc_connector *connector,
void grpc_connector_shutdown(grpc_exec_ctx *exec_ctx,
grpc_connector *connector);
#endif
#endif /* GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#ifndef GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#define GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#include <grpc/support/slice.h>
#include "src/core/iomgr/sockaddr.h"
@ -47,4 +47,4 @@ void grpc_test_set_initial_connect_string_function(
void grpc_set_initial_connect_string(struct sockaddr **addr, size_t *addr_len,
gpr_slice *connect_string);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
#include <grpc/support/slice_buffer.h>
@ -82,4 +82,4 @@ void grpc_grpclb_response_destroy(grpc_grpclb_response *response);
}
#endif
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_PICK_FIRST_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_PICK_FIRST_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
#include "src/core/client_config/lb_policy_factory.h"
@ -40,4 +40,4 @@
* the first subchannel from \a subchannels to succesfully connect */
grpc_lb_policy_factory *grpc_pick_first_lb_factory_create();
#endif
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_ROUND_ROBIN_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_ROUND_ROBIN_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
#include "src/core/client_config/lb_policy.h"
@ -43,4 +43,4 @@ extern int grpc_lb_round_robin_trace;
/** Returns a load balancing factory for the round robin policy */
grpc_lb_policy_factory *grpc_round_robin_lb_factory_create();
#endif
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H
#include "src/core/client_config/subchannel.h"
#include "src/core/transport/connectivity_state.h"
@ -141,4 +141,4 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
grpc_connectivity_state grpc_lb_policy_check_connectivity(
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
#endif /* GRPC_INTERNAL_CORE_CONFIG_LB_POLICY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
#include "src/core/client_config/lb_policy.h"
#include "src/core/client_config/subchannel.h"
@ -70,4 +70,4 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory *factory);
grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy(
grpc_lb_policy_factory *factory, grpc_lb_policy_args *args);
#endif /* GRPC_INTERNAL_CORE_CONFIG_LB_POLICY_FACTORY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
#include "src/core/client_config/lb_policy_factory.h"
@ -51,4 +51,4 @@ void grpc_register_lb_policy(grpc_lb_policy_factory *factory);
grpc_lb_policy *grpc_lb_policy_create(const char *name,
grpc_lb_policy_args *args);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_H
#include "src/core/client_config/client_config.h"
#include "src/core/client_config/subchannel.h"
@ -91,4 +91,4 @@ void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_client_config **target_config,
grpc_closure *on_complete);
#endif /* GRPC_INTERNAL_CORE_CONFIG_RESOLVER_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#include "src/core/client_config/resolver.h"
#include "src/core/client_config/subchannel_factory.h"
@ -79,4 +79,4 @@ grpc_resolver *grpc_resolver_factory_create_resolver(
char *grpc_resolver_factory_get_default_authority(
grpc_resolver_factory *factory, grpc_uri *uri);
#endif /* GRPC_INTERNAL_CORE_CONFIG_RESOLVER_FACTORY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
#include "src/core/client_config/resolver_factory.h"
@ -62,4 +62,4 @@ grpc_resolver *grpc_resolver_create(
representing the default authority to pass from a client. */
char *grpc_get_default_authority(const char *target);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,12 +31,12 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
#include "src/core/client_config/resolver_factory.h"
/** Create a dns resolver factory */
grpc_resolver_factory *grpc_dns_resolver_factory_create(void);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_UNIX_RESOLVER_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_UNIX_RESOLVER_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
#include <grpc/support/port_platform.h>
@ -47,4 +47,4 @@ grpc_resolver_factory *grpc_ipv6_resolver_factory_create(void);
grpc_resolver_factory *grpc_unix_resolver_factory_create(void);
#endif
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_UNIX_RESOLVER_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,12 +31,12 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
#include "src/core/client_config/resolver_factory.h"
/** Create a zookeeper resolver factory */
grpc_resolver_factory *grpc_zookeeper_resolver_factory_create(void);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H */

@ -45,7 +45,9 @@
#include "src/core/client_config/subchannel_index.h"
#include "src/core/iomgr/timer.h"
#include "src/core/profiling/timers.h"
#include "src/core/support/backoff.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/channel_init.h"
#include "src/core/transport/connectivity_state.h"
#define INTERNAL_REF_BITS 16
@ -127,8 +129,8 @@ struct grpc_subchannel {
/** next connect attempt time */
gpr_timespec next_attempt;
/** amount to backoff each failure */
gpr_timespec backoff_delta;
/** backoff state */
gpr_backoff backoff_state;
/** do we have an active alarm? */
int have_alarm;
/** our alarm */
@ -146,7 +148,6 @@ struct grpc_subchannel_call {
#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \
(((grpc_subchannel_call *)(callstack)) - 1)
static gpr_timespec compute_connect_deadline(grpc_subchannel *c);
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
bool iomgr_success);
@ -337,6 +338,22 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_closure_init(&c->connected, subchannel_connected, c);
grpc_connectivity_state_init(&c->state_tracker, GRPC_CHANNEL_IDLE,
"subchannel");
gpr_backoff_init(&c->backoff_state,
GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER,
GRPC_SUBCHANNEL_RECONNECT_JITTER,
GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS * 1000,
GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
if (c->args) {
for (size_t i = 0; i < c->args->num_args; i++) {
if (0 == strcmp(c->args->args[i].key,
"grpc.testing.fixed_reconnect_backoff")) {
GPR_ASSERT(c->args->args[i].type == GRPC_ARG_INTEGER);
gpr_backoff_init(&c->backoff_state, 1.0, 0.0,
c->args->args[i].value.integer,
c->args->args[i].value.integer);
}
}
}
gpr_mu_init(&c->mu);
return grpc_subchannel_index_register(exec_ctx, key, c);
@ -348,7 +365,7 @@ static void continue_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
args.interested_parties = c->pollset_set;
args.addr = c->addr;
args.addr_len = c->addr_len;
args.deadline = compute_connect_deadline(c);
args.deadline = c->next_attempt;
args.channel_args = c->args;
args.initial_connect_string = c->initial_connect_string;
@ -359,10 +376,8 @@ static void continue_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
}
static void start_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
c->backoff_delta = gpr_time_from_seconds(
GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS, GPR_TIMESPAN);
c->next_attempt =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), c->backoff_delta);
gpr_backoff_begin(&c->backoff_state, gpr_now(GPR_CLOCK_MONOTONIC));
continue_connect(exec_ctx, c);
}
@ -507,32 +522,15 @@ void grpc_connected_subchannel_ping(grpc_exec_ctx *exec_ctx,
static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
grpc_subchannel *c) {
size_t channel_stack_size;
grpc_connected_subchannel *con;
grpc_channel_stack *stk;
size_t num_filters;
const grpc_channel_filter **filters;
state_watcher *sw_subchannel;
/* build final filter list */
num_filters = c->num_filters + c->connecting_result.num_filters + 1;
filters = gpr_malloc(sizeof(*filters) * num_filters);
if (c->num_filters > 0) {
memcpy((void *)filters, c->filters, sizeof(*filters) * c->num_filters);
}
memcpy((void *)(filters + c->num_filters), c->connecting_result.filters,
sizeof(*filters) * c->connecting_result.num_filters);
filters[num_filters - 1] = &grpc_connected_channel_filter;
/* construct channel stack */
channel_stack_size = grpc_channel_stack_size(filters, num_filters);
con = gpr_malloc(channel_stack_size);
con = grpc_channel_init_create_stack(
exec_ctx, GRPC_CLIENT_SUBCHANNEL, 0, c->connecting_result.channel_args, 1,
connection_destroy, NULL, c->connecting_result.transport);
stk = CHANNEL_STACK_FROM_CONNECTION(con);
grpc_channel_stack_init(exec_ctx, 1, connection_destroy, con, filters,
num_filters, c->connecting_result.channel_args,
"CONNECTED_SUBCHANNEL", stk);
grpc_connected_channel_bind_transport(stk, c->connecting_result.transport);
gpr_free((void *)c->connecting_result.filters);
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
/* initialize state watcher */
@ -543,9 +541,7 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
sw_subchannel);
if (c->disconnected) {
gpr_mu_unlock(&c->mu);
gpr_free(sw_subchannel);
gpr_free((void *)filters);
grpc_channel_stack_destroy(exec_ctx, stk);
gpr_free(con);
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
@ -573,52 +569,6 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
/* signal completion */
grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY,
"connected");
gpr_free((void *)filters);
}
/* Generate a random number between 0 and 1. */
static double generate_uniform_random_number(grpc_subchannel *c) {
c->random = (1103515245 * c->random + 12345) % ((uint32_t)1 << 31);
return c->random / (double)((uint32_t)1 << 31);
}
/* Update backoff_delta and next_attempt in subchannel */
static void update_reconnect_parameters(grpc_subchannel *c) {
size_t i;
int32_t backoff_delta_millis, jitter;
int32_t max_backoff_millis =
GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS * 1000;
double jitter_range;
if (c->args) {
for (i = 0; i < c->args->num_args; i++) {
if (0 == strcmp(c->args->args[i].key,
"grpc.testing.fixed_reconnect_backoff")) {
GPR_ASSERT(c->args->args[i].type == GRPC_ARG_INTEGER);
c->next_attempt = gpr_time_add(
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis(c->args->args[i].value.integer, GPR_TIMESPAN));
return;
}
}
}
backoff_delta_millis =
(int32_t)(gpr_time_to_millis(c->backoff_delta) *
GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER);
if (backoff_delta_millis > max_backoff_millis) {
backoff_delta_millis = max_backoff_millis;
}
c->backoff_delta = gpr_time_from_millis(backoff_delta_millis, GPR_TIMESPAN);
c->next_attempt =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), c->backoff_delta);
jitter_range = GRPC_SUBCHANNEL_RECONNECT_JITTER * backoff_delta_millis;
jitter =
(int32_t)((2 * generate_uniform_random_number(c) - 1) * jitter_range);
c->next_attempt =
gpr_time_add(c->next_attempt, gpr_time_from_millis(jitter, GPR_TIMESPAN));
}
static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
@ -629,7 +579,8 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
iomgr_success = 0;
}
if (iomgr_success) {
update_reconnect_parameters(c);
c->next_attempt =
gpr_backoff_step(&c->backoff_state, gpr_now(GPR_CLOCK_MONOTONIC));
continue_connect(exec_ctx, c);
gpr_mu_unlock(&c->mu);
} else {
@ -661,17 +612,6 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
}
static gpr_timespec compute_connect_deadline(grpc_subchannel *c) {
gpr_timespec current_deadline =
gpr_time_add(c->next_attempt, c->backoff_delta);
gpr_timespec min_deadline = gpr_time_add(
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS,
GPR_TIMESPAN));
return gpr_time_cmp(current_deadline, min_deadline) > 0 ? current_deadline
: min_deadline;
}
/*
* grpc_subchannel_call implementation
*/

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H
#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H
#include "src/core/channel/channel_stack.h"
#include "src/core/client_config/connector.h"
@ -171,4 +171,4 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_connector *connector,
grpc_subchannel_args *args);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#include "src/core/channel/channel_stack.h"
#include "src/core/client_config/subchannel.h"
@ -63,4 +63,4 @@ grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */

@ -108,6 +108,7 @@ static int subchannel_key_compare(grpc_subchannel_key *a,
if (c != 0) return c;
c = memcmp(a->args.filters, b->args.filters,
a->args.filter_count * sizeof(*a->args.filters));
if (c != 0) return c;
return grpc_channel_args_compare(a->args.args, b->args.args);
}

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
#include "src/core/client_config/connector.h"
#include "src/core/client_config/subchannel.h"
@ -74,4 +74,4 @@ void grpc_subchannel_index_init(void);
/** Shutdown the subchannel index (global) */
void grpc_subchannel_index_shutdown(void);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */
#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_URI_PARSER_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_URI_PARSER_H
#ifndef GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H
#define GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H
typedef struct {
char *scheme;
@ -48,4 +48,4 @@ grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors);
/** destroy a uri */
void grpc_uri_destroy(grpc_uri *uri);
#endif
#endif /* GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_METADATA_H
#define GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_METADATA_H
#ifndef GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H
#define GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H
#include <grpc/compression.h>
#include "src/core/transport/metadata.h"
@ -50,4 +50,4 @@ grpc_mdelem *grpc_compression_encoding_mdelem(
grpc_compression_algorithm grpc_compression_algorithm_from_mdstr(
grpc_mdstr *str);
#endif /* GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_METADATA_H */
#endif /* GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H */

@ -128,20 +128,57 @@ grpc_mdelem *grpc_compression_encoding_mdelem(
/* TODO(dgq): Add the ability to specify parameters to the individual
* compression algorithms */
grpc_compression_algorithm grpc_compression_algorithm_for_level(
grpc_compression_level level) {
grpc_compression_level level, uint32_t accepted_encodings) {
GRPC_API_TRACE("grpc_compression_algorithm_for_level(level=%d)", 1,
((int)level));
if (level > GRPC_COMPRESS_LEVEL_HIGH) {
gpr_log(GPR_ERROR, "Unknown compression level %d.", (int)level);
abort();
}
const size_t num_supported =
GPR_BITCOUNT(accepted_encodings) - 1; /* discard NONE */
if (level == GRPC_COMPRESS_LEVEL_NONE || num_supported == 0) {
return GRPC_COMPRESS_NONE;
}
GPR_ASSERT(level > 0);
/* Establish a "ranking" or compression algorithms in increasing order of
* compression.
* This is simplistic and we will probably want to introduce other dimensions
* in the future (cpu/memory cost, etc). */
const grpc_compression_algorithm algos_ranking[] = {GRPC_COMPRESS_GZIP,
GRPC_COMPRESS_DEFLATE};
/* intersect algos_ranking with the supported ones keeping the ranked order */
grpc_compression_algorithm
sorted_supported_algos[GRPC_COMPRESS_ALGORITHMS_COUNT];
size_t algos_supported_idx = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(algos_ranking); i++) {
const grpc_compression_algorithm alg = algos_ranking[i];
for (size_t j = 0; j < num_supported; j++) {
if (GPR_BITGET(accepted_encodings, alg) == 1) {
/* if \a alg in supported */
sorted_supported_algos[algos_supported_idx++] = alg;
break;
}
}
if (algos_supported_idx == num_supported) break;
}
switch (level) {
case GRPC_COMPRESS_LEVEL_NONE:
return GRPC_COMPRESS_NONE;
abort(); /* should have been handled already */
case GRPC_COMPRESS_LEVEL_LOW:
return sorted_supported_algos[0];
case GRPC_COMPRESS_LEVEL_MED:
return sorted_supported_algos[num_supported / 2];
case GRPC_COMPRESS_LEVEL_HIGH:
return GRPC_COMPRESS_DEFLATE;
return sorted_supported_algos[num_supported - 1];
default:
gpr_log(GPR_ERROR, "Unknown compression level %d.", (int)level);
abort();
}
};
}
void grpc_compression_options_init(grpc_compression_options *opts) {

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#define GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#ifndef GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#define GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#include <grpc/compression.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,
gpr_slice_buffer* input, gpr_slice_buffer* output);
#endif /* GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H */
#endif /* GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#define GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#ifndef GRPC_CORE_DEBUG_TRACE_H
#define GRPC_CORE_DEBUG_TRACE_H
#include <grpc/support/port_platform.h>
@ -40,4 +40,4 @@ void grpc_register_tracer(const char *name, int *flag);
void grpc_tracer_init(const char *env_var_name);
void grpc_tracer_shutdown(void);
#endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */
#endif /* GRPC_CORE_DEBUG_TRACE_H */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#define GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#ifndef GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
#define GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
#include "src/core/httpcli/httpcli.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,
size_t body_size);
#endif /* GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H */
#endif /* GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H */

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

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

Loading…
Cancel
Save