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
@@ -0,0 +1,133 @@
1
+ /*
2
+ *
3
+ * Copyright 2017, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h"
35
+
36
+ #include <grpc/support/alloc.h>
37
+ #include <grpc/support/atm.h>
38
+ #include <grpc/support/sync.h>
39
+ #include <grpc/support/useful.h>
40
+
41
+ #include "src/core/lib/channel/channel_args.h"
42
+
43
+ #define GRPC_ARG_GRPCLB_CLIENT_STATS "grpc.grpclb_client_stats"
44
+
45
+ struct grpc_grpclb_client_stats {
46
+ gpr_refcount refs;
47
+ gpr_atm num_calls_started;
48
+ gpr_atm num_calls_finished;
49
+ gpr_atm num_calls_finished_with_drop_for_rate_limiting;
50
+ gpr_atm num_calls_finished_with_drop_for_load_balancing;
51
+ gpr_atm num_calls_finished_with_client_failed_to_send;
52
+ gpr_atm num_calls_finished_known_received;
53
+ };
54
+
55
+ grpc_grpclb_client_stats* grpc_grpclb_client_stats_create() {
56
+ grpc_grpclb_client_stats* client_stats = gpr_zalloc(sizeof(*client_stats));
57
+ gpr_ref_init(&client_stats->refs, 1);
58
+ return client_stats;
59
+ }
60
+
61
+ grpc_grpclb_client_stats* grpc_grpclb_client_stats_ref(
62
+ grpc_grpclb_client_stats* client_stats) {
63
+ gpr_ref(&client_stats->refs);
64
+ return client_stats;
65
+ }
66
+
67
+ void grpc_grpclb_client_stats_unref(grpc_grpclb_client_stats* client_stats) {
68
+ if (gpr_unref(&client_stats->refs)) {
69
+ gpr_free(client_stats);
70
+ }
71
+ }
72
+
73
+ void grpc_grpclb_client_stats_add_call_started(
74
+ grpc_grpclb_client_stats* client_stats) {
75
+ gpr_atm_full_fetch_add(&client_stats->num_calls_started, (gpr_atm)1);
76
+ }
77
+
78
+ void grpc_grpclb_client_stats_add_call_finished(
79
+ bool finished_with_drop_for_rate_limiting,
80
+ bool finished_with_drop_for_load_balancing,
81
+ bool finished_with_client_failed_to_send, bool finished_known_received,
82
+ grpc_grpclb_client_stats* client_stats) {
83
+ gpr_atm_full_fetch_add(&client_stats->num_calls_finished, (gpr_atm)1);
84
+ if (finished_with_drop_for_rate_limiting) {
85
+ gpr_atm_full_fetch_add(
86
+ &client_stats->num_calls_finished_with_drop_for_rate_limiting,
87
+ (gpr_atm)1);
88
+ }
89
+ if (finished_with_drop_for_load_balancing) {
90
+ gpr_atm_full_fetch_add(
91
+ &client_stats->num_calls_finished_with_drop_for_load_balancing,
92
+ (gpr_atm)1);
93
+ }
94
+ if (finished_with_client_failed_to_send) {
95
+ gpr_atm_full_fetch_add(
96
+ &client_stats->num_calls_finished_with_client_failed_to_send,
97
+ (gpr_atm)1);
98
+ }
99
+ if (finished_known_received) {
100
+ gpr_atm_full_fetch_add(&client_stats->num_calls_finished_known_received,
101
+ (gpr_atm)1);
102
+ }
103
+ }
104
+
105
+ static void atomic_get_and_reset_counter(int64_t* value, gpr_atm* counter) {
106
+ *value = (int64_t)gpr_atm_acq_load(counter);
107
+ gpr_atm_full_fetch_add(counter, (gpr_atm)(-*value));
108
+ }
109
+
110
+ void grpc_grpclb_client_stats_get(
111
+ grpc_grpclb_client_stats* client_stats, int64_t* num_calls_started,
112
+ int64_t* num_calls_finished,
113
+ int64_t* num_calls_finished_with_drop_for_rate_limiting,
114
+ int64_t* num_calls_finished_with_drop_for_load_balancing,
115
+ int64_t* num_calls_finished_with_client_failed_to_send,
116
+ int64_t* num_calls_finished_known_received) {
117
+ atomic_get_and_reset_counter(num_calls_started,
118
+ &client_stats->num_calls_started);
119
+ atomic_get_and_reset_counter(num_calls_finished,
120
+ &client_stats->num_calls_finished);
121
+ atomic_get_and_reset_counter(
122
+ num_calls_finished_with_drop_for_rate_limiting,
123
+ &client_stats->num_calls_finished_with_drop_for_rate_limiting);
124
+ atomic_get_and_reset_counter(
125
+ num_calls_finished_with_drop_for_load_balancing,
126
+ &client_stats->num_calls_finished_with_drop_for_load_balancing);
127
+ atomic_get_and_reset_counter(
128
+ num_calls_finished_with_client_failed_to_send,
129
+ &client_stats->num_calls_finished_with_client_failed_to_send);
130
+ atomic_get_and_reset_counter(
131
+ num_calls_finished_known_received,
132
+ &client_stats->num_calls_finished_known_received);
133
+ }
@@ -0,0 +1,65 @@
1
+ /*
2
+ *
3
+ * Copyright 2017, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H
35
+ #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H
36
+
37
+ #include <stdbool.h>
38
+
39
+ #include <grpc/impl/codegen/grpc_types.h>
40
+
41
+ typedef struct grpc_grpclb_client_stats grpc_grpclb_client_stats;
42
+
43
+ grpc_grpclb_client_stats* grpc_grpclb_client_stats_create();
44
+ grpc_grpclb_client_stats* grpc_grpclb_client_stats_ref(
45
+ grpc_grpclb_client_stats* client_stats);
46
+ void grpc_grpclb_client_stats_unref(grpc_grpclb_client_stats* client_stats);
47
+
48
+ void grpc_grpclb_client_stats_add_call_started(
49
+ grpc_grpclb_client_stats* client_stats);
50
+ void grpc_grpclb_client_stats_add_call_finished(
51
+ bool finished_with_drop_for_rate_limiting,
52
+ bool finished_with_drop_for_load_balancing,
53
+ bool finished_with_client_failed_to_send, bool finished_known_received,
54
+ grpc_grpclb_client_stats* client_stats);
55
+
56
+ void grpc_grpclb_client_stats_get(
57
+ grpc_grpclb_client_stats* client_stats, int64_t* num_calls_started,
58
+ int64_t* num_calls_finished,
59
+ int64_t* num_calls_finished_with_drop_for_rate_limiting,
60
+ int64_t* num_calls_finished_with_drop_for_load_balancing,
61
+ int64_t* num_calls_finished_with_client_failed_to_send,
62
+ int64_t* num_calls_finished_known_received);
63
+
64
+ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H \
65
+ */
@@ -80,15 +80,45 @@ static bool decode_serverlist(pb_istream_t *stream, const pb_field_t *field,
80
80
 
81
81
  grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name) {
82
82
  grpc_grpclb_request *req = gpr_malloc(sizeof(grpc_grpclb_request));
83
-
84
- req->has_client_stats = 0; /* TODO(dgq): add support for stats once defined */
85
- req->has_initial_request = 1;
86
- req->initial_request.has_name = 1;
83
+ req->has_client_stats = false;
84
+ req->has_initial_request = true;
85
+ req->initial_request.has_name = true;
87
86
  strncpy(req->initial_request.name, lb_service_name,
88
87
  GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH);
89
88
  return req;
90
89
  }
91
90
 
91
+ static void populate_timestamp(gpr_timespec timestamp,
92
+ struct _grpc_lb_v1_Timestamp *timestamp_pb) {
93
+ timestamp_pb->has_seconds = true;
94
+ timestamp_pb->seconds = timestamp.tv_sec;
95
+ timestamp_pb->has_nanos = true;
96
+ timestamp_pb->nanos = timestamp.tv_nsec;
97
+ }
98
+
99
+ grpc_grpclb_request *grpc_grpclb_load_report_request_create(
100
+ grpc_grpclb_client_stats *client_stats) {
101
+ grpc_grpclb_request *req = gpr_zalloc(sizeof(grpc_grpclb_request));
102
+ req->has_client_stats = true;
103
+ req->client_stats.has_timestamp = true;
104
+ populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp);
105
+ req->client_stats.has_num_calls_started = true;
106
+ req->client_stats.has_num_calls_finished = true;
107
+ req->client_stats.has_num_calls_finished_with_drop_for_rate_limiting = true;
108
+ req->client_stats.has_num_calls_finished_with_drop_for_load_balancing = true;
109
+ req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
110
+ req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
111
+ req->client_stats.has_num_calls_finished_known_received = true;
112
+ grpc_grpclb_client_stats_get(
113
+ client_stats, &req->client_stats.num_calls_started,
114
+ &req->client_stats.num_calls_finished,
115
+ &req->client_stats.num_calls_finished_with_drop_for_rate_limiting,
116
+ &req->client_stats.num_calls_finished_with_drop_for_load_balancing,
117
+ &req->client_stats.num_calls_finished_with_client_failed_to_send,
118
+ &req->client_stats.num_calls_finished_known_received);
119
+ return req;
120
+ }
121
+
92
122
  grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request) {
93
123
  size_t encoded_length;
94
124
  pb_ostream_t sizestream;
@@ -98,7 +128,7 @@ grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request) {
98
128
  pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request);
99
129
  encoded_length = sizestream.bytes_written;
100
130
 
101
- slice = grpc_slice_malloc(encoded_length);
131
+ slice = GRPC_SLICE_MALLOC(encoded_length);
102
132
  outputstream =
103
133
  pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length);
104
134
  GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields,
@@ -122,6 +152,9 @@ grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
122
152
  gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
123
153
  return NULL;
124
154
  }
155
+
156
+ if (!res.has_initial_response) return NULL;
157
+
125
158
  grpc_grpclb_initial_response *initial_res =
126
159
  gpr_malloc(sizeof(grpc_grpclb_initial_response));
127
160
  memcpy(initial_res, &res.initial_response,
@@ -243,6 +276,15 @@ int grpc_grpclb_duration_compare(const grpc_grpclb_duration *lhs,
243
276
  return 0;
244
277
  }
245
278
 
279
+ gpr_timespec grpc_grpclb_duration_to_timespec(
280
+ grpc_grpclb_duration *duration_pb) {
281
+ gpr_timespec duration;
282
+ duration.tv_sec = duration_pb->has_seconds ? duration_pb->seconds : 0;
283
+ duration.tv_nsec = duration_pb->has_nanos ? duration_pb->nanos : 0;
284
+ duration.clock_type = GPR_TIMESPAN;
285
+ return duration;
286
+ }
287
+
246
288
  void grpc_grpclb_initial_response_destroy(
247
289
  grpc_grpclb_initial_response *response) {
248
290
  gpr_free(response);
@@ -36,6 +36,7 @@
36
36
 
37
37
  #include <grpc/slice_buffer.h>
38
38
 
39
+ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h"
39
40
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
40
41
  #include "src/core/ext/filters/client_channel/lb_policy_factory.h"
41
42
 
@@ -58,6 +59,8 @@ typedef struct grpc_grpclb_serverlist {
58
59
 
59
60
  /** Create a request for a gRPC LB service under \a lb_service_name */
60
61
  grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name);
62
+ grpc_grpclb_request *grpc_grpclb_load_report_request_create(
63
+ grpc_grpclb_client_stats *client_stats);
61
64
 
62
65
  /** Protocol Buffers v3-encode \a request */
63
66
  grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request);
@@ -93,6 +96,9 @@ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist);
93
96
  int grpc_grpclb_duration_compare(const grpc_grpclb_duration *lhs,
94
97
  const grpc_grpclb_duration *rhs);
95
98
 
99
+ gpr_timespec grpc_grpclb_duration_to_timespec(
100
+ grpc_grpclb_duration *duration_pb);
101
+
96
102
  /** Destroy \a initial_response */
97
103
  void grpc_grpclb_initial_response_destroy(
98
104
  grpc_grpclb_initial_response *response);
@@ -16,6 +16,12 @@ const pb_field_t grpc_lb_v1_Duration_fields[3] = {
16
16
  PB_LAST_FIELD
17
17
  };
18
18
 
19
+ const pb_field_t grpc_lb_v1_Timestamp_fields[3] = {
20
+ PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Timestamp, seconds, seconds, 0),
21
+ PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Timestamp, nanos, seconds, 0),
22
+ PB_LAST_FIELD
23
+ };
24
+
19
25
  const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = {
20
26
  PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields),
21
27
  PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields),
@@ -27,10 +33,14 @@ const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2] = {
27
33
  PB_LAST_FIELD
28
34
  };
29
35
 
30
- const pb_field_t grpc_lb_v1_ClientStats_fields[4] = {
31
- PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, total_requests, total_requests, 0),
32
- PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, client_rpc_errors, total_requests, 0),
33
- PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, dropped_requests, client_rpc_errors, 0),
36
+ const pb_field_t grpc_lb_v1_ClientStats_fields[8] = {
37
+ PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &grpc_lb_v1_Timestamp_fields),
38
+ PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0),
39
+ PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0),
40
+ PB_FIELD( 4, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_drop_for_rate_limiting, num_calls_finished, 0),
41
+ PB_FIELD( 5, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_drop_for_load_balancing, num_calls_finished_with_drop_for_rate_limiting, 0),
42
+ PB_FIELD( 6, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished_with_drop_for_load_balancing, 0),
43
+ PB_FIELD( 7, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_known_received, num_calls_finished_with_client_failed_to_send, 0),
34
44
  PB_LAST_FIELD
35
45
  };
36
46
 
@@ -52,11 +62,12 @@ const pb_field_t grpc_lb_v1_ServerList_fields[3] = {
52
62
  PB_LAST_FIELD
53
63
  };
54
64
 
55
- const pb_field_t grpc_lb_v1_Server_fields[5] = {
65
+ const pb_field_t grpc_lb_v1_Server_fields[6] = {
56
66
  PB_FIELD( 1, BYTES , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Server, ip_address, ip_address, 0),
57
67
  PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, port, ip_address, 0),
58
68
  PB_FIELD( 3, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, load_balance_token, port, 0),
59
- PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_request, load_balance_token, 0),
69
+ PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_for_rate_limiting, load_balance_token, 0),
70
+ PB_FIELD( 5, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_for_load_balancing, drop_for_rate_limiting, 0),
60
71
  PB_LAST_FIELD
61
72
  };
62
73
 
@@ -70,7 +81,7 @@ const pb_field_t grpc_lb_v1_Server_fields[5] = {
70
81
  * numbers or field sizes that are larger than what can fit in 8 or 16 bit
71
82
  * field descriptors.
72
83
  */
73
- PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
84
+ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_Timestamp_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
74
85
  #endif
75
86
 
76
87
  #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
@@ -81,7 +92,7 @@ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request)
81
92
  * numbers or field sizes that are larger than what can fit in the default
82
93
  * 8 bit descriptors.
83
94
  */
84
- PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
95
+ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_Timestamp_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
85
96
  #endif
86
97
 
87
98
 
@@ -14,16 +14,6 @@ extern "C" {
14
14
  #endif
15
15
 
16
16
  /* Struct definitions */
17
- typedef struct _grpc_lb_v1_ClientStats {
18
- bool has_total_requests;
19
- int64_t total_requests;
20
- bool has_client_rpc_errors;
21
- int64_t client_rpc_errors;
22
- bool has_dropped_requests;
23
- int64_t dropped_requests;
24
- /* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
25
- } grpc_lb_v1_ClientStats;
26
-
27
17
  typedef struct _grpc_lb_v1_Duration {
28
18
  bool has_seconds;
29
19
  int64_t seconds;
@@ -46,11 +36,39 @@ typedef struct _grpc_lb_v1_Server {
46
36
  int32_t port;
47
37
  bool has_load_balance_token;
48
38
  char load_balance_token[50];
49
- bool has_drop_request;
50
- bool drop_request;
39
+ bool has_drop_for_rate_limiting;
40
+ bool drop_for_rate_limiting;
41
+ bool has_drop_for_load_balancing;
42
+ bool drop_for_load_balancing;
51
43
  /* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */
52
44
  } grpc_lb_v1_Server;
53
45
 
46
+ typedef struct _grpc_lb_v1_Timestamp {
47
+ bool has_seconds;
48
+ int64_t seconds;
49
+ bool has_nanos;
50
+ int32_t nanos;
51
+ /* @@protoc_insertion_point(struct:grpc_lb_v1_Timestamp) */
52
+ } grpc_lb_v1_Timestamp;
53
+
54
+ typedef struct _grpc_lb_v1_ClientStats {
55
+ bool has_timestamp;
56
+ grpc_lb_v1_Timestamp timestamp;
57
+ bool has_num_calls_started;
58
+ int64_t num_calls_started;
59
+ bool has_num_calls_finished;
60
+ int64_t num_calls_finished;
61
+ bool has_num_calls_finished_with_drop_for_rate_limiting;
62
+ int64_t num_calls_finished_with_drop_for_rate_limiting;
63
+ bool has_num_calls_finished_with_drop_for_load_balancing;
64
+ int64_t num_calls_finished_with_drop_for_load_balancing;
65
+ bool has_num_calls_finished_with_client_failed_to_send;
66
+ int64_t num_calls_finished_with_client_failed_to_send;
67
+ bool has_num_calls_finished_known_received;
68
+ int64_t num_calls_finished_known_received;
69
+ /* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
70
+ } grpc_lb_v1_ClientStats;
71
+
54
72
  typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
55
73
  bool has_load_balancer_delegate;
56
74
  char load_balancer_delegate[64];
@@ -59,6 +77,13 @@ typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
59
77
  /* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */
60
78
  } grpc_lb_v1_InitialLoadBalanceResponse;
61
79
 
80
+ typedef struct _grpc_lb_v1_ServerList {
81
+ pb_callback_t servers;
82
+ bool has_expiration_interval;
83
+ grpc_lb_v1_Duration expiration_interval;
84
+ /* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */
85
+ } grpc_lb_v1_ServerList;
86
+
62
87
  typedef struct _grpc_lb_v1_LoadBalanceRequest {
63
88
  bool has_initial_request;
64
89
  grpc_lb_v1_InitialLoadBalanceRequest initial_request;
@@ -67,13 +92,6 @@ typedef struct _grpc_lb_v1_LoadBalanceRequest {
67
92
  /* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceRequest) */
68
93
  } grpc_lb_v1_LoadBalanceRequest;
69
94
 
70
- typedef struct _grpc_lb_v1_ServerList {
71
- pb_callback_t servers;
72
- bool has_expiration_interval;
73
- grpc_lb_v1_Duration expiration_interval;
74
- /* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */
75
- } grpc_lb_v1_ServerList;
76
-
77
95
  typedef struct _grpc_lb_v1_LoadBalanceResponse {
78
96
  bool has_initial_response;
79
97
  grpc_lb_v1_InitialLoadBalanceResponse initial_response;
@@ -86,61 +104,72 @@ typedef struct _grpc_lb_v1_LoadBalanceResponse {
86
104
 
87
105
  /* Initializer values for message structs */
88
106
  #define grpc_lb_v1_Duration_init_default {false, 0, false, 0}
107
+ #define grpc_lb_v1_Timestamp_init_default {false, 0, false, 0}
89
108
  #define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default}
90
109
  #define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""}
91
- #define grpc_lb_v1_ClientStats_init_default {false, 0, false, 0, false, 0}
110
+ #define grpc_lb_v1_ClientStats_init_default {false, grpc_lb_v1_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
92
111
  #define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default}
93
112
  #define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, grpc_lb_v1_Duration_init_default}
94
113
  #define grpc_lb_v1_ServerList_init_default {{{NULL}, NULL}, false, grpc_lb_v1_Duration_init_default}
95
- #define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0}
114
+ #define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0, false, 0}
96
115
  #define grpc_lb_v1_Duration_init_zero {false, 0, false, 0}
116
+ #define grpc_lb_v1_Timestamp_init_zero {false, 0, false, 0}
97
117
  #define grpc_lb_v1_LoadBalanceRequest_init_zero {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero}
98
118
  #define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""}
99
- #define grpc_lb_v1_ClientStats_init_zero {false, 0, false, 0, false, 0}
119
+ #define grpc_lb_v1_ClientStats_init_zero {false, grpc_lb_v1_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
100
120
  #define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero}
101
121
  #define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, grpc_lb_v1_Duration_init_zero}
102
122
  #define grpc_lb_v1_ServerList_init_zero {{{NULL}, NULL}, false, grpc_lb_v1_Duration_init_zero}
103
- #define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0}
123
+ #define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0, false, 0}
104
124
 
105
125
  /* Field tags (for use in manual encoding/decoding) */
106
- #define grpc_lb_v1_ClientStats_total_requests_tag 1
107
- #define grpc_lb_v1_ClientStats_client_rpc_errors_tag 2
108
- #define grpc_lb_v1_ClientStats_dropped_requests_tag 3
109
126
  #define grpc_lb_v1_Duration_seconds_tag 1
110
127
  #define grpc_lb_v1_Duration_nanos_tag 2
111
128
  #define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1
112
129
  #define grpc_lb_v1_Server_ip_address_tag 1
113
130
  #define grpc_lb_v1_Server_port_tag 2
114
131
  #define grpc_lb_v1_Server_load_balance_token_tag 3
115
- #define grpc_lb_v1_Server_drop_request_tag 4
132
+ #define grpc_lb_v1_Server_drop_for_rate_limiting_tag 4
133
+ #define grpc_lb_v1_Server_drop_for_load_balancing_tag 5
134
+ #define grpc_lb_v1_Timestamp_seconds_tag 1
135
+ #define grpc_lb_v1_Timestamp_nanos_tag 2
136
+ #define grpc_lb_v1_ClientStats_timestamp_tag 1
137
+ #define grpc_lb_v1_ClientStats_num_calls_started_tag 2
138
+ #define grpc_lb_v1_ClientStats_num_calls_finished_tag 3
139
+ #define grpc_lb_v1_ClientStats_num_calls_finished_with_drop_for_rate_limiting_tag 4
140
+ #define grpc_lb_v1_ClientStats_num_calls_finished_with_drop_for_load_balancing_tag 5
141
+ #define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6
142
+ #define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7
116
143
  #define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1
117
144
  #define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2
118
- #define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1
119
- #define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2
120
145
  #define grpc_lb_v1_ServerList_servers_tag 1
121
146
  #define grpc_lb_v1_ServerList_expiration_interval_tag 3
147
+ #define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1
148
+ #define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2
122
149
  #define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1
123
150
  #define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2
124
151
 
125
152
  /* Struct field encoding specification for nanopb */
126
153
  extern const pb_field_t grpc_lb_v1_Duration_fields[3];
154
+ extern const pb_field_t grpc_lb_v1_Timestamp_fields[3];
127
155
  extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3];
128
156
  extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2];
129
- extern const pb_field_t grpc_lb_v1_ClientStats_fields[4];
157
+ extern const pb_field_t grpc_lb_v1_ClientStats_fields[8];
130
158
  extern const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3];
131
159
  extern const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3];
132
160
  extern const pb_field_t grpc_lb_v1_ServerList_fields[3];
133
- extern const pb_field_t grpc_lb_v1_Server_fields[5];
161
+ extern const pb_field_t grpc_lb_v1_Server_fields[6];
134
162
 
135
163
  /* Maximum encoded size of messages (where known) */
136
164
  #define grpc_lb_v1_Duration_size 22
137
- #define grpc_lb_v1_LoadBalanceRequest_size 169
165
+ #define grpc_lb_v1_Timestamp_size 22
166
+ #define grpc_lb_v1_LoadBalanceRequest_size 226
138
167
  #define grpc_lb_v1_InitialLoadBalanceRequest_size 131
139
- #define grpc_lb_v1_ClientStats_size 33
168
+ #define grpc_lb_v1_ClientStats_size 90
140
169
  #define grpc_lb_v1_LoadBalanceResponse_size (98 + grpc_lb_v1_ServerList_size)
141
170
  #define grpc_lb_v1_InitialLoadBalanceResponse_size 90
142
171
  /* grpc_lb_v1_ServerList_size depends on runtime parameters */
143
- #define grpc_lb_v1_Server_size 83
172
+ #define grpc_lb_v1_Server_size 85
144
173
 
145
174
  /* Message IDs (where set with "msgid" option) */
146
175
  #ifdef PB_MSGID