grpc 0.13.0 → 0.13.1.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 (155) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Makefile +1114 -937
  4. data/include/grpc/census.h +71 -89
  5. data/include/grpc/compression.h +7 -7
  6. data/include/grpc/grpc.h +65 -68
  7. data/include/grpc/grpc_security.h +38 -38
  8. data/include/grpc/impl/codegen/alloc.h +7 -7
  9. data/include/grpc/impl/codegen/byte_buffer.h +13 -13
  10. data/include/grpc/impl/codegen/grpc_types.h +7 -2
  11. data/include/grpc/impl/codegen/log.h +5 -5
  12. data/include/grpc/impl/codegen/port_platform.h +14 -6
  13. data/include/grpc/impl/codegen/slice.h +15 -15
  14. data/include/grpc/impl/codegen/slice_buffer.h +17 -17
  15. data/include/grpc/impl/codegen/sync.h +26 -22
  16. data/include/grpc/impl/codegen/time.h +22 -24
  17. data/include/grpc/support/avl.h +9 -8
  18. data/include/grpc/support/cmdline.h +12 -12
  19. data/include/grpc/support/cpu.h +2 -2
  20. data/include/grpc/support/histogram.h +22 -22
  21. data/include/grpc/support/host_port.h +2 -2
  22. data/include/grpc/support/log_win32.h +1 -1
  23. data/include/grpc/support/string_util.h +2 -2
  24. data/include/grpc/support/subprocess.h +5 -5
  25. data/include/grpc/support/thd.h +9 -9
  26. data/include/grpc/support/useful.h +3 -1
  27. data/src/core/census/context.c +64 -85
  28. data/src/core/census/grpc_filter.c +2 -2
  29. data/src/core/census/mlog.c +600 -0
  30. data/src/core/census/mlog.h +95 -0
  31. data/src/core/channel/channel_args.c +67 -6
  32. data/src/core/channel/channel_args.h +7 -1
  33. data/src/core/channel/client_channel.c +26 -36
  34. data/src/core/channel/client_uchannel.c +1 -1
  35. data/src/core/channel/http_client_filter.c +2 -2
  36. data/src/core/channel/http_server_filter.c +2 -2
  37. data/src/core/channel/subchannel_call_holder.c +5 -7
  38. data/src/core/client_config/connector.c +3 -2
  39. data/src/core/client_config/connector.h +2 -2
  40. data/src/core/client_config/lb_policies/load_balancer_api.c +163 -0
  41. data/src/core/client_config/lb_policies/load_balancer_api.h +85 -0
  42. data/src/core/client_config/lb_policies/pick_first.c +10 -11
  43. data/src/core/client_config/lb_policies/round_robin.c +7 -8
  44. data/src/core/client_config/lb_policy.c +3 -3
  45. data/src/core/client_config/lb_policy.h +3 -2
  46. data/src/core/client_config/subchannel.c +51 -21
  47. data/src/core/client_config/subchannel.h +15 -6
  48. data/src/core/client_config/subchannel_index.c +261 -0
  49. data/src/core/client_config/subchannel_index.h +77 -0
  50. data/src/core/compression/{algorithm.c → compression_algorithm.c} +0 -0
  51. data/src/core/httpcli/httpcli.c +13 -11
  52. data/src/core/httpcli/httpcli.h +3 -2
  53. data/src/core/httpcli/httpcli_security_connector.c +7 -7
  54. data/src/core/iomgr/fd_posix.c +4 -2
  55. data/src/core/iomgr/iocp_windows.c +10 -6
  56. data/src/core/iomgr/iocp_windows.h +9 -2
  57. data/src/core/iomgr/iomgr.c +18 -2
  58. data/src/core/iomgr/iomgr_internal.h +5 -1
  59. data/src/core/iomgr/pollset.h +9 -10
  60. data/src/core/iomgr/pollset_multipoller_with_epoll.c +1 -0
  61. data/src/core/iomgr/pollset_multipoller_with_poll_posix.c +10 -5
  62. data/src/core/iomgr/pollset_posix.c +30 -35
  63. data/src/core/iomgr/pollset_posix.h +10 -6
  64. data/src/core/iomgr/pollset_set.h +3 -9
  65. data/src/core/iomgr/pollset_set_posix.c +23 -3
  66. data/src/core/iomgr/pollset_set_posix.h +2 -18
  67. data/src/core/iomgr/pollset_set_windows.c +3 -3
  68. data/src/core/iomgr/pollset_set_windows.h +2 -2
  69. data/src/core/iomgr/pollset_windows.c +24 -21
  70. data/src/core/iomgr/pollset_windows.h +1 -5
  71. data/src/core/iomgr/tcp_client_posix.c +7 -5
  72. data/src/core/iomgr/tcp_posix.c +4 -2
  73. data/src/core/iomgr/tcp_server_windows.c +1 -2
  74. data/src/core/iomgr/timer.c +2 -3
  75. data/src/core/iomgr/timer.h +21 -1
  76. data/src/core/iomgr/timer_heap.c +10 -12
  77. data/src/core/iomgr/udp_server.c +5 -4
  78. data/src/core/iomgr/udp_server.h +1 -0
  79. data/src/core/iomgr/workqueue_posix.c +1 -0
  80. data/src/core/iomgr/workqueue_posix.h +3 -1
  81. data/src/core/proto/grpc/lb/v0/load_balancer.pb.c +119 -0
  82. data/src/core/proto/grpc/lb/v0/load_balancer.pb.h +182 -0
  83. data/src/core/security/{base64.c → b64.c} +1 -1
  84. data/src/core/security/{base64.h → b64.h} +1 -1
  85. data/src/core/security/client_auth_filter.c +0 -1
  86. data/src/core/security/credentials.c +12 -5
  87. data/src/core/security/credentials.h +3 -3
  88. data/src/core/security/google_default_credentials.c +24 -19
  89. data/src/core/security/handshake.c +15 -7
  90. data/src/core/security/handshake.h +2 -1
  91. data/src/core/security/json_token.c +1 -1
  92. data/src/core/security/jwt_verifier.c +1 -1
  93. data/src/core/security/security_connector.c +84 -64
  94. data/src/core/security/security_connector.h +42 -22
  95. data/src/core/security/security_context.c +8 -3
  96. data/src/core/security/server_auth_filter.c +2 -2
  97. data/src/core/security/server_secure_chttp2.c +7 -7
  98. data/src/core/support/avl.c +2 -2
  99. data/src/core/support/env_linux.c +17 -0
  100. data/src/core/support/{file.c → load_file.c} +2 -2
  101. data/src/core/support/{file.h → load_file.h} +4 -12
  102. data/src/core/support/sync.c +6 -1
  103. data/src/core/support/time_posix.c +1 -1
  104. data/src/core/{iomgr/timer_internal.h → support/tmpfile.h} +17 -23
  105. data/src/core/support/{file_posix.c → tmpfile_posix.c} +2 -2
  106. data/src/core/support/{file_win32.c → tmpfile_win32.c} +2 -2
  107. data/src/core/surface/alarm.c +3 -2
  108. data/src/core/surface/call.c +102 -52
  109. data/src/core/surface/channel_create.c +1 -1
  110. data/src/core/surface/completion_queue.c +73 -41
  111. data/src/core/surface/init.c +4 -0
  112. data/src/core/surface/lame_client.c +1 -2
  113. data/src/core/surface/secure_channel_create.c +6 -7
  114. data/src/core/surface/server.c +13 -5
  115. data/src/core/surface/validate_metadata.c +1 -1
  116. data/src/core/surface/version.c +1 -1
  117. data/src/core/transport/chttp2/internal.h +22 -10
  118. data/src/core/transport/chttp2/parsing.c +3 -3
  119. data/src/core/transport/chttp2/stream_lists.c +39 -21
  120. data/src/core/transport/chttp2/writing.c +19 -28
  121. data/src/core/transport/chttp2_transport.c +80 -37
  122. data/src/core/transport/metadata.c +8 -0
  123. data/src/core/transport/static_metadata.c +17 -17
  124. data/src/core/transport/static_metadata.h +3 -3
  125. data/src/core/transport/transport.c +2 -1
  126. data/src/core/transport/transport.h +12 -5
  127. data/src/ruby/ext/grpc/extconf.rb +1 -0
  128. data/src/ruby/ext/grpc/rb_call.c +6 -0
  129. data/src/ruby/ext/grpc/rb_call_credentials.c +12 -14
  130. data/src/ruby/ext/grpc/rb_channel.c +8 -14
  131. data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -12
  132. data/src/ruby/ext/grpc/rb_grpc.c +19 -18
  133. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  134. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +8 -2
  135. data/src/ruby/lib/grpc/core/time_consts.rb +2 -2
  136. data/src/ruby/lib/grpc/errors.rb +2 -2
  137. data/src/ruby/lib/grpc/generic/rpc_server.rb +58 -39
  138. data/src/ruby/lib/grpc/version.rb +1 -1
  139. data/src/ruby/pb/README.md +2 -2
  140. data/src/ruby/pb/generate_proto_ruby.sh +2 -2
  141. data/src/ruby/pb/grpc/health/checker.rb +11 -11
  142. data/src/ruby/pb/grpc/health/v1/health.rb +28 -0
  143. data/src/ruby/pb/grpc/health/{v1alpha → v1}/health_services.rb +4 -4
  144. data/src/ruby/spec/client_server_spec.rb +2 -1
  145. data/src/ruby/spec/generic/rpc_server_spec.rb +3 -22
  146. data/src/ruby/spec/pb/health/checker_spec.rb +22 -36
  147. data/third_party/nanopb/pb.h +547 -0
  148. data/third_party/nanopb/pb_common.c +97 -0
  149. data/third_party/nanopb/pb_common.h +42 -0
  150. data/third_party/nanopb/pb_decode.c +1319 -0
  151. data/third_party/nanopb/pb_decode.h +149 -0
  152. data/third_party/nanopb/pb_encode.c +690 -0
  153. data/third_party/nanopb/pb_encode.h +154 -0
  154. metadata +32 -16
  155. data/src/ruby/pb/grpc/health/v1alpha/health.rb +0 -29
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
3
+ * Copyright 2015-2016, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -72,8 +72,4 @@ struct grpc_pollset {
72
72
  grpc_closure *on_shutdown;
73
73
  };
74
74
 
75
- extern gpr_mu grpc_polling_mu;
76
-
77
- #define GRPC_POLLSET_MU(pollset) (&grpc_polling_mu)
78
-
79
75
  #endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H */
@@ -42,17 +42,19 @@
42
42
  #include <string.h>
43
43
  #include <unistd.h>
44
44
 
45
- #include "src/core/iomgr/timer.h"
45
+ #include <grpc/support/alloc.h>
46
+ #include <grpc/support/log.h>
47
+ #include <grpc/support/string_util.h>
48
+ #include <grpc/support/time.h>
49
+
46
50
  #include "src/core/iomgr/iomgr_posix.h"
47
51
  #include "src/core/iomgr/pollset_posix.h"
52
+ #include "src/core/iomgr/pollset_set_posix.h"
48
53
  #include "src/core/iomgr/sockaddr_utils.h"
49
54
  #include "src/core/iomgr/socket_utils_posix.h"
50
55
  #include "src/core/iomgr/tcp_posix.h"
56
+ #include "src/core/iomgr/timer.h"
51
57
  #include "src/core/support/string.h"
52
- #include <grpc/support/alloc.h>
53
- #include <grpc/support/log.h>
54
- #include <grpc/support/string_util.h>
55
- #include <grpc/support/time.h>
56
58
 
57
59
  extern int grpc_tcp_trace;
58
60
 
@@ -40,8 +40,8 @@
40
40
  #include <errno.h>
41
41
  #include <stdlib.h>
42
42
  #include <string.h>
43
- #include <sys/types.h>
44
43
  #include <sys/socket.h>
44
+ #include <sys/types.h>
45
45
  #include <unistd.h>
46
46
 
47
47
  #include <grpc/support/alloc.h>
@@ -51,9 +51,11 @@
51
51
  #include <grpc/support/sync.h>
52
52
  #include <grpc/support/time.h>
53
53
 
54
- #include "src/core/support/string.h"
55
54
  #include "src/core/debug/trace.h"
55
+ #include "src/core/iomgr/pollset_posix.h"
56
+ #include "src/core/iomgr/pollset_set_posix.h"
56
57
  #include "src/core/profiling/timers.h"
58
+ #include "src/core/support/string.h"
57
59
 
58
60
  #ifdef GPR_HAVE_MSG_NOSIGNAL
59
61
  #define SENDMSG_FLAGS MSG_NOSIGNAL
@@ -240,8 +240,7 @@ static void decrement_active_ports_and_notify(grpc_exec_ctx *exec_ctx,
240
240
  sp->shutting_down = 0;
241
241
  gpr_mu_lock(&sp->server->mu);
242
242
  GPR_ASSERT(sp->server->active_ports > 0);
243
- if (0 == --sp->server->active_ports &&
244
- sp->server->shutdown_complete != NULL) {
243
+ if (0 == --sp->server->active_ports) {
245
244
  notify = 1;
246
245
  }
247
246
  gpr_mu_unlock(&sp->server->mu);
@@ -34,7 +34,6 @@
34
34
  #include "src/core/iomgr/timer.h"
35
35
 
36
36
  #include "src/core/iomgr/timer_heap.h"
37
- #include "src/core/iomgr/timer_internal.h"
38
37
  #include "src/core/iomgr/time_averaged_stats.h"
39
38
  #include <grpc/support/log.h>
40
39
  #include <grpc/support/sync.h>
@@ -336,8 +335,8 @@ static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now,
336
335
  return (int)n;
337
336
  }
338
337
 
339
- int grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
340
- gpr_timespec *next) {
338
+ bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
339
+ gpr_timespec *next) {
341
340
  GPR_ASSERT(now.clock_type == g_clock_type);
342
341
  return run_some_expired_timers(
343
342
  exec_ctx, now, next,
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
3
+ * Copyright 2015-2016, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -86,4 +86,24 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
86
86
  Requires: cancel() must happen after add() on a given timer */
87
87
  void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer);
88
88
 
89
+ /* iomgr internal api for dealing with timers */
90
+
91
+ /* Check for timers to be run, and run them.
92
+ Return true if timer callbacks were executed.
93
+ Drops drop_mu if it is non-null before executing callbacks.
94
+ If next is non-null, TRY to update *next with the next running timer
95
+ IF that timer occurs before *next current value.
96
+ *next is never guaranteed to be updated on any given execution; however,
97
+ with high probability at least one thread in the system will see an update
98
+ at any time slice. */
99
+
100
+ bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
101
+ gpr_timespec *next);
102
+ void grpc_timer_list_init(gpr_timespec now);
103
+ void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx);
104
+
105
+ /* the following must be implemented by each iomgr implementation */
106
+
107
+ void grpc_kick_poller(void);
108
+
89
109
  #endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_H */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
3
+ * Copyright 2015-2016, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
46
46
  static void adjust_upwards(grpc_timer **first, uint32_t i, grpc_timer *t) {
47
47
  while (i > 0) {
48
48
  uint32_t parent = (uint32_t)(((int)i - 1) / 2);
49
- if (gpr_time_cmp(first[parent]->deadline, t->deadline) >= 0) break;
49
+ if (gpr_time_cmp(first[parent]->deadline, t->deadline) <= 0) break;
50
50
  first[i] = first[parent];
51
51
  first[i]->heap_index = i;
52
52
  i = parent;
@@ -62,16 +62,14 @@ static void adjust_downwards(grpc_timer **first, uint32_t i, uint32_t length,
62
62
  grpc_timer *t) {
63
63
  for (;;) {
64
64
  uint32_t left_child = 1u + 2u * i;
65
- uint32_t right_child;
66
- uint32_t next_i;
67
65
  if (left_child >= length) break;
68
- right_child = left_child + 1;
69
- next_i = right_child < length &&
70
- gpr_time_cmp(first[left_child]->deadline,
71
- first[right_child]->deadline) < 0
72
- ? right_child
73
- : left_child;
74
- if (gpr_time_cmp(t->deadline, first[next_i]->deadline) >= 0) break;
66
+ uint32_t right_child = left_child + 1;
67
+ uint32_t next_i = right_child < length &&
68
+ gpr_time_cmp(first[left_child]->deadline,
69
+ first[right_child]->deadline) > 0
70
+ ? right_child
71
+ : left_child;
72
+ if (gpr_time_cmp(t->deadline, first[next_i]->deadline) <= 0) break;
75
73
  first[i] = first[next_i];
76
74
  first[i]->heap_index = i;
77
75
  i = next_i;
@@ -95,7 +93,7 @@ static void maybe_shrink(grpc_timer_heap *heap) {
95
93
  static void note_changed_priority(grpc_timer_heap *heap, grpc_timer *timer) {
96
94
  uint32_t i = timer->heap_index;
97
95
  uint32_t parent = (uint32_t)(((int)i - 1) / 2);
98
- if (gpr_time_cmp(heap->timers[parent]->deadline, timer->deadline) < 0) {
96
+ if (gpr_time_cmp(heap->timers[parent]->deadline, timer->deadline) > 0) {
99
97
  adjust_upwards(heap->timers, i, timer);
100
98
  } else {
101
99
  adjust_downwards(heap->timers, i, heap->timer_count, timer);
@@ -137,7 +137,7 @@ grpc_udp_server *grpc_udp_server_create(void) {
137
137
  }
138
138
 
139
139
  static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) {
140
- grpc_exec_ctx_enqueue(exec_ctx, s->shutdown_complete, 1);
140
+ grpc_exec_ctx_enqueue(exec_ctx, s->shutdown_complete, 1, NULL);
141
141
 
142
142
  gpr_mu_destroy(&s->mu);
143
143
  gpr_cv_destroy(&s->cv);
@@ -146,7 +146,8 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) {
146
146
  gpr_free(s);
147
147
  }
148
148
 
149
- static void destroyed_port(grpc_exec_ctx *exec_ctx, void *server, int success) {
149
+ static void destroyed_port(grpc_exec_ctx *exec_ctx, void *server,
150
+ bool success) {
150
151
  grpc_udp_server *s = server;
151
152
  gpr_mu_lock(&s->mu);
152
153
  s->destroyed_ports++;
@@ -263,10 +264,10 @@ error:
263
264
  }
264
265
 
265
266
  /* event manager callback when reads are ready */
266
- static void on_read(grpc_exec_ctx *exec_ctx, void *arg, int success) {
267
+ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
267
268
  server_port *sp = arg;
268
269
 
269
- if (success == 0) {
270
+ if (!success) {
270
271
  gpr_mu_lock(&sp->server->mu);
271
272
  if (0 == --sp->server->active_ports) {
272
273
  gpr_mu_unlock(&sp->server->mu);
@@ -35,6 +35,7 @@
35
35
  #define GRPC_INTERNAL_CORE_IOMGR_UDP_SERVER_H
36
36
 
37
37
  #include "src/core/iomgr/endpoint.h"
38
+ #include "src/core/iomgr/fd_posix.h"
38
39
 
39
40
  /* Forward decl of grpc_server */
40
41
  typedef struct grpc_server grpc_server;
@@ -44,6 +44,7 @@
44
44
  #include <grpc/support/useful.h>
45
45
 
46
46
  #include "src/core/iomgr/fd_posix.h"
47
+ #include "src/core/iomgr/pollset_posix.h"
47
48
 
48
49
  static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, bool success);
49
50
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
3
+ * Copyright 2015-2016, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
34
34
  #ifndef GRPC_INTERNAL_CORE_IOMGR_WORKQUEUE_POSIX_H
35
35
  #define GRPC_INTERNAL_CORE_IOMGR_WORKQUEUE_POSIX_H
36
36
 
37
+ #include "src/core/iomgr/wakeup_fd_posix.h"
38
+
37
39
  struct grpc_fd;
38
40
 
39
41
  struct grpc_workqueue {
@@ -0,0 +1,119 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, 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
+ /* Automatically generated nanopb constant definitions */
34
+ /* Generated by nanopb-0.3.5-dev */
35
+
36
+ #include "src/core/proto/grpc/lb/v0/load_balancer.pb.h"
37
+
38
+ #if PB_PROTO_HEADER_VERSION != 30
39
+ #error Regenerate this file with the current version of nanopb generator.
40
+ #endif
41
+
42
+
43
+
44
+ const pb_field_t grpc_lb_v0_Duration_fields[3] = {
45
+ PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v0_Duration, seconds, seconds, 0),
46
+ PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Duration, nanos, seconds, 0),
47
+ PB_LAST_FIELD
48
+ };
49
+
50
+ const pb_field_t grpc_lb_v0_LoadBalanceRequest_fields[3] = {
51
+ PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v0_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v0_InitialLoadBalanceRequest_fields),
52
+ PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v0_ClientStats_fields),
53
+ PB_LAST_FIELD
54
+ };
55
+
56
+ const pb_field_t grpc_lb_v0_InitialLoadBalanceRequest_fields[2] = {
57
+ PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_InitialLoadBalanceRequest, name, name, 0),
58
+ PB_LAST_FIELD
59
+ };
60
+
61
+ const pb_field_t grpc_lb_v0_ClientStats_fields[4] = {
62
+ PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v0_ClientStats, total_requests, total_requests, 0),
63
+ PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ClientStats, client_rpc_errors, total_requests, 0),
64
+ PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ClientStats, dropped_requests, client_rpc_errors, 0),
65
+ PB_LAST_FIELD
66
+ };
67
+
68
+ const pb_field_t grpc_lb_v0_LoadBalanceResponse_fields[3] = {
69
+ PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v0_LoadBalanceResponse, initial_response, initial_response, &grpc_lb_v0_InitialLoadBalanceResponse_fields),
70
+ PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_LoadBalanceResponse, server_list, initial_response, &grpc_lb_v0_ServerList_fields),
71
+ PB_LAST_FIELD
72
+ };
73
+
74
+ const pb_field_t grpc_lb_v0_InitialLoadBalanceResponse_fields[4] = {
75
+ PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_InitialLoadBalanceResponse, client_config, client_config, 0),
76
+ PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v0_InitialLoadBalanceResponse, load_balancer_delegate, client_config, 0),
77
+ PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &grpc_lb_v0_Duration_fields),
78
+ PB_LAST_FIELD
79
+ };
80
+
81
+ const pb_field_t grpc_lb_v0_ServerList_fields[3] = {
82
+ PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, grpc_lb_v0_ServerList, servers, servers, &grpc_lb_v0_Server_fields),
83
+ PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ServerList, expiration_interval, servers, &grpc_lb_v0_Duration_fields),
84
+ PB_LAST_FIELD
85
+ };
86
+
87
+ const pb_field_t grpc_lb_v0_Server_fields[5] = {
88
+ PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_Server, ip_address, ip_address, 0),
89
+ PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, port, ip_address, 0),
90
+ PB_FIELD( 3, BYTES , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, load_balance_token, port, 0),
91
+ PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, drop_request, load_balance_token, 0),
92
+ PB_LAST_FIELD
93
+ };
94
+
95
+
96
+ /* Check that field information fits in pb_field_t */
97
+ #if !defined(PB_FIELD_32BIT)
98
+ /* If you get an error here, it means that you need to define PB_FIELD_32BIT
99
+ * compile-time option. You can do that in pb.h or on compiler command line.
100
+ *
101
+ * The reason you need to do this is that some of your messages contain tag
102
+ * numbers or field sizes that are larger than what can fit in 8 or 16 bit
103
+ * field descriptors.
104
+ */
105
+ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v0_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v0_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v0_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v0_Duration_grpc_lb_v0_LoadBalanceRequest_grpc_lb_v0_InitialLoadBalanceRequest_grpc_lb_v0_ClientStats_grpc_lb_v0_LoadBalanceResponse_grpc_lb_v0_InitialLoadBalanceResponse_grpc_lb_v0_ServerList_grpc_lb_v0_Server)
106
+ #endif
107
+
108
+ #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
109
+ /* If you get an error here, it means that you need to define PB_FIELD_16BIT
110
+ * compile-time option. You can do that in pb.h or on compiler command line.
111
+ *
112
+ * The reason you need to do this is that some of your messages contain tag
113
+ * numbers or field sizes that are larger than what can fit in the default
114
+ * 8 bit descriptors.
115
+ */
116
+ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v0_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v0_ServerList, servers) < 256 && pb_membersize(grpc_lb_v0_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v0_Duration_grpc_lb_v0_LoadBalanceRequest_grpc_lb_v0_InitialLoadBalanceRequest_grpc_lb_v0_ClientStats_grpc_lb_v0_LoadBalanceResponse_grpc_lb_v0_InitialLoadBalanceResponse_grpc_lb_v0_ServerList_grpc_lb_v0_Server)
117
+ #endif
118
+
119
+
@@ -0,0 +1,182 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, 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
+ /* Automatically generated nanopb header */
34
+ /* Generated by nanopb-0.3.5-dev */
35
+
36
+ #ifndef PB_LOAD_BALANCER_PB_H_INCLUDED
37
+ #define PB_LOAD_BALANCER_PB_H_INCLUDED
38
+ #include "third_party/nanopb/pb.h"
39
+ #if PB_PROTO_HEADER_VERSION != 30
40
+ #error Regenerate this file with the current version of nanopb generator.
41
+ #endif
42
+
43
+ #ifdef __cplusplus
44
+ extern "C" {
45
+ #endif
46
+
47
+ /* Struct definitions */
48
+ typedef struct _grpc_lb_v0_ClientStats {
49
+ bool has_total_requests;
50
+ int64_t total_requests;
51
+ bool has_client_rpc_errors;
52
+ int64_t client_rpc_errors;
53
+ bool has_dropped_requests;
54
+ int64_t dropped_requests;
55
+ } grpc_lb_v0_ClientStats;
56
+
57
+ typedef struct _grpc_lb_v0_Duration {
58
+ bool has_seconds;
59
+ int64_t seconds;
60
+ bool has_nanos;
61
+ int32_t nanos;
62
+ } grpc_lb_v0_Duration;
63
+
64
+ typedef struct _grpc_lb_v0_InitialLoadBalanceRequest {
65
+ bool has_name;
66
+ char name[128];
67
+ } grpc_lb_v0_InitialLoadBalanceRequest;
68
+
69
+ typedef PB_BYTES_ARRAY_T(64) grpc_lb_v0_Server_load_balance_token_t;
70
+ typedef struct _grpc_lb_v0_Server {
71
+ bool has_ip_address;
72
+ char ip_address[46];
73
+ bool has_port;
74
+ int32_t port;
75
+ bool has_load_balance_token;
76
+ grpc_lb_v0_Server_load_balance_token_t load_balance_token;
77
+ bool has_drop_request;
78
+ bool drop_request;
79
+ } grpc_lb_v0_Server;
80
+
81
+ typedef struct _grpc_lb_v0_InitialLoadBalanceResponse {
82
+ bool has_client_config;
83
+ char client_config[64];
84
+ bool has_load_balancer_delegate;
85
+ char load_balancer_delegate[64];
86
+ bool has_client_stats_report_interval;
87
+ grpc_lb_v0_Duration client_stats_report_interval;
88
+ } grpc_lb_v0_InitialLoadBalanceResponse;
89
+
90
+ typedef struct _grpc_lb_v0_LoadBalanceRequest {
91
+ bool has_initial_request;
92
+ grpc_lb_v0_InitialLoadBalanceRequest initial_request;
93
+ bool has_client_stats;
94
+ grpc_lb_v0_ClientStats client_stats;
95
+ } grpc_lb_v0_LoadBalanceRequest;
96
+
97
+ typedef struct _grpc_lb_v0_ServerList {
98
+ pb_callback_t servers;
99
+ bool has_expiration_interval;
100
+ grpc_lb_v0_Duration expiration_interval;
101
+ } grpc_lb_v0_ServerList;
102
+
103
+ typedef struct _grpc_lb_v0_LoadBalanceResponse {
104
+ bool has_initial_response;
105
+ grpc_lb_v0_InitialLoadBalanceResponse initial_response;
106
+ bool has_server_list;
107
+ grpc_lb_v0_ServerList server_list;
108
+ } grpc_lb_v0_LoadBalanceResponse;
109
+
110
+ /* Default values for struct fields */
111
+
112
+ /* Initializer values for message structs */
113
+ #define grpc_lb_v0_Duration_init_default {false, 0, false, 0}
114
+ #define grpc_lb_v0_LoadBalanceRequest_init_default {false, grpc_lb_v0_InitialLoadBalanceRequest_init_default, false, grpc_lb_v0_ClientStats_init_default}
115
+ #define grpc_lb_v0_InitialLoadBalanceRequest_init_default {false, ""}
116
+ #define grpc_lb_v0_ClientStats_init_default {false, 0, false, 0, false, 0}
117
+ #define grpc_lb_v0_LoadBalanceResponse_init_default {false, grpc_lb_v0_InitialLoadBalanceResponse_init_default, false, grpc_lb_v0_ServerList_init_default}
118
+ #define grpc_lb_v0_InitialLoadBalanceResponse_init_default {false, "", false, "", false, grpc_lb_v0_Duration_init_default}
119
+ #define grpc_lb_v0_ServerList_init_default {{{NULL}, NULL}, false, grpc_lb_v0_Duration_init_default}
120
+ #define grpc_lb_v0_Server_init_default {false, "", false, 0, false, {0, {0}}, false, 0}
121
+ #define grpc_lb_v0_Duration_init_zero {false, 0, false, 0}
122
+ #define grpc_lb_v0_LoadBalanceRequest_init_zero {false, grpc_lb_v0_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v0_ClientStats_init_zero}
123
+ #define grpc_lb_v0_InitialLoadBalanceRequest_init_zero {false, ""}
124
+ #define grpc_lb_v0_ClientStats_init_zero {false, 0, false, 0, false, 0}
125
+ #define grpc_lb_v0_LoadBalanceResponse_init_zero {false, grpc_lb_v0_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v0_ServerList_init_zero}
126
+ #define grpc_lb_v0_InitialLoadBalanceResponse_init_zero {false, "", false, "", false, grpc_lb_v0_Duration_init_zero}
127
+ #define grpc_lb_v0_ServerList_init_zero {{{NULL}, NULL}, false, grpc_lb_v0_Duration_init_zero}
128
+ #define grpc_lb_v0_Server_init_zero {false, "", false, 0, false, {0, {0}}, false, 0}
129
+
130
+ /* Field tags (for use in manual encoding/decoding) */
131
+ #define grpc_lb_v0_ClientStats_total_requests_tag 1
132
+ #define grpc_lb_v0_ClientStats_client_rpc_errors_tag 2
133
+ #define grpc_lb_v0_ClientStats_dropped_requests_tag 3
134
+ #define grpc_lb_v0_Duration_seconds_tag 1
135
+ #define grpc_lb_v0_Duration_nanos_tag 2
136
+ #define grpc_lb_v0_InitialLoadBalanceRequest_name_tag 1
137
+ #define grpc_lb_v0_Server_ip_address_tag 1
138
+ #define grpc_lb_v0_Server_port_tag 2
139
+ #define grpc_lb_v0_Server_load_balance_token_tag 3
140
+ #define grpc_lb_v0_Server_drop_request_tag 4
141
+ #define grpc_lb_v0_InitialLoadBalanceResponse_client_config_tag 1
142
+ #define grpc_lb_v0_InitialLoadBalanceResponse_load_balancer_delegate_tag 2
143
+ #define grpc_lb_v0_InitialLoadBalanceResponse_client_stats_report_interval_tag 3
144
+ #define grpc_lb_v0_LoadBalanceRequest_initial_request_tag 1
145
+ #define grpc_lb_v0_LoadBalanceRequest_client_stats_tag 2
146
+ #define grpc_lb_v0_ServerList_servers_tag 1
147
+ #define grpc_lb_v0_ServerList_expiration_interval_tag 3
148
+ #define grpc_lb_v0_LoadBalanceResponse_initial_response_tag 1
149
+ #define grpc_lb_v0_LoadBalanceResponse_server_list_tag 2
150
+
151
+ /* Struct field encoding specification for nanopb */
152
+ extern const pb_field_t grpc_lb_v0_Duration_fields[3];
153
+ extern const pb_field_t grpc_lb_v0_LoadBalanceRequest_fields[3];
154
+ extern const pb_field_t grpc_lb_v0_InitialLoadBalanceRequest_fields[2];
155
+ extern const pb_field_t grpc_lb_v0_ClientStats_fields[4];
156
+ extern const pb_field_t grpc_lb_v0_LoadBalanceResponse_fields[3];
157
+ extern const pb_field_t grpc_lb_v0_InitialLoadBalanceResponse_fields[4];
158
+ extern const pb_field_t grpc_lb_v0_ServerList_fields[3];
159
+ extern const pb_field_t grpc_lb_v0_Server_fields[5];
160
+
161
+ /* Maximum encoded size of messages (where known) */
162
+ #define grpc_lb_v0_Duration_size 22
163
+ #define grpc_lb_v0_LoadBalanceRequest_size 169
164
+ #define grpc_lb_v0_InitialLoadBalanceRequest_size 131
165
+ #define grpc_lb_v0_ClientStats_size 33
166
+ #define grpc_lb_v0_LoadBalanceResponse_size (165 + grpc_lb_v0_ServerList_size)
167
+ #define grpc_lb_v0_InitialLoadBalanceResponse_size 156
168
+ #define grpc_lb_v0_Server_size 127
169
+
170
+ /* Message IDs (where set with "msgid" option) */
171
+ #ifdef PB_MSGID
172
+
173
+ #define LOAD_BALANCER_MESSAGES \
174
+
175
+
176
+ #endif
177
+
178
+ #ifdef __cplusplus
179
+ } /* extern "C" */
180
+ #endif
181
+
182
+ #endif