wearefair-grpc 1.3.1.pre.c → 1.4.0.fair

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +418 -126
  3. data/include/grpc/grpc.h +15 -69
  4. data/include/grpc/grpc_security.h +1 -1
  5. data/include/grpc/impl/codegen/compression_types.h +3 -4
  6. data/include/grpc/impl/codegen/gpr_types.h +0 -1
  7. data/include/grpc/impl/codegen/grpc_types.h +69 -3
  8. data/include/grpc/impl/codegen/port_platform.h +6 -0
  9. data/include/grpc/impl/codegen/slice.h +2 -1
  10. data/include/grpc/load_reporting.h +6 -6
  11. data/include/grpc/slice.h +25 -3
  12. data/include/grpc/slice_buffer.h +4 -0
  13. data/src/core/ext/census/context.c +1 -1
  14. data/src/core/ext/census/resource.c +3 -1
  15. data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
  16. data/src/core/ext/filters/client_channel/client_channel.c +158 -100
  17. data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
  18. data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
  19. data/src/core/ext/filters/client_channel/lb_policy.h +5 -6
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +344 -88
  23. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
  25. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -5
  26. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +6 -0
  27. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
  29. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +13 -12
  31. data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
  32. data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
  33. data/src/core/ext/filters/client_channel/parse_address.c +37 -7
  34. data/src/core/ext/filters/client_channel/parse_address.h +11 -8
  35. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
  36. data/src/core/ext/filters/client_channel/subchannel.c +19 -16
  37. data/src/core/ext/filters/client_channel/subchannel.h +1 -0
  38. data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
  39. data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
  40. data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
  41. data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
  42. data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
  43. data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
  44. data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
  45. data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
  46. data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
  47. data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
  48. data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
  49. data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
  50. data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
  51. data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
  52. data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
  53. data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
  54. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  55. data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
  56. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
  57. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
  58. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +296 -172
  59. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
  60. data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
  61. data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
  62. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
  63. data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
  64. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  65. data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
  66. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
  67. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
  68. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
  69. data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
  70. data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
  71. data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
  72. data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
  73. data/src/core/lib/channel/channel_args.c +28 -9
  74. data/src/core/lib/channel/channel_args.h +5 -1
  75. data/src/core/lib/channel/channel_stack.c +1 -1
  76. data/src/core/lib/channel/channel_stack.h +2 -2
  77. data/src/core/lib/channel/channel_stack_builder.c +13 -1
  78. data/src/core/lib/channel/channel_stack_builder.h +5 -1
  79. data/src/core/lib/channel/connected_channel.c +3 -1
  80. data/src/core/lib/channel/context.h +2 -2
  81. data/src/core/lib/compression/message_compress.c +2 -2
  82. data/src/core/lib/debug/trace.c +13 -6
  83. data/src/core/lib/debug/trace.h +27 -1
  84. data/src/core/lib/http/httpcli.c +1 -1
  85. data/src/core/lib/http/httpcli_security_connector.c +6 -10
  86. data/src/core/lib/http/parser.c +2 -2
  87. data/src/core/lib/http/parser.h +2 -1
  88. data/src/core/lib/iomgr/combiner.c +6 -6
  89. data/src/core/lib/iomgr/combiner.h +2 -1
  90. data/src/core/lib/iomgr/error.c +12 -5
  91. data/src/core/lib/iomgr/error.h +13 -13
  92. data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
  93. data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
  94. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
  95. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
  96. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
  97. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
  98. data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
  99. data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
  100. data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +24 -31
  101. data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
  102. data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
  103. data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
  104. data/src/core/lib/iomgr/ev_posix.c +22 -8
  105. data/src/core/lib/iomgr/ev_posix.h +4 -3
  106. data/src/core/lib/iomgr/exec_ctx.c +5 -0
  107. data/src/core/lib/iomgr/exec_ctx.h +2 -0
  108. data/src/core/lib/iomgr/iomgr.c +4 -0
  109. data/src/core/lib/iomgr/iomgr.h +3 -0
  110. data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
  111. data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
  112. data/src/core/lib/iomgr/lockfree_event.c +16 -0
  113. data/src/core/lib/iomgr/pollset.h +2 -5
  114. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  115. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  116. data/src/core/lib/iomgr/resource_quota.c +9 -8
  117. data/src/core/lib/iomgr/resource_quota.h +2 -1
  118. data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
  119. data/src/core/lib/iomgr/socket_mutator.h +2 -0
  120. data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
  121. data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
  122. data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
  123. data/src/core/lib/iomgr/tcp_posix.c +7 -7
  124. data/src/core/lib/iomgr/tcp_posix.h +2 -1
  125. data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
  126. data/src/core/lib/iomgr/tcp_uv.c +6 -6
  127. data/src/core/lib/iomgr/tcp_uv.h +2 -1
  128. data/src/core/lib/iomgr/tcp_windows.c +1 -1
  129. data/src/core/lib/iomgr/timer_generic.c +24 -25
  130. data/src/core/lib/iomgr/timer_manager.c +276 -0
  131. data/src/core/lib/iomgr/timer_manager.h +52 -0
  132. data/src/core/lib/iomgr/timer_uv.c +6 -0
  133. data/src/core/lib/iomgr/udp_server.c +42 -9
  134. data/src/core/lib/iomgr/udp_server.h +3 -1
  135. data/src/core/lib/security/credentials/credentials.c +0 -1
  136. data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
  137. data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
  138. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
  139. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
  140. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
  141. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
  142. data/src/core/lib/security/transport/client_auth_filter.c +9 -3
  143. data/src/core/lib/security/transport/secure_endpoint.c +7 -7
  144. data/src/core/lib/security/transport/secure_endpoint.h +1 -1
  145. data/src/core/lib/security/transport/security_connector.c +32 -51
  146. data/src/core/lib/security/transport/security_connector.h +10 -14
  147. data/src/core/lib/slice/b64.c +1 -1
  148. data/src/core/lib/slice/percent_encoding.c +3 -3
  149. data/src/core/lib/slice/slice.c +66 -33
  150. data/src/core/lib/slice/slice_buffer.c +25 -6
  151. data/src/core/lib/slice/slice_hash_table.c +33 -35
  152. data/src/core/lib/slice/slice_hash_table.h +7 -12
  153. data/src/core/lib/support/atomic.h +45 -0
  154. data/src/core/lib/support/atomic_with_atm.h +70 -0
  155. data/src/core/lib/support/atomic_with_std.h +48 -0
  156. data/src/core/lib/support/avl.c +14 -14
  157. data/src/core/lib/support/memory.h +74 -0
  158. data/src/core/lib/support/mpscq.c +12 -1
  159. data/src/core/lib/support/mpscq.h +4 -0
  160. data/src/core/lib/support/stack_lockfree.c +3 -36
  161. data/src/core/lib/support/time_posix.c +8 -0
  162. data/src/core/lib/support/tmpfile_posix.c +10 -10
  163. data/src/core/lib/surface/alarm.c +3 -1
  164. data/src/core/lib/surface/api_trace.c +2 -1
  165. data/src/core/lib/surface/api_trace.h +2 -2
  166. data/src/core/lib/surface/byte_buffer_reader.c +1 -1
  167. data/src/core/lib/surface/call.c +65 -22
  168. data/src/core/lib/surface/call.h +4 -2
  169. data/src/core/lib/surface/channel_init.c +2 -19
  170. data/src/core/lib/surface/channel_stack_type.c +18 -0
  171. data/src/core/lib/surface/channel_stack_type.h +2 -0
  172. data/src/core/lib/surface/completion_queue.c +249 -83
  173. data/src/core/lib/surface/completion_queue.h +18 -13
  174. data/src/core/lib/surface/completion_queue_factory.c +24 -9
  175. data/src/core/lib/surface/init.c +1 -52
  176. data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
  177. data/src/core/lib/surface/server.c +50 -27
  178. data/src/core/lib/surface/server.h +2 -1
  179. data/src/core/lib/surface/version.c +2 -2
  180. data/src/core/lib/transport/bdp_estimator.c +20 -9
  181. data/src/core/lib/transport/bdp_estimator.h +5 -1
  182. data/src/core/lib/transport/byte_stream.c +23 -9
  183. data/src/core/lib/transport/byte_stream.h +15 -6
  184. data/src/core/lib/transport/connectivity_state.c +6 -6
  185. data/src/core/lib/transport/connectivity_state.h +2 -1
  186. data/src/core/lib/transport/service_config.c +6 -13
  187. data/src/core/lib/transport/service_config.h +2 -2
  188. data/src/core/lib/transport/static_metadata.c +403 -389
  189. data/src/core/lib/transport/static_metadata.h +127 -114
  190. data/src/core/plugin_registry/grpc_plugin_registry.c +12 -0
  191. data/src/core/tsi/fake_transport_security.c +5 -4
  192. data/src/core/tsi/ssl_transport_security.c +71 -82
  193. data/src/core/tsi/ssl_transport_security.h +39 -61
  194. data/src/core/tsi/transport_security.c +83 -2
  195. data/src/core/tsi/transport_security.h +27 -2
  196. data/src/core/tsi/transport_security_adapter.c +236 -0
  197. data/src/core/tsi/transport_security_adapter.h +62 -0
  198. data/src/core/tsi/transport_security_interface.h +179 -66
  199. data/src/ruby/ext/grpc/extconf.rb +2 -1
  200. data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
  201. data/src/ruby/ext/grpc/rb_call.c +56 -48
  202. data/src/ruby/ext/grpc/rb_call.h +3 -4
  203. data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
  204. data/src/ruby/ext/grpc/rb_channel.c +45 -29
  205. data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
  206. data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
  207. data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
  208. data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
  209. data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
  210. data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
  211. data/src/ruby/ext/grpc/rb_grpc.c +11 -15
  212. data/src/ruby/ext/grpc/rb_grpc.h +2 -2
  213. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -6
  214. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +22 -10
  215. data/src/ruby/ext/grpc/rb_server.c +26 -28
  216. data/src/ruby/lib/grpc/version.rb +1 -1
  217. metadata +40 -18
  218. data/src/ruby/lib/grpc/grpc_c.bundle +0 -0
  219. data/src/ruby/lib/grpc/grpc_c.so +0 -0
@@ -93,55 +93,6 @@ GRPCAPI const char *grpc_version_string(void);
93
93
  /** Return a string specifying what the 'g' in gRPC stands for */
94
94
  GRPCAPI const char *grpc_g_stands_for(void);
95
95
 
96
- /** Specifies the type of APIs to use to pop events from the completion queue */
97
- typedef enum {
98
- /* Events are popped out by calling grpc_completion_queue_next() API ONLY */
99
- GRPC_CQ_NEXT = 1,
100
-
101
- /* Events are popped out by calling grpc_completion_queue_pluck() API ONLY */
102
- GRPC_CQ_PLUCK
103
- } grpc_cq_completion_type;
104
-
105
- /** Completion queues internally MAY maintain a set of file descriptors in a
106
- structure called 'pollset'. This enum specifies if a completion queue has an
107
- associated pollset and any restrictions on the type of file descriptors that
108
- can be present in the pollset.
109
-
110
- I/O progress can only be made when grpc_completion_queue_next() or
111
- grpc_completion_queue_pluck() are called on the completion queue (unless the
112
- grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important
113
- to actively call these APIs */
114
- typedef enum {
115
- /** The completion queue will have an associated pollset and there is no
116
- restriction on the type of file descriptors the pollset may contain */
117
- GRPC_CQ_DEFAULT_POLLING,
118
-
119
- /* Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will
120
- not contain any 'listening file descriptors' (i.e file descriptors used to
121
- listen to incoming channels) */
122
- GRPC_CQ_NON_LISTENING,
123
-
124
- /* The completion queue will not have an associated pollset. Note that
125
- grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still be
126
- called to pop events from the completion queue; it is not required to call
127
- them actively to make I/O progress */
128
- GRPC_CQ_NON_POLLING
129
- } grpc_cq_polling_type;
130
-
131
- #define GRPC_CQ_CURRENT_VERSION 1
132
- typedef struct grpc_completion_queue_attributes {
133
- /* The version number of this structure. More fields might be added to this
134
- structure in future. */
135
- int version; /* Set to GRPC_CQ_CURRENT_VERSION */
136
-
137
- grpc_cq_completion_type cq_completion_type;
138
-
139
- grpc_cq_polling_type cq_polling_type;
140
- } grpc_completion_queue_attributes;
141
-
142
- /** The completion queue factory structure is opaque to the callers of grpc */
143
- typedef struct grpc_completion_queue_factory grpc_completion_queue_factory;
144
-
145
96
  /** Returns the completion queue factory based on the attributes. MAY return a
146
97
  NULL if no factory can be found */
147
98
  GRPCAPI const grpc_completion_queue_factory *
@@ -159,7 +110,9 @@ GRPCAPI grpc_completion_queue *grpc_completion_queue_create_for_pluck(
159
110
  void *reserved);
160
111
 
161
112
  /** Create a completion queue */
162
- GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved);
113
+ GRPCAPI grpc_completion_queue *grpc_completion_queue_create(
114
+ const grpc_completion_queue_factory *factory,
115
+ const grpc_completion_queue_attributes *attributes, void *reserved);
163
116
 
164
117
  /** Blocks until an event is available, the completion queue is being shut down,
165
118
  or deadline is reached.
@@ -263,6 +216,10 @@ GRPCAPI grpc_call *grpc_channel_create_registered_call(
263
216
  grpc_completion_queue *completion_queue, void *registered_call_handle,
264
217
  gpr_timespec deadline, void *reserved);
265
218
 
219
+ /** Allocate memory in the grpc_call arena: this memory is automatically
220
+ discarded at call completion */
221
+ GRPCAPI void *grpc_call_arena_alloc(grpc_call *call, size_t size);
222
+
266
223
  /** Start a batch of operations defined in the array ops; when complete, post a
267
224
  completion of type 'tag' to the completion queue bound to the call.
268
225
  The order of ops specified in the batch has no significance.
@@ -294,12 +251,6 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call,
294
251
  functionality. Instead, use grpc_auth_context. */
295
252
  GRPCAPI char *grpc_call_get_peer(grpc_call *call);
296
253
 
297
- struct grpc_load_reporting_cost_context;
298
-
299
- /* Associate costs contained in \a cost_context to \a call. */
300
- GRPCAPI void grpc_call_set_load_reporting_cost_context(
301
- grpc_call *call, struct grpc_load_reporting_cost_context *context);
302
-
303
254
  struct census_context;
304
255
 
305
256
  /** Set census context for a call; Must be called before first call to
@@ -345,7 +296,7 @@ GRPCAPI void grpc_channel_destroy(grpc_channel *channel);
345
296
  /** Called by clients to cancel an RPC on the server.
346
297
  Can be called multiple times, from any thread.
347
298
  THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
348
- are thread-safe, and can be called at any point before grpc_call_destroy
299
+ are thread-safe, and can be called at any point before grpc_call_unref
349
300
  is called.*/
350
301
  GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved);
351
302
 
@@ -360,9 +311,13 @@ GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
360
311
  const char *description,
361
312
  void *reserved);
362
313
 
363
- /** Destroy a call.
364
- THREAD SAFETY: grpc_call_destroy is thread-compatible */
365
- GRPCAPI void grpc_call_destroy(grpc_call *call);
314
+ /** Ref a call.
315
+ THREAD SAFETY: grpc_call_unref is thread-compatible */
316
+ GRPCAPI void grpc_call_ref(grpc_call *call);
317
+
318
+ /** Unref a call.
319
+ THREAD SAFETY: grpc_call_unref is thread-compatible */
320
+ GRPCAPI void grpc_call_unref(grpc_call *call);
366
321
 
367
322
  /** Request notification of a new call.
368
323
  Once a call is received, a notification tagged with \a tag_new is added to
@@ -423,15 +378,6 @@ GRPCAPI void grpc_server_register_completion_queue(grpc_server *server,
423
378
  grpc_completion_queue *cq,
424
379
  void *reserved);
425
380
 
426
- /** Register a non-listening completion queue with the server. This API is
427
- similar to grpc_server_register_completion_queue except that the server will
428
- not use this completion_queue to listen to any incoming channels.
429
-
430
- Registering a non-listening completion queue will have negative performance
431
- impact and hence this API is not recommended for production use cases. */
432
- GRPCAPI void grpc_server_register_non_listening_completion_queue(
433
- grpc_server *server, grpc_completion_queue *q, void *reserved);
434
-
435
381
  /** Add a HTTP2 over plaintext over tcp listener.
436
382
  Returns bound port number on success, 0 on failure.
437
383
  REQUIRES: server not started */
@@ -158,7 +158,7 @@ typedef struct {
158
158
  } grpc_ssl_pem_key_cert_pair;
159
159
 
160
160
  /* Creates an SSL credentials object.
161
- - pem_roots_cert is the NULL-terminated string containing the PEM encoding
161
+ - pem_root_certs is the NULL-terminated string containing the PEM encoding
162
162
  of the server root certificates. If this parameter is NULL, the
163
163
  implementation will first try to dereference the file pointed by the
164
164
  GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails,
@@ -34,8 +34,7 @@
34
34
  #ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
35
35
  #define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
36
36
 
37
- #include <stdbool.h>
38
- #include <stdint.h>
37
+ #include <grpc/impl/codegen/port_platform.h>
39
38
 
40
39
  #ifdef __cplusplus
41
40
  extern "C" {
@@ -101,7 +100,7 @@ typedef struct grpc_compression_options {
101
100
  * precedence over \a default_algorithm.
102
101
  * TODO(dgq): currently only available for server channels. */
103
102
  struct {
104
- bool is_set;
103
+ int is_set;
105
104
  grpc_compression_level level;
106
105
  } default_level;
107
106
 
@@ -109,7 +108,7 @@ typedef struct grpc_compression_options {
109
108
  * call specific settings. This option corresponds to the channel argument key
110
109
  * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
111
110
  struct {
112
- bool is_set;
111
+ int is_set;
113
112
  grpc_compression_algorithm algorithm;
114
113
  } default_algorithm;
115
114
 
@@ -37,7 +37,6 @@
37
37
  #include <grpc/impl/codegen/port_platform.h>
38
38
 
39
39
  #include <stddef.h>
40
- #include <stdint.h>
41
40
 
42
41
  #ifdef __cplusplus
43
42
  extern "C" {
@@ -34,6 +34,8 @@
34
34
  #ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H
35
35
  #define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
36
36
 
37
+ #include <grpc/impl/codegen/port_platform.h>
38
+
37
39
  #include <grpc/impl/codegen/compression_types.h>
38
40
  #include <grpc/impl/codegen/exec_ctx_fwd.h>
39
41
  #include <grpc/impl/codegen/gpr_types.h>
@@ -41,7 +43,6 @@
41
43
  #include <grpc/impl/codegen/status.h>
42
44
 
43
45
  #include <stddef.h>
44
- #include <stdint.h>
45
46
 
46
47
  #ifdef __cplusplus
47
48
  extern "C" {
@@ -175,6 +176,12 @@ typedef struct {
175
176
  /** Grace period after the chennel reaches its max age. Int valued,
176
177
  milliseconds. INT_MAX means unlimited. */
177
178
  #define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms"
179
+ /** Enable/disable support for per-message compression. Defaults to 1, unless
180
+ GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
181
+ #define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression"
182
+ /** Enable/disable support for deadline checking. Defaults to 1, unless
183
+ GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0 */
184
+ #define GRPC_ARG_ENABLE_DEADLINE_CHECKS "grpc.enable_deadline_checking"
178
185
  /** Initial sequence number for http2 transports. Int valued. */
179
186
  #define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \
180
187
  "grpc.http2.initial_sequence_number"
@@ -199,6 +206,8 @@ typedef struct {
199
206
  /** Minimum time (in milliseconds) between successive ping frames being sent */
200
207
  #define GRPC_ARG_HTTP2_MIN_TIME_BETWEEN_PINGS_MS \
201
208
  "grpc.http2.min_time_between_pings_ms"
209
+ /* Channel arg to override the http2 :scheme header */
210
+ #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
202
211
  /** How many pings can we send before needing to send a data frame or header
203
212
  frame?
204
213
  (0 indicates that an infinite number of pings can be sent without sending
@@ -240,6 +249,8 @@ typedef struct {
240
249
  /** Secondary user agent: goes at the end of the user-agent metadata
241
250
  sent on each request. A string. */
242
251
  #define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
252
+ /** The minimum time between subsequent connection attempts, in ms */
253
+ #define GRPC_ARG_MIN_RECONNECT_BACKOFF_MS "grpc.min_reconnect_backoff_ms"
243
254
  /** The maximum time between subsequent connection attempts, in ms */
244
255
  #define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
245
256
  /** The time between the first and second connection attempts, in ms */
@@ -282,6 +293,9 @@ each time recvmsg (or equivalent) is called */
282
293
  "grpc.experimental.tcp_min_read_chunk_size"
283
294
  #define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \
284
295
  "grpc.experimental.tcp_max_read_chunk_size"
296
+ /* Timeout in milliseconds to use for calls to the grpclb load balancer.
297
+ If 0 or unset, the balancer calls will have no deadline. */
298
+ #define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_timeout_ms"
285
299
  /** \} */
286
300
 
287
301
  /** Result of a grpc call. If the caller satisfies the prerequisites of a
@@ -393,8 +407,11 @@ typedef enum grpc_completion_type {
393
407
  typedef struct grpc_event {
394
408
  /** The type of the completion. */
395
409
  grpc_completion_type type;
396
- /** non-zero if the operation was successful, 0 upon failure.
397
- Only GRPC_OP_COMPLETE can succeed or fail. */
410
+ /** If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates
411
+ whether the operation was successful or not; 0 in case of failure and
412
+ non-zero in case of success.
413
+ If grpc_completion_type is GRPC_QUEUE_SHUTDOWN or GRPC_QUEUE_TIMEOUT, this
414
+ field is guaranteed to be 0 */
398
415
  int success;
399
416
  /** The tag passed to grpc_call_start_batch etc to start this operation.
400
417
  Only GRPC_OP_COMPLETE has a tag. */
@@ -543,6 +560,55 @@ typedef struct {
543
560
 
544
561
  typedef struct grpc_resource_quota grpc_resource_quota;
545
562
 
563
+ /** Completion queues internally MAY maintain a set of file descriptors in a
564
+ structure called 'pollset'. This enum specifies if a completion queue has an
565
+ associated pollset and any restrictions on the type of file descriptors that
566
+ can be present in the pollset.
567
+
568
+ I/O progress can only be made when grpc_completion_queue_next() or
569
+ grpc_completion_queue_pluck() are called on the completion queue (unless the
570
+ grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important
571
+ to actively call these APIs */
572
+ typedef enum {
573
+ /** The completion queue will have an associated pollset and there is no
574
+ restriction on the type of file descriptors the pollset may contain */
575
+ GRPC_CQ_DEFAULT_POLLING,
576
+
577
+ /** Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will
578
+ not contain any 'listening file descriptors' (i.e file descriptors used to
579
+ listen to incoming channels) */
580
+ GRPC_CQ_NON_LISTENING,
581
+
582
+ /** The completion queue will not have an associated pollset. Note that
583
+ grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still
584
+ be called to pop events from the completion queue; it is not required to
585
+ call them actively to make I/O progress */
586
+ GRPC_CQ_NON_POLLING
587
+ } grpc_cq_polling_type;
588
+
589
+ /** Specifies the type of APIs to use to pop events from the completion queue */
590
+ typedef enum {
591
+ /** Events are popped out by calling grpc_completion_queue_next() API ONLY */
592
+ GRPC_CQ_NEXT = 1,
593
+
594
+ /** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/
595
+ GRPC_CQ_PLUCK
596
+ } grpc_cq_completion_type;
597
+
598
+ #define GRPC_CQ_CURRENT_VERSION 1
599
+ typedef struct grpc_completion_queue_attributes {
600
+ /* The version number of this structure. More fields might be added to this
601
+ structure in future. */
602
+ int version; /* Set to GRPC_CQ_CURRENT_VERSION */
603
+
604
+ grpc_cq_completion_type cq_completion_type;
605
+
606
+ grpc_cq_polling_type cq_polling_type;
607
+ } grpc_completion_queue_attributes;
608
+
609
+ /** The completion queue factory structure is opaque to the callers of grpc */
610
+ typedef struct grpc_completion_queue_factory grpc_completion_queue_factory;
611
+
546
612
  #ifdef __cplusplus
547
613
  }
548
614
  #endif
@@ -290,6 +290,12 @@
290
290
  #endif
291
291
  #endif /* GPR_NO_AUTODETECT_PLATFORM */
292
292
 
293
+ #if defined(__has_include)
294
+ #if __has_include(<atomic>)
295
+ #define GRPC_HAS_CXX11_ATOMIC
296
+ #endif /* __has_include(<atomic>) */
297
+ #endif /* defined(__has_include) */
298
+
293
299
  #ifndef GPR_PLATFORM_STRING
294
300
  #warning "GPR_PLATFORM_STRING not auto-detected"
295
301
  #define GPR_PLATFORM_STRING "unknown"
@@ -34,8 +34,9 @@
34
34
  #ifndef GRPC_IMPL_CODEGEN_SLICE_H
35
35
  #define GRPC_IMPL_CODEGEN_SLICE_H
36
36
 
37
+ #include <grpc/impl/codegen/port_platform.h>
38
+
37
39
  #include <stddef.h>
38
- #include <stdint.h>
39
40
 
40
41
  #include <grpc/impl/codegen/exec_ctx_fwd.h>
41
42
  #include <grpc/impl/codegen/gpr_slice.h>
@@ -35,7 +35,6 @@
35
35
  #define GRPC_LOAD_REPORTING_H
36
36
 
37
37
  #include <grpc/impl/codegen/port_platform.h>
38
- #include <grpc/slice.h>
39
38
 
40
39
  #ifdef __cplusplus
41
40
  extern "C" {
@@ -50,11 +49,12 @@ extern "C" {
50
49
  * gRPC LB system. */
51
50
  #define GRPC_LB_TOKEN_MD_KEY "lb-token"
52
51
 
53
- /** A sequence of values for load reporting purposes */
54
- typedef struct grpc_load_reporting_cost_context {
55
- grpc_slice *values;
56
- size_t values_count;
57
- } grpc_load_reporting_cost_context;
52
+ /** Metadata key for gRPC LB cost reporting.
53
+ *
54
+ * The value corresponding to this key is an opaque binary blob reported by the
55
+ * backend as part of its trailing metadata containing cost information for the
56
+ * call. */
57
+ #define GRPC_LB_COST_MD_KEY "lb-cost-bin"
58
58
 
59
59
  #ifdef __cplusplus
60
60
  }
@@ -53,6 +53,9 @@ GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
53
53
  where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
54
54
  GPRAPI void grpc_slice_unref(grpc_slice s);
55
55
 
56
+ /* Copy slice - create a new slice that contains the same data as s */
57
+ GPRAPI grpc_slice grpc_slice_copy(grpc_slice s);
58
+
56
59
  /* Create a slice pointing at some data. Calls malloc to allocate a refcount
57
60
  for the object, and arranges that destroy will be called with the pointer
58
61
  passed in at destruction. */
@@ -75,6 +78,13 @@ GPRAPI grpc_slice grpc_slice_new_with_len(void *p, size_t len,
75
78
  call.
76
79
  Aborts if malloc() fails. */
77
80
  GPRAPI grpc_slice grpc_slice_malloc(size_t length);
81
+ GPRAPI grpc_slice grpc_slice_malloc_large(size_t length);
82
+
83
+ #define GRPC_SLICE_MALLOC(len) \
84
+ ((len) <= GRPC_SLICE_INLINED_SIZE \
85
+ ? (grpc_slice){.refcount = NULL, \
86
+ .data.inlined = {.length = (uint8_t)(len)}} \
87
+ : grpc_slice_malloc_large((len)))
78
88
 
79
89
  /* Intern a slice:
80
90
 
@@ -102,9 +112,9 @@ GPRAPI grpc_slice grpc_slice_from_static_string(const char *source);
102
112
  /* Create a slice pointing to constant memory */
103
113
  GPRAPI grpc_slice grpc_slice_from_static_buffer(const void *source, size_t len);
104
114
 
105
- /* Return a result slice derived from s, which shares a ref count with s, where
106
- result.data==s.data+begin, and result.length==end-begin.
107
- The ref count of s is increased by one.
115
+ /* Return a result slice derived from s, which shares a ref count with \a s,
116
+ where result.data==s.data+begin, and result.length==end-begin. The ref count
117
+ of \a s is increased by one. Do not assign result back to \a s.
108
118
  Requires s initialized, begin <= end, begin <= s.length, and
109
119
  end <= source->length. */
110
120
  GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
@@ -117,6 +127,18 @@ GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end);
117
127
  Requires s intialized, split <= s.length */
118
128
  GPRAPI grpc_slice grpc_slice_split_tail(grpc_slice *s, size_t split);
119
129
 
130
+ typedef enum {
131
+ GRPC_SLICE_REF_TAIL = 1,
132
+ GRPC_SLICE_REF_HEAD = 2,
133
+ GRPC_SLICE_REF_BOTH = 1 + 2
134
+ } grpc_slice_ref_whom;
135
+
136
+ /* The same as grpc_slice_split_tail, but with an option to skip altering
137
+ * refcounts (grpc_slice_split_tail_maybe_ref(..., true) is equivalent to
138
+ * grpc_slice_split_tail(...)) */
139
+ GPRAPI grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice *s, size_t split,
140
+ grpc_slice_ref_whom ref_whom);
141
+
120
142
  /* Splits s into two: modifies s to be s[split:s.length], and returns a new
121
143
  slice, sharing a refcount with s, that contains s[0:split].
122
144
  Requires s intialized, split <= s.length */
@@ -77,6 +77,10 @@ GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *src, size_t n,
77
77
  /* move the first n bytes of src into dst */
78
78
  GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
79
79
  grpc_slice_buffer *dst);
80
+ /* move the first n bytes of src into dst without adding references */
81
+ GPRAPI void grpc_slice_buffer_move_first_no_ref(grpc_slice_buffer *src,
82
+ size_t n,
83
+ grpc_slice_buffer *dst);
80
84
  /* move the first n bytes of src into dst (copying them) */
81
85
  GPRAPI void grpc_slice_buffer_move_first_into_buffer(grpc_exec_ctx *exec_ctx,
82
86
  grpc_slice_buffer *src,
@@ -200,7 +200,7 @@ static bool tag_set_add_tag(struct tag_set *tags, const census_tag *tag,
200
200
  // allocate new memory if needed
201
201
  tags->kvm_size += 2 * CENSUS_MAX_TAG_KV_LEN + TAG_HEADER_SIZE;
202
202
  char *new_kvm = gpr_malloc(tags->kvm_size);
203
- memcpy(new_kvm, tags->kvm, tags->kvm_used);
203
+ if (tags->kvm_used > 0) memcpy(new_kvm, tags->kvm, tags->kvm_used);
204
204
  gpr_free(tags->kvm);
205
205
  tags->kvm = new_kvm;
206
206
  }
@@ -223,7 +223,9 @@ size_t allocate_resource(void) {
223
223
  if (n_resources == n_defined_resources) {
224
224
  size_t new_n_resources = n_resources ? n_resources * 2 : 2;
225
225
  resource **new_resources = gpr_malloc(new_n_resources * sizeof(resource *));
226
- memcpy(new_resources, resources, n_resources * sizeof(resource *));
226
+ if (n_resources != 0) {
227
+ memcpy(new_resources, resources, n_resources * sizeof(resource *));
228
+ }
227
229
  memset(new_resources + n_resources, 0,
228
230
  (new_n_resources - n_resources) * sizeof(resource *));
229
231
  gpr_free(resources);
@@ -132,7 +132,7 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
132
132
  gpr_mu_lock(&w->mu);
133
133
 
134
134
  if (due_to_completion) {
135
- if (grpc_trace_operation_failures) {
135
+ if (GRPC_TRACER_ON(grpc_trace_operation_failures)) {
136
136
  GRPC_LOG_IF_ERROR("watch_completion_error", GRPC_ERROR_REF(error));
137
137
  }
138
138
  GRPC_ERROR_UNREF(error);