grpc 1.6.7 → 1.7.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +579 -77
  3. data/include/grpc/byte_buffer.h +1 -63
  4. data/include/grpc/compression.h +27 -5
  5. data/include/grpc/fork.h +24 -0
  6. data/include/grpc/grpc.h +12 -6
  7. data/include/grpc/grpc_security.h +28 -7
  8. data/include/grpc/impl/codegen/atm.h +1 -0
  9. data/include/grpc/impl/codegen/byte_buffer.h +86 -0
  10. data/include/grpc/impl/codegen/compression_types.h +63 -5
  11. data/include/grpc/impl/codegen/fork.h +48 -0
  12. data/include/grpc/impl/codegen/grpc_types.h +26 -9
  13. data/include/grpc/impl/codegen/port_platform.h +11 -4
  14. data/include/grpc/impl/codegen/slice.h +6 -1
  15. data/include/grpc/impl/codegen/sync.h +3 -1
  16. data/include/grpc/impl/codegen/sync_custom.h +36 -0
  17. data/include/grpc/module.modulemap +75 -3
  18. data/include/grpc/slice.h +1 -5
  19. data/include/grpc/support/sync_custom.h +24 -0
  20. data/src/core/ext/census/base_resources.c +14 -14
  21. data/src/core/ext/census/context.c +7 -5
  22. data/src/core/ext/census/grpc_filter.c +12 -14
  23. data/src/core/ext/census/mlog.c +2 -1
  24. data/src/core/ext/census/resource.c +13 -9
  25. data/src/core/ext/filters/client_channel/channel_connectivity.c +15 -8
  26. data/src/core/ext/filters/client_channel/client_channel.c +418 -439
  27. data/src/core/ext/filters/client_channel/client_channel_factory.c +4 -5
  28. data/src/core/ext/filters/client_channel/client_channel_plugin.c +2 -2
  29. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +7 -5
  30. data/src/core/ext/filters/client_channel/http_proxy.c +17 -21
  31. data/src/core/ext/filters/client_channel/lb_policy.c +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +7 -7
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +371 -257
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +7 -5
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +25 -14
  36. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +16 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +33 -28
  38. data/src/core/ext/filters/client_channel/lb_policy_factory.c +10 -8
  39. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
  40. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +1 -1
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +7 -6
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +62 -28
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +29 -23
  44. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +25 -14
  45. data/src/core/ext/filters/client_channel/retry_throttle.c +9 -6
  46. data/src/core/ext/filters/client_channel/subchannel.c +30 -30
  47. data/src/core/ext/filters/client_channel/subchannel.h +1 -4
  48. data/src/core/ext/filters/client_channel/subchannel_index.c +31 -15
  49. data/src/core/ext/filters/client_channel/subchannel_index.h +7 -0
  50. data/src/core/ext/filters/client_channel/uri_parser.c +4 -3
  51. data/src/core/ext/filters/deadline/deadline_filter.c +78 -39
  52. data/src/core/ext/filters/deadline/deadline_filter.h +7 -1
  53. data/src/core/ext/filters/http/client/http_client_filter.c +14 -14
  54. data/src/core/ext/filters/http/http_filters_plugin.c +1 -1
  55. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +240 -175
  56. data/src/core/ext/filters/http/server/http_server_filter.c +48 -36
  57. data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c} +11 -12
  58. data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h} +6 -5
  59. data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c} +19 -13
  60. data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h} +4 -3
  61. data/src/core/ext/filters/max_age/max_age_filter.c +2 -3
  62. data/src/core/ext/filters/message_size/message_size_filter.c +4 -2
  63. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +0 -1
  64. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +5 -5
  65. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  66. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +1 -1
  67. data/src/core/ext/transport/chttp2/server/chttp2_server.c +20 -18
  68. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +1 -0
  69. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +493 -210
  70. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  71. data/src/core/ext/transport/chttp2/transport/flow_control.c +9 -8
  72. data/src/core/ext/transport/chttp2/transport/frame_data.c +2 -2
  73. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +2 -2
  74. data/src/core/ext/transport/chttp2/transport/frame_ping.c +5 -4
  75. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  76. data/src/core/ext/transport/chttp2/transport/frame_settings.c +10 -9
  77. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +9 -5
  78. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +62 -41
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +52 -8
  80. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  81. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +3 -2
  82. data/src/core/ext/transport/chttp2/transport/internal.h +60 -30
  83. data/src/core/ext/transport/chttp2/transport/parsing.c +16 -5
  84. data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -16
  85. data/src/core/ext/transport/chttp2/transport/stream_map.c +6 -4
  86. data/src/core/ext/transport/chttp2/transport/writing.c +133 -105
  87. data/src/core/ext/transport/inproc/inproc_transport.c +61 -65
  88. data/src/core/lib/channel/channel_args.c +112 -12
  89. data/src/core/lib/channel/channel_args.h +31 -0
  90. data/src/core/lib/channel/channel_stack.c +1 -15
  91. data/src/core/lib/channel/channel_stack.h +3 -10
  92. data/src/core/lib/channel/channel_stack_builder.c +41 -10
  93. data/src/core/lib/channel/channel_stack_builder.h +10 -0
  94. data/src/core/lib/channel/connected_channel.c +94 -23
  95. data/src/core/lib/channel/handshaker.c +8 -6
  96. data/src/core/lib/channel/handshaker_registry.c +1 -1
  97. data/src/core/lib/compression/algorithm_metadata.h +14 -0
  98. data/src/core/lib/compression/compression.c +101 -1
  99. data/src/core/lib/compression/stream_compression.c +32 -146
  100. data/src/core/lib/compression/stream_compression.h +28 -4
  101. data/src/core/lib/compression/stream_compression_gzip.c +228 -0
  102. data/src/core/lib/{iomgr/ev_epoll_thread_pool_linux.h → compression/stream_compression_gzip.h} +5 -7
  103. data/src/core/lib/compression/stream_compression_identity.c +94 -0
  104. data/src/core/lib/{iomgr/ev_epoll_limited_pollers_linux.h → compression/stream_compression_identity.h} +7 -8
  105. data/src/core/lib/debug/stats.c +174 -0
  106. data/src/core/lib/debug/stats.h +61 -0
  107. data/src/core/lib/debug/stats_data.c +687 -0
  108. data/src/core/lib/debug/stats_data.h +470 -0
  109. data/src/core/lib/debug/trace.c +3 -3
  110. data/src/core/lib/debug/trace.h +1 -1
  111. data/src/core/lib/http/format_request.c +1 -1
  112. data/src/core/lib/http/httpcli.c +8 -7
  113. data/src/core/lib/http/httpcli_security_connector.c +2 -1
  114. data/src/core/lib/http/parser.c +4 -3
  115. data/src/core/lib/iomgr/call_combiner.c +202 -0
  116. data/src/core/lib/iomgr/call_combiner.h +121 -0
  117. data/src/core/lib/iomgr/closure.c +18 -4
  118. data/src/core/lib/iomgr/combiner.c +11 -4
  119. data/src/core/lib/iomgr/error.c +26 -24
  120. data/src/core/lib/iomgr/ev_epoll1_linux.c +395 -212
  121. data/src/core/lib/iomgr/ev_epollex_linux.c +141 -128
  122. data/src/core/lib/iomgr/ev_epollsig_linux.c +44 -41
  123. data/src/core/lib/iomgr/ev_poll_posix.c +99 -75
  124. data/src/core/lib/iomgr/ev_posix.c +5 -9
  125. data/src/core/lib/iomgr/ev_posix.h +1 -1
  126. data/src/core/lib/iomgr/exec_ctx.h +6 -1
  127. data/src/core/lib/iomgr/executor.c +142 -36
  128. data/src/core/lib/iomgr/executor.h +6 -1
  129. data/src/core/lib/iomgr/fork_posix.c +88 -0
  130. data/src/core/lib/iomgr/fork_windows.c +39 -0
  131. data/src/core/lib/iomgr/iocp_windows.c +2 -0
  132. data/src/core/lib/iomgr/iomgr.c +2 -8
  133. data/src/core/lib/iomgr/is_epollexclusive_available.c +6 -6
  134. data/src/core/lib/iomgr/load_file.c +2 -1
  135. data/src/core/lib/iomgr/polling_entity.c +9 -9
  136. data/src/core/lib/iomgr/polling_entity.h +7 -1
  137. data/src/core/lib/iomgr/pollset.h +1 -1
  138. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  139. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  140. data/src/core/lib/iomgr/port.h +4 -0
  141. data/src/core/lib/iomgr/resolve_address_posix.c +8 -7
  142. data/src/core/lib/iomgr/resolve_address_windows.c +1 -1
  143. data/src/core/lib/iomgr/resource_quota.c +24 -19
  144. data/src/core/lib/iomgr/socket_factory_posix.c +4 -4
  145. data/src/core/lib/iomgr/socket_mutator.c +4 -4
  146. data/src/core/lib/iomgr/socket_utils_windows.c +0 -4
  147. data/src/core/lib/iomgr/tcp_client_posix.c +5 -4
  148. data/src/core/lib/iomgr/tcp_posix.c +181 -20
  149. data/src/core/lib/iomgr/tcp_server_posix.c +8 -7
  150. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +1 -1
  151. data/src/core/lib/iomgr/timer.h +4 -0
  152. data/src/core/lib/iomgr/timer_generic.c +138 -3
  153. data/src/core/lib/iomgr/timer_generic.h +3 -0
  154. data/src/core/lib/iomgr/timer_heap.c +4 -4
  155. data/src/core/lib/iomgr/timer_manager.c +2 -2
  156. data/src/core/lib/iomgr/timer_uv.c +2 -0
  157. data/src/core/lib/iomgr/udp_server.c +10 -8
  158. data/src/core/lib/iomgr/unix_sockets_posix.c +4 -2
  159. data/src/core/lib/iomgr/wakeup_fd_cv.c +9 -8
  160. data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -2
  161. data/src/core/lib/json/json.c +1 -1
  162. data/src/core/lib/json/json_string.c +13 -13
  163. data/src/core/lib/profiling/timers.h +18 -8
  164. data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -10
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +2 -1
  166. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +11 -6
  167. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +4 -4
  168. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +132 -50
  169. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  170. data/src/core/lib/security/transport/client_auth_filter.c +68 -135
  171. data/src/core/lib/security/transport/secure_endpoint.c +110 -90
  172. data/src/core/lib/security/transport/secure_endpoint.h +8 -3
  173. data/src/core/lib/security/transport/security_connector.c +10 -12
  174. data/src/core/lib/security/transport/security_handshaker.c +45 -24
  175. data/src/core/lib/security/transport/server_auth_filter.c +71 -20
  176. data/src/core/lib/slice/b64.c +2 -2
  177. data/src/core/lib/slice/slice.c +16 -14
  178. data/src/core/lib/slice/slice_buffer.c +5 -4
  179. data/src/core/lib/slice/slice_hash_table.c +3 -2
  180. data/src/core/lib/slice/slice_intern.c +8 -5
  181. data/src/core/lib/support/block_annotate.h +22 -0
  182. data/src/core/lib/support/fork.c +62 -0
  183. data/src/core/lib/support/fork.h +35 -0
  184. data/src/core/lib/support/log_linux.c +1 -1
  185. data/src/core/lib/support/string.c +15 -1
  186. data/src/core/lib/support/string.h +3 -0
  187. data/src/core/lib/support/thd_internal.h +6 -0
  188. data/src/core/lib/support/thd_posix.c +56 -0
  189. data/src/core/lib/support/thd_windows.c +2 -0
  190. data/src/core/lib/surface/alarm.c +22 -15
  191. data/src/core/lib/surface/byte_buffer.c +4 -2
  192. data/src/core/lib/surface/call.c +442 -141
  193. data/src/core/lib/surface/call.h +6 -6
  194. data/src/core/lib/surface/call_log_batch.c +1 -1
  195. data/src/core/lib/surface/call_test_only.h +12 -0
  196. data/src/core/lib/surface/channel.c +39 -4
  197. data/src/core/lib/surface/channel_init.c +6 -6
  198. data/src/core/lib/surface/channel_ping.c +2 -2
  199. data/src/core/lib/surface/completion_queue.c +56 -57
  200. data/src/core/lib/surface/init.c +17 -3
  201. data/src/core/lib/surface/init_secure.c +5 -1
  202. data/src/core/lib/surface/lame_client.cc +9 -10
  203. data/src/core/lib/surface/server.c +81 -72
  204. data/src/core/lib/surface/version.c +2 -2
  205. data/src/core/lib/transport/byte_stream.c +1 -0
  206. data/src/core/lib/transport/byte_stream.h +3 -1
  207. data/src/core/lib/transport/connectivity_state.c +2 -1
  208. data/src/core/lib/transport/metadata.c +7 -4
  209. data/src/core/lib/transport/metadata_batch.c +18 -16
  210. data/src/core/lib/transport/metadata_batch.h +1 -0
  211. data/src/core/lib/transport/service_config.c +5 -3
  212. data/src/core/lib/transport/static_metadata.c +395 -614
  213. data/src/core/lib/transport/static_metadata.h +165 -133
  214. data/src/core/lib/transport/status_conversion.c +1 -1
  215. data/src/core/lib/transport/transport.c +20 -20
  216. data/src/core/lib/transport/transport.h +8 -5
  217. data/src/core/lib/transport/transport_impl.h +0 -3
  218. data/src/core/lib/transport/transport_op_string.c +8 -1
  219. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -4
  220. data/src/core/tsi/fake_transport_security.c +133 -2
  221. data/src/core/tsi/fake_transport_security.h +5 -0
  222. data/src/core/tsi/ssl_transport_security.c +105 -8
  223. data/src/core/tsi/ssl_transport_security.h +30 -7
  224. data/src/core/tsi/transport_security.h +8 -2
  225. data/src/core/tsi/transport_security_grpc.c +20 -13
  226. data/src/core/tsi/transport_security_grpc.h +13 -9
  227. data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
  228. data/src/ruby/ext/grpc/rb_grpc.c +1 -1
  229. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
  230. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
  231. data/src/ruby/lib/grpc.rb +1 -0
  232. data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
  233. data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
  234. data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
  235. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  236. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  237. data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
  238. data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
  239. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
  240. data/src/ruby/lib/grpc/version.rb +1 -1
  241. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
  242. data/src/ruby/spec/channel_connection_spec.rb +1 -34
  243. data/src/ruby/spec/client_server_spec.rb +188 -82
  244. data/src/ruby/spec/generic/active_call_spec.rb +65 -11
  245. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  246. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  247. data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
  248. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
  249. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  250. data/src/ruby/spec/spec_helper.rb +4 -0
  251. data/src/ruby/spec/support/helpers.rb +73 -0
  252. data/src/ruby/spec/support/services.rb +147 -0
  253. data/third_party/cares/ares_build.h +21 -62
  254. data/third_party/cares/cares/ares.h +23 -1
  255. data/third_party/cares/cares/ares__close_sockets.c +2 -2
  256. data/third_party/cares/cares/ares_create_query.c +3 -3
  257. data/third_party/cares/cares/ares_expand_name.c +6 -2
  258. data/third_party/cares/cares/ares_expand_string.c +1 -1
  259. data/third_party/cares/cares/ares_getnameinfo.c +27 -7
  260. data/third_party/cares/cares/ares_init.c +407 -39
  261. data/third_party/cares/cares/ares_library_init.c +10 -0
  262. data/third_party/cares/cares/ares_library_init.h +2 -1
  263. data/third_party/cares/cares/ares_nowarn.c +6 -6
  264. data/third_party/cares/cares/ares_nowarn.h +2 -2
  265. data/third_party/cares/cares/ares_parse_naptr_reply.c +6 -1
  266. data/third_party/cares/cares/ares_private.h +11 -0
  267. data/third_party/cares/cares/ares_process.c +126 -37
  268. data/third_party/cares/cares/ares_version.h +2 -2
  269. data/third_party/cares/cares/ares_writev.c +2 -2
  270. data/third_party/cares/cares/config-win32.h +8 -34
  271. data/third_party/cares/cares/inet_net_pton.c +2 -2
  272. data/third_party/cares/cares/setup_once.h +5 -5
  273. data/third_party/cares/config_darwin/ares_config.h +98 -196
  274. data/third_party/cares/config_linux/ares_config.h +103 -203
  275. metadata +47 -20
  276. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +0 -1957
  277. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +0 -1182
@@ -19,69 +19,7 @@
19
19
  #ifndef GRPC_BYTE_BUFFER_H
20
20
  #define GRPC_BYTE_BUFFER_H
21
21
 
22
- #include <grpc/impl/codegen/grpc_types.h>
22
+ #include <grpc/impl/codegen/byte_buffer.h>
23
23
  #include <grpc/slice_buffer.h>
24
24
 
25
- #ifdef __cplusplus
26
- extern "C" {
27
- #endif
28
-
29
- /** Returns a RAW byte buffer instance over the given slices (up to \a nslices).
30
- *
31
- * Increases the reference count for all \a slices processed. The user is
32
- * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
33
- GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
34
- size_t nslices);
35
-
36
- /** Returns a *compressed* RAW byte buffer instance over the given slices (up to
37
- * \a nslices). The \a compression argument defines the compression algorithm
38
- * used to generate the data in \a slices.
39
- *
40
- * Increases the reference count for all \a slices processed. The user is
41
- * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
42
- GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
43
- grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
44
-
45
- /** Copies input byte buffer \a bb.
46
- *
47
- * Increases the reference count of all the source slices. The user is
48
- * responsible for calling grpc_byte_buffer_destroy over the returned copy. */
49
- GRPCAPI grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
50
-
51
- /** Returns the size of the given byte buffer, in bytes. */
52
- GRPCAPI size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
53
-
54
- /** Destroys \a byte_buffer deallocating all its memory. */
55
- GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
56
-
57
- /** Reader for byte buffers. Iterates over slices in the byte buffer */
58
- struct grpc_byte_buffer_reader;
59
- typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader;
60
-
61
- /** Initialize \a reader to read over \a buffer.
62
- * Returns 1 upon success, 0 otherwise. */
63
- GRPCAPI int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
64
- grpc_byte_buffer *buffer);
65
-
66
- /** Cleanup and destroy \a reader */
67
- GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
68
-
69
- /** Updates \a slice with the next piece of data from from \a reader and returns
70
- * 1. Returns 0 at the end of the stream. Caller is responsible for calling
71
- * grpc_slice_unref on the result. */
72
- GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
73
- grpc_slice *slice);
74
-
75
- /** Merge all data from \a reader into single slice */
76
- GRPCAPI grpc_slice
77
- grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
78
-
79
- /** Returns a RAW byte buffer instance from the output of \a reader. */
80
- GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
81
- grpc_byte_buffer_reader *reader);
82
-
83
- #ifdef __cplusplus
84
- }
85
- #endif
86
-
87
25
  #endif /* GRPC_BYTE_BUFFER_H */
@@ -30,25 +30,42 @@
30
30
  extern "C" {
31
31
  #endif
32
32
 
33
- /** Parses the first \a name_length bytes of \a name as a
34
- * grpc_compression_algorithm instance, updating \a algorithm. Returns 1 upon
35
- * success, 0 otherwise. */
33
+ /** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
34
+ * algorithm. Returns 1 upon success, 0 otherwise. */
36
35
  GRPCAPI int grpc_compression_algorithm_parse(
37
36
  grpc_slice value, grpc_compression_algorithm *algorithm);
38
37
 
38
+ /** Parses the \a slice as a grpc_stream_compression_algorithm instance and
39
+ * updating \a algorithm. Returns 1 upon success, 0 otherwise. */
40
+ int grpc_stream_compression_algorithm_parse(
41
+ grpc_slice name, grpc_stream_compression_algorithm *algorithm);
42
+
39
43
  /** Updates \a name with the encoding name corresponding to a valid \a
40
44
  * algorithm. Note that \a name is statically allocated and must *not* be freed.
41
45
  * Returns 1 upon success, 0 otherwise. */
42
46
  GRPCAPI int grpc_compression_algorithm_name(
43
- grpc_compression_algorithm algorithm, char **name);
47
+ grpc_compression_algorithm algorithm, const char **name);
48
+
49
+ /** Updates \a name with the encoding name corresponding to a valid \a
50
+ * algorithm. Note that \a name is statically allocated and must *not* be freed.
51
+ * Returns 1 upon success, 0 otherwise. */
52
+ GRPCAPI int grpc_stream_compression_algorithm_name(
53
+ grpc_stream_compression_algorithm algorithm, const char **name);
44
54
 
45
55
  /** Returns the compression algorithm corresponding to \a level for the
46
56
  * compression algorithms encoded in the \a accepted_encodings bitset.
47
57
  *
48
- * It abort()s for unknown levels . */
58
+ * It abort()s for unknown levels. */
49
59
  GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(
50
60
  grpc_compression_level level, uint32_t accepted_encodings);
51
61
 
62
+ /** Returns the stream compression algorithm corresponding to \a level for the
63
+ * compression algorithms encoded in the \a accepted_stream_encodings bitset.
64
+ * It abort()s for unknown levels. */
65
+ GRPCAPI grpc_stream_compression_algorithm
66
+ grpc_stream_compression_algorithm_for_level(grpc_stream_compression_level level,
67
+ uint32_t accepted_stream_encodings);
68
+
52
69
  GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts);
53
70
 
54
71
  /** Mark \a algorithm as enabled in \a opts. */
@@ -63,6 +80,11 @@ GRPCAPI void grpc_compression_options_disable_algorithm(
63
80
  GRPCAPI int grpc_compression_options_is_algorithm_enabled(
64
81
  const grpc_compression_options *opts, grpc_compression_algorithm algorithm);
65
82
 
83
+ /** Returns true if \a algorithm is marked as enabled in \a opts. */
84
+ GRPCAPI int grpc_compression_options_is_stream_compression_algorithm_enabled(
85
+ const grpc_compression_options *opts,
86
+ grpc_stream_compression_algorithm algorithm);
87
+
66
88
  #ifdef __cplusplus
67
89
  }
68
90
  #endif
@@ -0,0 +1,24 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_FORK_H
20
+ #define GRPC_FORK_H
21
+
22
+ #include <grpc/impl/codegen/fork.h>
23
+
24
+ #endif /* GRPC_FORK_H */
@@ -143,21 +143,24 @@ GRPCAPI void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
143
143
  drained and no threads are executing grpc_completion_queue_next */
144
144
  GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue *cq);
145
145
 
146
- /** Create a completion queue alarm instance associated to \a cq.
146
+ /** Create a completion queue alarm instance */
147
+ GRPCAPI grpc_alarm *grpc_alarm_create(void *reserved);
148
+
149
+ /** Set a completion queue alarm instance associated to \a cq.
147
150
  *
148
151
  * Once the alarm expires (at \a deadline) or it's cancelled (see \a
149
152
  * grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the
150
153
  * alarm expired, the event's success bit will be true, false otherwise (ie,
151
154
  * upon cancellation). */
152
- GRPCAPI grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq,
153
- gpr_timespec deadline, void *tag);
155
+ GRPCAPI void grpc_alarm_set(grpc_alarm *alarm, grpc_completion_queue *cq,
156
+ gpr_timespec deadline, void *tag, void *reserved);
154
157
 
155
158
  /** Cancel a completion queue alarm. Calling this function over an alarm that
156
159
  * has already fired has no effect. */
157
- GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm);
160
+ GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm, void *reserved);
158
161
 
159
162
  /** Destroy the given completion queue alarm, cancelling it in the process. */
160
- GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm);
163
+ GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm, void *reserved);
161
164
 
162
165
  /** Check the connectivity state of a channel. */
163
166
  GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(
@@ -178,6 +181,9 @@ GRPCAPI void grpc_channel_watch_connectivity_state(
178
181
  grpc_channel *channel, grpc_connectivity_state last_observed_state,
179
182
  gpr_timespec deadline, grpc_completion_queue *cq, void *tag);
180
183
 
184
+ /** Check whether a grpc channel supports connectivity watcher */
185
+ GRPCAPI int grpc_channel_support_connectivity_watcher(grpc_channel *channel);
186
+
181
187
  /** Create a call given a grpc_channel, in order to call 'method'. All
182
188
  completions are sent to 'completion_queue'. 'method' and 'host' need only
183
189
  live through the invocation of this function.
@@ -307,7 +313,7 @@ GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
307
313
  void *reserved);
308
314
 
309
315
  /** Ref a call.
310
- THREAD SAFETY: grpc_call_unref is thread-compatible */
316
+ THREAD SAFETY: grpc_call_ref is thread-compatible */
311
317
  GRPCAPI void grpc_call_ref(grpc_call *call);
312
318
 
313
319
  /** Unref a call.
@@ -249,19 +249,40 @@ typedef struct {
249
249
  void *reserved;
250
250
  } grpc_auth_metadata_context;
251
251
 
252
+ /** Maximum number of metadata entries returnable by a credentials plugin via
253
+ a synchronous return. */
254
+ #define GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX 4
255
+
252
256
  /** grpc_metadata_credentials plugin is an API user provided structure used to
253
257
  create grpc_credentials objects that can be set on a channel (composed) or
254
258
  a call. See grpc_credentials_metadata_create_from_plugin below.
255
259
  The grpc client stack will call the get_metadata method of the plugin for
256
260
  every call in scope for the credentials created from it. */
257
261
  typedef struct {
258
- /** The implementation of this method has to be non-blocking.
259
- - context is the information that can be used by the plugin to create auth
260
- metadata.
261
- - cb is the callback that needs to be called when the metadata is ready.
262
- - user_data needs to be passed as the first parameter of the callback. */
263
- void (*get_metadata)(void *state, grpc_auth_metadata_context context,
264
- grpc_credentials_plugin_metadata_cb cb, void *user_data);
262
+ /** The implementation of this method has to be non-blocking, but can
263
+ be performed synchronously or asynchronously.
264
+
265
+ If processing occurs synchronously, returns non-zero and populates
266
+ creds_md, num_creds_md, status, and error_details. In this case,
267
+ the caller takes ownership of the entries in creds_md and of
268
+ error_details. Note that if the plugin needs to return more than
269
+ GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX entries in creds_md, it must
270
+ return asynchronously.
271
+
272
+ If processing occurs asynchronously, returns zero and invokes \a cb
273
+ when processing is completed. \a user_data will be passed as the
274
+ first parameter of the callback. NOTE: \a cb MUST be invoked in a
275
+ different thread, not from the thread in which \a get_metadata() is
276
+ invoked.
277
+
278
+ \a context is the information that can be used by the plugin to create
279
+ auth metadata. */
280
+ int (*get_metadata)(
281
+ void *state, grpc_auth_metadata_context context,
282
+ grpc_credentials_plugin_metadata_cb cb, void *user_data,
283
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
284
+ size_t *num_creds_md, grpc_status_code *status,
285
+ const char **error_details);
265
286
 
266
287
  /** Destroys the plugin state. */
267
288
  void (*destroy)(void *state);
@@ -46,6 +46,7 @@
46
46
 
47
47
  // Atomically return *p, with acquire semantics.
48
48
  gpr_atm gpr_atm_acq_load(gpr_atm *p);
49
+ gpr_atm gpr_atm_no_barrier_load(gpr_atm *p);
49
50
 
50
51
  // Atomically set *p = value, with release semantics.
51
52
  void gpr_atm_rel_store(gpr_atm *p, gpr_atm value);
@@ -0,0 +1,86 @@
1
+ /*
2
+ *
3
+ * Copyright 2015 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_H
20
+ #define GRPC_IMPL_CODEGEN_BYTE_BUFFER_H
21
+
22
+ #include <grpc/impl/codegen/grpc_types.h>
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ /** Returns a RAW byte buffer instance over the given slices (up to \a nslices).
29
+ *
30
+ * Increases the reference count for all \a slices processed. The user is
31
+ * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
32
+ GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
33
+ size_t nslices);
34
+
35
+ /** Returns a *compressed* RAW byte buffer instance over the given slices (up to
36
+ * \a nslices). The \a compression argument defines the compression algorithm
37
+ * used to generate the data in \a slices.
38
+ *
39
+ * Increases the reference count for all \a slices processed. The user is
40
+ * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
41
+ GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
42
+ grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
43
+
44
+ /** Copies input byte buffer \a bb.
45
+ *
46
+ * Increases the reference count of all the source slices. The user is
47
+ * responsible for calling grpc_byte_buffer_destroy over the returned copy. */
48
+ GRPCAPI grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
49
+
50
+ /** Returns the size of the given byte buffer, in bytes. */
51
+ GRPCAPI size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
52
+
53
+ /** Destroys \a byte_buffer deallocating all its memory. */
54
+ GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
55
+
56
+ /** Reader for byte buffers. Iterates over slices in the byte buffer */
57
+ struct grpc_byte_buffer_reader;
58
+ typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader;
59
+
60
+ /** Initialize \a reader to read over \a buffer.
61
+ * Returns 1 upon success, 0 otherwise. */
62
+ GRPCAPI int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
63
+ grpc_byte_buffer *buffer);
64
+
65
+ /** Cleanup and destroy \a reader */
66
+ GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
67
+
68
+ /** Updates \a slice with the next piece of data from from \a reader and returns
69
+ * 1. Returns 0 at the end of the stream. Caller is responsible for calling
70
+ * grpc_slice_unref on the result. */
71
+ GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
72
+ grpc_slice *slice);
73
+
74
+ /** Merge all data from \a reader into single slice */
75
+ GRPCAPI grpc_slice
76
+ grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
77
+
78
+ /** Returns a RAW byte buffer instance from the output of \a reader. */
79
+ GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
80
+ grpc_byte_buffer_reader *reader);
81
+
82
+ #ifdef __cplusplus
83
+ }
84
+ #endif
85
+
86
+ #endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_H */
@@ -29,6 +29,11 @@ extern "C" {
29
29
  * algorithm */
30
30
  #define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
31
31
  "grpc-internal-encoding-request"
32
+ /** To be used as initial metadata key for the request of a concrete stream
33
+ * compression
34
+ * algorithm */
35
+ #define GRPC_STREAM_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
36
+ "grpc-internal-stream-encoding-request"
32
37
 
33
38
  /** To be used in channel arguments.
34
39
  *
@@ -38,9 +43,17 @@ extern "C" {
38
43
  * Its value is an int from the \a grpc_compression_algorithm enum. */
39
44
  #define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
40
45
  "grpc.default_compression_algorithm"
46
+ /** Default stream compression algorithm for the channel.
47
+ * Its value is an int from the \a grpc_stream_compression_algorithm enum. */
48
+ #define GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
49
+ "grpc.default_stream_compression_algorithm"
41
50
  /** Default compression level for the channel.
42
51
  * Its value is an int from the \a grpc_compression_level enum. */
43
52
  #define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
53
+ /** Default stream compression level for the channel.
54
+ * Its value is an int from the \a grpc_stream_compression_level enum. */
55
+ #define GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_LEVEL \
56
+ "grpc.default_stream_compression_level"
44
57
  /** Compression algorithms supported by the channel.
45
58
  * Its value is a bitset (an int). Bits correspond to algorithms in \a
46
59
  * grpc_compression_algorithm. For example, its LSB corresponds to
@@ -50,6 +63,15 @@ extern "C" {
50
63
  * be ignored). */
51
64
  #define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
52
65
  "grpc.compression_enabled_algorithms_bitset"
66
+ /** Stream compression algorithms supported by the channel.
67
+ * Its value is a bitset (an int). Bits correspond to algorithms in \a
68
+ * grpc_stream_compression_algorithm. For example, its LSB corresponds to
69
+ * GRPC_STREAM_COMPRESS_NONE, the next bit to GRPC_STREAM_COMPRESS_DEFLATE, etc.
70
+ * Unset bits disable support for the algorithm. By default all algorithms are
71
+ * supported. It's not possible to disable GRPC_STREAM_COMPRESS_NONE (the
72
+ * attempt will be ignored). */
73
+ #define GRPC_STREAM_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
74
+ "grpc.stream_compression_enabled_algorithms_bitset"
53
75
  /** \} */
54
76
 
55
77
  /** The various compression algorithms supported by gRPC */
@@ -61,6 +83,13 @@ typedef enum {
61
83
  GRPC_COMPRESS_ALGORITHMS_COUNT
62
84
  } grpc_compression_algorithm;
63
85
 
86
+ /** Stream compresssion algorithms supported by gRPC */
87
+ typedef enum {
88
+ GRPC_STREAM_COMPRESS_NONE = 0,
89
+ GRPC_STREAM_COMPRESS_GZIP,
90
+ GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT
91
+ } grpc_stream_compression_algorithm;
92
+
64
93
  /** Compression levels allow a party with knowledge of its peer's accepted
65
94
  * encodings to request compression in an abstract way. The level-algorithm
66
95
  * mapping is performed internally and depends on the peer's supported
@@ -73,23 +102,42 @@ typedef enum {
73
102
  GRPC_COMPRESS_LEVEL_COUNT
74
103
  } grpc_compression_level;
75
104
 
105
+ /** Compression levels for stream compression algorithms */
106
+ typedef enum {
107
+ GRPC_STREAM_COMPRESS_LEVEL_NONE = 0,
108
+ GRPC_STREAM_COMPRESS_LEVEL_LOW,
109
+ GRPC_STREAM_COMPRESS_LEVEL_MED,
110
+ GRPC_STREAM_COMPRESS_LEVEL_HIGH,
111
+ GRPC_STREAM_COMPRESS_LEVEL_COUNT
112
+ } grpc_stream_compression_level;
113
+
76
114
  typedef struct grpc_compression_options {
77
115
  /** All algs are enabled by default. This option corresponds to the channel
78
116
  * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
79
117
  */
80
118
  uint32_t enabled_algorithms_bitset;
119
+ uint32_t enabled_stream_compression_algorithms_bitset;
81
120
 
82
- /** The default channel compression level. It'll be used in the absence of
83
- * call specific settings. This option corresponds to the channel argument key
84
- * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes
85
- * precedence over \a default_algorithm.
121
+ /** The default message-wise compression level. It'll be used in the absence
122
+ * of * call specific settings. This option corresponds to the channel
123
+ * argument key behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present,
124
+ * takes precedence over \a default_algorithm and \a
125
+ * default_stream_compression_algorithm.
86
126
  * TODO(dgq): currently only available for server channels. */
87
127
  struct grpc_compression_options_default_level {
88
128
  int is_set;
89
129
  grpc_compression_level level;
90
130
  } default_level;
91
131
 
92
- /** The default channel compression algorithm. It'll be used in the absence of
132
+ /** The default stream compression level. It'll be used in the absence of call
133
+ * specefic settings. If present, takes precedence over \a default_level,
134
+ * \a default_algorithm and \a default_stream_compression_algorithm. */
135
+ struct grpc_stream_compression_options_default_level {
136
+ int is_set;
137
+ grpc_stream_compression_level level;
138
+ } default_stream_compression_level;
139
+
140
+ /** The default message compression algorithm. It'll be used in the absence of
93
141
  * call specific settings. This option corresponds to the channel argument key
94
142
  * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
95
143
  struct grpc_compression_options_default_algorithm {
@@ -97,6 +145,16 @@ typedef struct grpc_compression_options {
97
145
  grpc_compression_algorithm algorithm;
98
146
  } default_algorithm;
99
147
 
148
+ /** The default stream compression algorithm. It'll be used in the absence of
149
+ * call specific settings. If present, takes precedence over \a
150
+ * default_algorithm. This option corresponds to the channel
151
+ * argument key behind \a GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM.
152
+ */
153
+ struct grpc_stream_compression_options_default_algorithm {
154
+ int is_set;
155
+ grpc_stream_compression_algorithm algorithm;
156
+ } default_stream_compression_algorithm;
157
+
100
158
  } grpc_compression_options;
101
159
 
102
160
  #ifdef __cplusplus