grpc 0.13.0-x64-mingw32 → 0.13.1.pre1-x64-mingw32

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7993803b7619847cbe4d4b8cab2f98463a11d2bb
4
- data.tar.gz: a81ea97a5b50abd3cb3e18db023fe55c54b26f6c
3
+ metadata.gz: 415d1086a00f3d49e984b195f36cfbf5480bdc9c
4
+ data.tar.gz: 2f0513903f6ab6682e2538211743d64e9fa5ccc1
5
5
  SHA512:
6
- metadata.gz: 9109746e879c78fa8f624a32f7ff87dad7b0a7a0ead089cf9b685a7a40d40bb563efca2d5a631278bf98808bd2fe112309a694636d60aebc8d7c96eda47d9884
7
- data.tar.gz: c032c74b952c7f36348afe5ef4a710edb2e46ccf61f3368907e9735d145acdb9202aef0115a102eed3783c655bf0b2ededb9ef0c551c3194b142fddacf4e2192
6
+ metadata.gz: 8575b3384ab868c7815764f6130722ddf6644cf7204d5ffc82423f3f5f576d6fe6fafc5cc5e382b37e22fa6eded3f963921203841d578eca0ec6b728121c1d8a
7
+ data.tar.gz: dd6fe0af52d6eb7312931d567697e6c0f81cbbb7ae862eb99f67cfe73b3b6b99702039d1b6115436d7e49326ef13cc11da4cb112a0d5e82726daf2a486c313a9
Binary file
Binary file
@@ -79,6 +79,7 @@ unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) or windows
79
79
  ENV['EMBED_ZLIB'] = 'true'
80
80
  ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
81
81
  ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
82
+ ENV['CFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
82
83
 
83
84
  output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
84
85
  grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
@@ -72,6 +72,10 @@ static ID id_cq;
72
72
  * the flags used to create metadata from a Hash */
73
73
  static ID id_flags;
74
74
 
75
+ /* id_credentials is the name of the hidden ivar that preserves the value
76
+ * of the credentials added to the call */
77
+ static ID id_credentials;
78
+
75
79
  /* id_input_md is the name of the hidden ivar that preserves the hash used to
76
80
  * create metadata, so that references to the strings it contains last as long
77
81
  * as the call the metadata is added to. */
@@ -299,6 +303,7 @@ static VALUE grpc_rb_call_set_credentials(VALUE self, VALUE credentials) {
299
303
  "grpc_call_set_credentials failed with %s (code=%d)",
300
304
  grpc_call_error_detail_of(err), err);
301
305
  }
306
+ rb_ivar_set(self, id_credentials, credentials);
302
307
  return Qnil;
303
308
  }
304
309
 
@@ -859,6 +864,7 @@ void Init_grpc_call() {
859
864
  id_cq = rb_intern("__cq");
860
865
  id_flags = rb_intern("__flags");
861
866
  id_input_md = rb_intern("__input_md");
867
+ id_credentials = rb_intern("__credentials");
862
868
 
863
869
  /* Ids used in constructing the batch result. */
864
870
  sym_send_message = ID2SYM(rb_intern("send_message"));
@@ -50,9 +50,9 @@
50
50
  * grpc_call_credentials */
51
51
  static VALUE grpc_rb_cCallCredentials = Qnil;
52
52
 
53
- /* grpc_rb_call_credentials wraps a grpc_call_credentials. It provides a peer
54
- * ruby object, 'mark' to minimize copying when a credential is created from
55
- * ruby. */
53
+ /* grpc_rb_call_credentials wraps a grpc_call_credentials. It provides a mark
54
+ * object that is used to hold references to any objects used to create the
55
+ * credentials. */
56
56
  typedef struct grpc_rb_call_credentials {
57
57
  /* Holder of ruby objects involved in contructing the credentials */
58
58
  VALUE mark;
@@ -146,13 +146,8 @@ static void grpc_rb_call_credentials_free(void *p) {
146
146
  return;
147
147
  }
148
148
  wrapper = (grpc_rb_call_credentials *)p;
149
-
150
- /* Delete the wrapped object if the mark object is Qnil, which indicates that
151
- * no other object is the actual owner. */
152
- if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
153
- grpc_call_credentials_release(wrapper->wrapped);
154
- wrapper->wrapped = NULL;
155
- }
149
+ grpc_call_credentials_release(wrapper->wrapped);
150
+ wrapper->wrapped = NULL;
156
151
 
157
152
  xfree(p);
158
153
  }
@@ -164,8 +159,6 @@ static void grpc_rb_call_credentials_mark(void *p) {
164
159
  return;
165
160
  }
166
161
  wrapper = (grpc_rb_call_credentials *)p;
167
-
168
- /* If it's not already cleaned up, mark the mark object */
169
162
  if (wrapper->mark != Qnil) {
170
163
  rb_gc_mark(wrapper->mark);
171
164
  }
@@ -194,7 +187,7 @@ static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
194
187
  /* Creates a wrapping object for a given call credentials. This should only be
195
188
  * called with grpc_call_credentials objects that are not already associated
196
189
  * with any Ruby object */
197
- VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c) {
190
+ VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c, VALUE mark) {
198
191
  VALUE rb_wrapper;
199
192
  grpc_rb_call_credentials *wrapper;
200
193
  if (c == NULL) {
@@ -204,6 +197,7 @@ VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c) {
204
197
  TypedData_Get_Struct(rb_wrapper, grpc_rb_call_credentials,
205
198
  &grpc_rb_call_credentials_data_type, wrapper);
206
199
  wrapper->wrapped = c;
200
+ wrapper->mark = mark;
207
201
  return rb_wrapper;
208
202
  }
209
203
 
@@ -267,6 +261,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
267
261
  return Qnil;
268
262
  }
269
263
 
264
+ wrapper->mark = proc;
270
265
  wrapper->wrapped = creds;
271
266
  rb_ivar_set(self, id_callback, proc);
272
267
 
@@ -277,15 +272,18 @@ static VALUE grpc_rb_call_credentials_compose(int argc, VALUE *argv,
277
272
  VALUE self) {
278
273
  grpc_call_credentials *creds;
279
274
  grpc_call_credentials *other;
275
+ VALUE mark;
280
276
  if (argc == 0) {
281
277
  return self;
282
278
  }
279
+ mark = rb_ary_new();
283
280
  creds = grpc_rb_get_wrapped_call_credentials(self);
284
281
  for (int i = 0; i < argc; i++) {
282
+ rb_ary_push(mark, argv[i]);
285
283
  other = grpc_rb_get_wrapped_call_credentials(argv[i]);
286
284
  creds = grpc_composite_call_credentials_create(creds, other, NULL);
287
285
  }
288
- return grpc_rb_wrap_call_credentials(creds);
286
+ return grpc_rb_wrap_call_credentials(creds, mark);
289
287
  }
290
288
 
291
289
  void Init_grpc_call_credentials() {
@@ -70,11 +70,10 @@ static VALUE grpc_rb_cChannel = Qnil;
70
70
  /* Used during the conversion of a hash to channel args during channel setup */
71
71
  static VALUE grpc_rb_cChannelArgs;
72
72
 
73
- /* grpc_rb_channel wraps a grpc_channel. It provides a peer ruby object,
74
- * 'mark' to minimize copying when a channel is created from ruby. */
73
+ /* grpc_rb_channel wraps a grpc_channel. */
75
74
  typedef struct grpc_rb_channel {
76
- /* Holder of ruby objects involved in constructing the channel */
77
- VALUE mark;
75
+ VALUE credentials;
76
+
78
77
  /* The actual channel */
79
78
  grpc_channel *wrapped;
80
79
  } grpc_rb_channel;
@@ -87,13 +86,8 @@ static void grpc_rb_channel_free(void *p) {
87
86
  };
88
87
  ch = (grpc_rb_channel *)p;
89
88
 
90
- /* Deletes the wrapped object if the mark object is Qnil, which indicates
91
- * that no other object is the actual owner. */
92
- if (ch->wrapped != NULL && ch->mark == Qnil) {
89
+ if (ch->wrapped != NULL) {
93
90
  grpc_channel_destroy(ch->wrapped);
94
- rb_warning("channel gc: destroyed the c channel");
95
- } else {
96
- rb_warning("channel gc: did not destroy the c channel");
97
91
  }
98
92
 
99
93
  xfree(p);
@@ -106,8 +100,8 @@ static void grpc_rb_channel_mark(void *p) {
106
100
  return;
107
101
  }
108
102
  channel = (grpc_rb_channel *)p;
109
- if (channel->mark != Qnil) {
110
- rb_gc_mark(channel->mark);
103
+ if (channel->credentials != Qnil) {
104
+ rb_gc_mark(channel->credentials);
111
105
  }
112
106
  }
113
107
 
@@ -125,7 +119,7 @@ static rb_data_type_t grpc_channel_data_type = {
125
119
  static VALUE grpc_rb_channel_alloc(VALUE cls) {
126
120
  grpc_rb_channel *wrapper = ALLOC(grpc_rb_channel);
127
121
  wrapper->wrapped = NULL;
128
- wrapper->mark = Qnil;
122
+ wrapper->credentials = Qnil;
129
123
  return TypedData_Wrap_Struct(cls, &grpc_channel_data_type, wrapper);
130
124
  }
131
125
 
@@ -162,6 +156,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
162
156
  }
163
157
  ch = grpc_insecure_channel_create(target_chars, &args, NULL);
164
158
  } else {
159
+ wrapper->credentials = credentials;
165
160
  creds = grpc_rb_get_wrapped_channel_credentials(credentials);
166
161
  ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
167
162
  }
@@ -330,7 +325,6 @@ static VALUE grpc_rb_channel_destroy(VALUE self) {
330
325
  if (ch != NULL) {
331
326
  grpc_channel_destroy(ch);
332
327
  wrapper->wrapped = NULL;
333
- wrapper->mark = Qnil;
334
328
  }
335
329
 
336
330
  return Qnil;
@@ -49,8 +49,8 @@
49
49
  static VALUE grpc_rb_cChannelCredentials = Qnil;
50
50
 
51
51
  /* grpc_rb_channel_credentials wraps a grpc_channel_credentials. It provides a
52
- * peer ruby object, 'mark' to minimize copying when a credential is
53
- * created from ruby. */
52
+ * mark object that is used to hold references to any objects used to create
53
+ * the credentials. */
54
54
  typedef struct grpc_rb_channel_credentials {
55
55
  /* Holder of ruby objects involved in constructing the credentials */
56
56
  VALUE mark;
@@ -66,13 +66,8 @@ static void grpc_rb_channel_credentials_free(void *p) {
66
66
  return;
67
67
  };
68
68
  wrapper = (grpc_rb_channel_credentials *)p;
69
-
70
- /* Delete the wrapped object if the mark object is Qnil, which indicates that
71
- * no other object is the actual owner. */
72
- if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
73
- grpc_channel_credentials_release(wrapper->wrapped);
74
- wrapper->wrapped = NULL;
75
- }
69
+ grpc_channel_credentials_release(wrapper->wrapped);
70
+ wrapper->wrapped = NULL;
76
71
 
77
72
  xfree(p);
78
73
  }
@@ -85,7 +80,6 @@ static void grpc_rb_channel_credentials_mark(void *p) {
85
80
  }
86
81
  wrapper = (grpc_rb_channel_credentials *)p;
87
82
 
88
- /* If it's not already cleaned up, mark the mark object */
89
83
  if (wrapper->mark != Qnil) {
90
84
  rb_gc_mark(wrapper->mark);
91
85
  }
@@ -114,7 +108,7 @@ static VALUE grpc_rb_channel_credentials_alloc(VALUE cls) {
114
108
  /* Creates a wrapping object for a given channel credentials. This should only
115
109
  * be called with grpc_channel_credentials objects that are not already
116
110
  * associated with any Ruby object. */
117
- VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c) {
111
+ VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c, VALUE mark) {
118
112
  VALUE rb_wrapper;
119
113
  grpc_rb_channel_credentials *wrapper;
120
114
  if (c == NULL) {
@@ -124,6 +118,7 @@ VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c) {
124
118
  TypedData_Get_Struct(rb_wrapper, grpc_rb_channel_credentials,
125
119
  &grpc_rb_channel_credentials_data_type, wrapper);
126
120
  wrapper->wrapped = c;
121
+ wrapper->mark = mark;
127
122
  return rb_wrapper;
128
123
  }
129
124
 
@@ -222,11 +217,15 @@ static VALUE grpc_rb_channel_credentials_compose(int argc, VALUE *argv,
222
217
  VALUE self) {
223
218
  grpc_channel_credentials *creds;
224
219
  grpc_call_credentials *other;
220
+ VALUE mark;
225
221
  if (argc == 0) {
226
222
  return self;
227
223
  }
224
+ mark = rb_ary_new();
225
+ rb_ary_push(mark, self);
228
226
  creds = grpc_rb_get_wrapped_channel_credentials(self);
229
227
  for (int i = 0; i < argc; i++) {
228
+ rb_ary_push(mark, argv[i]);
230
229
  other = grpc_rb_get_wrapped_call_credentials(argv[i]);
231
230
  creds = grpc_composite_channel_credentials_create(creds, other, NULL);
232
231
  if (creds == NULL) {
@@ -234,7 +233,7 @@ static VALUE grpc_rb_channel_credentials_compose(int argc, VALUE *argv,
234
233
  "Failed to compose channel and call credentials");
235
234
  }
236
235
  }
237
- return grpc_rb_wrap_channel_credentials(creds);
236
+ return grpc_rb_wrap_channel_credentials(creds, mark);
238
237
  }
239
238
 
240
239
  void Init_grpc_channel_credentials() {
@@ -269,20 +269,9 @@ static void Init_grpc_time_consts() {
269
269
  id_tv_nsec = rb_intern("tv_nsec");
270
270
  }
271
271
 
272
- /*
273
- TODO: find an alternative to ruby_vm_at_exit that is ok in Ruby 2.0 where
274
- RUBY_TYPED_FREE_IMMEDIATELY is not defined.
275
-
276
- At the moment, registering a function using ruby_vm_at_exit segfaults in Ruby
277
- 2.0. This is not an issue with the gRPC handler. More likely, this was an
278
- in issue with 2.0 that got resolved in 2.1 and has not been backported.
279
- */
280
- #ifdef RUBY_TYPED_FREE_IMMEDIATELY
281
- static void grpc_rb_shutdown(ruby_vm_t *vm) {
282
- (void)vm;
272
+ static void grpc_rb_shutdown(void) {
283
273
  grpc_shutdown();
284
274
  }
285
- #endif
286
275
 
287
276
  /* Initialize the GRPC module structs */
288
277
 
@@ -300,18 +289,30 @@ VALUE sym_code = Qundef;
300
289
  VALUE sym_details = Qundef;
301
290
  VALUE sym_metadata = Qundef;
302
291
 
292
+ static gpr_once g_once_init = GPR_ONCE_INIT;
293
+
294
+ static void grpc_ruby_once_init() {
295
+ grpc_init();
296
+ atexit(grpc_rb_shutdown);
297
+ }
298
+
303
299
  void Init_grpc_c() {
304
300
  if (!grpc_rb_load_core()) {
305
301
  rb_raise(rb_eLoadError, "Couldn't find or load gRPC's dynamic C core");
306
302
  return;
307
303
  }
308
304
 
309
- grpc_init();
310
-
311
- /* TODO: find alternative to ruby_vm_at_exit that is ok in Ruby 2.0 */
312
- #ifdef RUBY_TYPED_FREE_IMMEDIATELY
313
- ruby_vm_at_exit(grpc_rb_shutdown);
314
- #endif
305
+ /* ruby_vm_at_exit doesn't seem to be working. It would crash once every
306
+ * blue moon, and some users are getting it repeatedly. See the discussions
307
+ * - https://github.com/grpc/grpc/pull/5337
308
+ * - https://bugs.ruby-lang.org/issues/12095
309
+ *
310
+ * In order to still be able to handle the (unlikely) situation where the
311
+ * extension is loaded by a first Ruby VM that is subsequently destroyed,
312
+ * then loaded again by another VM within the same process, we need to
313
+ * schedule our initialization and destruction only once.
314
+ */
315
+ gpr_once_init(&g_once_init, grpc_ruby_once_init);
315
316
 
316
317
  grpc_rb_mGRPC = rb_define_module("GRPC");
317
318
  grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core");
@@ -137,6 +137,7 @@ grpc_auth_context_add_cstring_property_type grpc_auth_context_add_cstring_proper
137
137
  grpc_auth_context_set_peer_identity_property_name_type grpc_auth_context_set_peer_identity_property_name_import;
138
138
  grpc_channel_credentials_release_type grpc_channel_credentials_release_import;
139
139
  grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
140
+ grpc_set_ssl_roots_override_callback_type grpc_set_ssl_roots_override_callback_import;
140
141
  grpc_ssl_credentials_create_type grpc_ssl_credentials_create_import;
141
142
  grpc_call_credentials_release_type grpc_call_credentials_release_import;
142
143
  grpc_composite_channel_credentials_create_type grpc_composite_channel_credentials_create_import;
@@ -219,6 +220,7 @@ gpr_event_get_type gpr_event_get_import;
219
220
  gpr_event_wait_type gpr_event_wait_import;
220
221
  gpr_ref_init_type gpr_ref_init_import;
221
222
  gpr_ref_type gpr_ref_import;
223
+ gpr_ref_non_zero_type gpr_ref_non_zero_import;
222
224
  gpr_refn_type gpr_refn_import;
223
225
  gpr_unref_type gpr_unref_import;
224
226
  gpr_stats_init_type gpr_stats_init_import;
@@ -397,6 +399,7 @@ void grpc_rb_load_imports(HMODULE library) {
397
399
  grpc_auth_context_set_peer_identity_property_name_import = (grpc_auth_context_set_peer_identity_property_name_type) GetProcAddress(library, "grpc_auth_context_set_peer_identity_property_name");
398
400
  grpc_channel_credentials_release_import = (grpc_channel_credentials_release_type) GetProcAddress(library, "grpc_channel_credentials_release");
399
401
  grpc_google_default_credentials_create_import = (grpc_google_default_credentials_create_type) GetProcAddress(library, "grpc_google_default_credentials_create");
402
+ grpc_set_ssl_roots_override_callback_import = (grpc_set_ssl_roots_override_callback_type) GetProcAddress(library, "grpc_set_ssl_roots_override_callback");
400
403
  grpc_ssl_credentials_create_import = (grpc_ssl_credentials_create_type) GetProcAddress(library, "grpc_ssl_credentials_create");
401
404
  grpc_call_credentials_release_import = (grpc_call_credentials_release_type) GetProcAddress(library, "grpc_call_credentials_release");
402
405
  grpc_composite_channel_credentials_create_import = (grpc_composite_channel_credentials_create_type) GetProcAddress(library, "grpc_composite_channel_credentials_create");
@@ -479,6 +482,7 @@ void grpc_rb_load_imports(HMODULE library) {
479
482
  gpr_event_wait_import = (gpr_event_wait_type) GetProcAddress(library, "gpr_event_wait");
480
483
  gpr_ref_init_import = (gpr_ref_init_type) GetProcAddress(library, "gpr_ref_init");
481
484
  gpr_ref_import = (gpr_ref_type) GetProcAddress(library, "gpr_ref");
485
+ gpr_ref_non_zero_import = (gpr_ref_non_zero_type) GetProcAddress(library, "gpr_ref_non_zero");
482
486
  gpr_refn_import = (gpr_refn_type) GetProcAddress(library, "gpr_refn");
483
487
  gpr_unref_import = (gpr_unref_type) GetProcAddress(library, "gpr_unref");
484
488
  gpr_stats_init_import = (gpr_stats_init_type) GetProcAddress(library, "gpr_stats_init");
@@ -91,10 +91,10 @@ extern census_context_next_tag_type census_context_next_tag_import;
91
91
  typedef int(*census_context_get_tag_type)(const census_context *context, const char *key, census_tag *tag);
92
92
  extern census_context_get_tag_type census_context_get_tag_import;
93
93
  #define census_context_get_tag census_context_get_tag_import
94
- typedef char *(*census_context_encode_type)(const census_context *context, char *buffer, size_t buf_size, size_t *print_buf_size, size_t *bin_buf_size);
94
+ typedef size_t(*census_context_encode_type)(const census_context *context, char *buffer, size_t buf_size);
95
95
  extern census_context_encode_type census_context_encode_import;
96
96
  #define census_context_encode census_context_encode_import
97
- typedef census_context *(*census_context_decode_type)(const char *buffer, size_t size, const char *bin_buffer, size_t bin_size);
97
+ typedef census_context *(*census_context_decode_type)(const char *buffer, size_t size);
98
98
  extern census_context_decode_type census_context_decode_import;
99
99
  #define census_context_decode census_context_decode_import
100
100
  typedef int(*census_trace_mask_type)(const census_context *context);
@@ -361,6 +361,9 @@ extern grpc_channel_credentials_release_type grpc_channel_credentials_release_im
361
361
  typedef grpc_channel_credentials *(*grpc_google_default_credentials_create_type)(void);
362
362
  extern grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
363
363
  #define grpc_google_default_credentials_create grpc_google_default_credentials_create_import
364
+ typedef void(*grpc_set_ssl_roots_override_callback_type)(grpc_ssl_roots_override_callback cb);
365
+ extern grpc_set_ssl_roots_override_callback_type grpc_set_ssl_roots_override_callback_import;
366
+ #define grpc_set_ssl_roots_override_callback grpc_set_ssl_roots_override_callback_import
364
367
  typedef grpc_channel_credentials *(*grpc_ssl_credentials_create_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair, void *reserved);
365
368
  extern grpc_ssl_credentials_create_type grpc_ssl_credentials_create_import;
366
369
  #define grpc_ssl_credentials_create grpc_ssl_credentials_create_import
@@ -607,6 +610,9 @@ extern gpr_ref_init_type gpr_ref_init_import;
607
610
  typedef void(*gpr_ref_type)(gpr_refcount *r);
608
611
  extern gpr_ref_type gpr_ref_import;
609
612
  #define gpr_ref gpr_ref_import
613
+ typedef void(*gpr_ref_non_zero_type)(gpr_refcount *r);
614
+ extern gpr_ref_non_zero_type gpr_ref_non_zero_import;
615
+ #define gpr_ref_non_zero gpr_ref_non_zero_import
610
616
  typedef void(*gpr_refn_type)(gpr_refcount *r, int n);
611
617
  extern gpr_refn_type gpr_refn_import;
612
618
  #define gpr_refn gpr_refn_import
@@ -1,4 +1,4 @@
1
- # Copyright 2015, Google Inc.
1
+ # Copyright 2015-2016, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc'
30
+ require 'grpc/grpc'
31
31
 
32
32
  # GRPC contains the General RPC module.
33
33
  module GRPC
@@ -1,4 +1,4 @@
1
- # Copyright 2015, Google Inc.
1
+ # Copyright 2015-2016, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- require 'grpc'
30
+ require 'grpc/grpc'
31
31
 
32
32
  # GRPC contains the General RPC module.
33
33
  module GRPC
@@ -107,7 +107,9 @@ module GRPC
107
107
 
108
108
  # Starts running the jobs in the thread pool.
109
109
  def start
110
- fail 'already stopped' if @stopped
110
+ @stop_mutex.synchronize do
111
+ fail 'already stopped' if @stopped
112
+ end
111
113
  until @workers.size == @size.to_i
112
114
  next_thread = Thread.new do
113
115
  catch(:exit) do # allows { throw :exit } to kill a thread
@@ -264,10 +266,10 @@ module GRPC
264
266
  @pool = Pool.new(@pool_size)
265
267
  @run_cond = ConditionVariable.new
266
268
  @run_mutex = Mutex.new
267
- @running = false
269
+ # running_state can take 4 values: :not_started, :running, :stopping, and
270
+ # :stopped. State transitions can only proceed in that order.
271
+ @running_state = :not_started
268
272
  @server = RpcServer.setup_srv(server_override, @cq, **kw)
269
- @stopped = false
270
- @stop_mutex = Mutex.new
271
273
  end
272
274
 
273
275
  # stops a running server
@@ -275,27 +277,42 @@ module GRPC
275
277
  # the call has no impact if the server is already stopped, otherwise
276
278
  # server's current call loop is it's last.
277
279
  def stop
278
- return unless @running
279
- @stop_mutex.synchronize do
280
- @stopped = true
280
+ @run_mutex.synchronize do
281
+ fail 'Cannot stop before starting' if @running_state == :not_started
282
+ return if @running_state != :running
283
+ transition_running_state(:stopping)
281
284
  end
282
285
  deadline = from_relative_time(@poll_period)
283
- return if @server.close(@cq, deadline)
284
- deadline = from_relative_time(@poll_period)
285
286
  @server.close(@cq, deadline)
286
287
  @pool.stop
287
288
  end
288
289
 
289
- # determines if the server has been stopped
290
- def stopped?
291
- @stop_mutex.synchronize do
292
- return @stopped
290
+ def running_state
291
+ @run_mutex.synchronize do
292
+ return @running_state
293
+ end
294
+ end
295
+
296
+ # Can only be called while holding @run_mutex
297
+ def transition_running_state(target_state)
298
+ state_transitions = {
299
+ not_started: :running,
300
+ running: :stopping,
301
+ stopping: :stopped
302
+ }
303
+ if state_transitions[@running_state] == target_state
304
+ @running_state = target_state
305
+ else
306
+ fail "Bad server state transition: #{@running_state}->#{target_state}"
293
307
  end
294
308
  end
295
309
 
296
- # determines if the server is currently running
297
310
  def running?
298
- @running
311
+ running_state == :running
312
+ end
313
+
314
+ def stopped?
315
+ running_state == :stopped
299
316
  end
300
317
 
301
318
  # Is called from other threads to wait for #run to start up the server.
@@ -304,13 +321,11 @@ module GRPC
304
321
  #
305
322
  # @param timeout [Numeric] number of seconds to wait
306
323
  # @result [true, false] true if the server is running, false otherwise
307
- def wait_till_running(timeout = 0.1)
308
- end_time, sleep_period = Time.now + timeout, (1.0 * timeout) / 100
309
- while Time.now < end_time
310
- @run_mutex.synchronize { @run_cond.wait(@run_mutex) } unless running?
311
- sleep(sleep_period)
324
+ def wait_till_running(timeout = nil)
325
+ @run_mutex.synchronize do
326
+ @run_cond.wait(@run_mutex, timeout) if @running_state == :not_started
327
+ return @running_state == :running
312
328
  end
313
- running?
314
329
  end
315
330
 
316
331
  # Runs the server in its own thread, then waits for signal INT or TERM on
@@ -360,11 +375,14 @@ module GRPC
360
375
  # @param service [Object|Class] a service class or object as described
361
376
  # above
362
377
  def handle(service)
363
- fail 'cannot add services if the server is running' if running?
364
- fail 'cannot add services if the server is stopped' if stopped?
365
- cls = service.is_a?(Class) ? service : service.class
366
- assert_valid_service_class(cls)
367
- add_rpc_descs_for(service)
378
+ @run_mutex.synchronize do
379
+ unless @running_state == :not_started
380
+ fail 'cannot add services if the server has been started'
381
+ end
382
+ cls = service.is_a?(Class) ? service : service.class
383
+ assert_valid_service_class(cls)
384
+ add_rpc_descs_for(service)
385
+ end
368
386
  end
369
387
 
370
388
  # runs the server
@@ -375,16 +393,13 @@ module GRPC
375
393
  # - #running? returns true after this is called, until #stop cause the
376
394
  # the server to stop.
377
395
  def run
378
- if rpc_descs.size.zero?
379
- GRPC.logger.warn('did not run as no services were present')
380
- return
381
- end
382
396
  @run_mutex.synchronize do
383
- @running = true
384
- @run_cond.signal
397
+ fail 'cannot run without registering services' if rpc_descs.size.zero?
398
+ @pool.start
399
+ @server.start
400
+ transition_running_state(:running)
401
+ @run_cond.broadcast
385
402
  end
386
- @pool.start
387
- @server.start
388
403
  loop_handle_server_calls
389
404
  end
390
405
 
@@ -413,9 +428,9 @@ module GRPC
413
428
 
414
429
  # handles calls to the server
415
430
  def loop_handle_server_calls
416
- fail 'not running' unless @running
431
+ fail 'not started' if running_state == :not_started
417
432
  loop_tag = Object.new
418
- until stopped?
433
+ while running_state == :running
419
434
  begin
420
435
  an_rpc = @server.request_call(@cq, loop_tag, INFINITE_FUTURE)
421
436
  break if (!an_rpc.nil?) && an_rpc.call.nil?
@@ -430,11 +445,14 @@ module GRPC
430
445
  rescue Core::CallError, RuntimeError => e
431
446
  # these might happen for various reasonse. The correct behaviour of
432
447
  # the server is to log them and continue, if it's not shutting down.
433
- GRPC.logger.warn("server call failed: #{e}") unless stopped?
448
+ if running_state == :running
449
+ GRPC.logger.warn("server call failed: #{e}")
450
+ end
434
451
  next
435
452
  end
436
453
  end
437
- @running = false
454
+ # @running_state should be :stopping here
455
+ @run_mutex.synchronize { transition_running_state(:stopped) }
438
456
  GRPC.logger.info("stopped: #{self}")
439
457
  end
440
458
 
@@ -484,9 +502,10 @@ module GRPC
484
502
  cls.assert_rpc_descs_have_methods
485
503
  end
486
504
 
505
+ # This should be called while holding @run_mutex
487
506
  def add_rpc_descs_for(service)
488
507
  cls = service.is_a?(Class) ? service : service.class
489
- specs, handlers = rpc_descs, rpc_handlers
508
+ specs, handlers = (@rpc_descs ||= {}), (@rpc_handlers ||= {})
490
509
  cls.rpc_descs.each_pair do |name, spec|
491
510
  route = "/#{cls.service_name}/#{name}".to_sym
492
511
  fail "already registered: rpc #{route} from #{spec}" if specs.key? route
Binary file
@@ -29,5 +29,5 @@
29
29
 
30
30
  # GRPC contains the General RPC module.
31
31
  module GRPC
32
- VERSION = '0.13.0'
32
+ VERSION = '0.13.1.pre1'
33
33
  end
@@ -11,7 +11,7 @@ The code is is generated using the protoc (> 3.0.0.alpha.1) and the
11
11
  grpc_ruby_plugin. These must be installed to regenerate the IDL defined
12
12
  classes, but that's not necessary just to use them.
13
13
 
14
- health_check/v1alpha
14
+ health_check/v1
15
15
  --------------------
16
16
 
17
17
  This package defines the surface of a simple health check service that gRPC
@@ -20,7 +20,7 @@ re-generate the surface.
20
20
 
21
21
  ```bash
22
22
  $ # (from this directory)
23
- $ protoc -I ../../proto ../../proto/grpc/health/v1alpha/health.proto \
23
+ $ protoc -I ../../proto ../../proto/grpc/health/v1/health.proto \
24
24
  --grpc_out=. \
25
25
  --ruby_out=. \
26
26
  --plugin=protoc-gen-grpc=`which grpc_ruby_plugin`
@@ -1,5 +1,5 @@
1
1
  #!/bin/sh
2
- # Copyright 2015, Google Inc.
2
+ # Copyright 2015-2016, Google Inc.
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ cd $(dirname $0)/../../..
35
35
  PROTOC=bins/opt/protobuf/protoc
36
36
  PLUGIN=protoc-gen-grpc=bins/opt/grpc_ruby_plugin
37
37
 
38
- $PROTOC -I src/proto src/proto/grpc/health/v1alpha/health.proto \
38
+ $PROTOC -I src/proto src/proto/grpc/health/v1/health.proto \
39
39
  --grpc_out=src/ruby/pb \
40
40
  --ruby_out=src/ruby/pb \
41
41
  --plugin=$PLUGIN
@@ -1,4 +1,4 @@
1
- # Copyright 2015, Google Inc.
1
+ # Copyright 2015-2016, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
  require 'grpc'
31
- require 'grpc/health/v1alpha/health_services'
31
+ require 'grpc/health/v1/health_services'
32
32
  require 'thread'
33
33
 
34
34
  module Grpc
@@ -36,9 +36,9 @@ module Grpc
36
36
  # service.
37
37
  module Health
38
38
  # Checker is implementation of the schema-specified health checking service.
39
- class Checker < V1alpha::Health::Service
39
+ class Checker < V1::Health::Service
40
40
  StatusCodes = GRPC::Core::StatusCodes
41
- HealthCheckResponse = V1alpha::HealthCheckResponse
41
+ HealthCheckResponse = V1::HealthCheckResponse
42
42
 
43
43
  # Initializes the statuses of participating services
44
44
  def initialize
@@ -50,20 +50,20 @@ module Grpc
50
50
  def check(req, _call)
51
51
  status = nil
52
52
  @status_mutex.synchronize do
53
- status = @statuses["#{req.host}/#{req.service}"]
53
+ status = @statuses["#{req.service}"]
54
54
  end
55
55
  fail GRPC::BadStatus, StatusCodes::NOT_FOUND if status.nil?
56
56
  HealthCheckResponse.new(status: status)
57
57
  end
58
58
 
59
- # Adds the health status for a given host and service.
60
- def add_status(host, service, status)
61
- @status_mutex.synchronize { @statuses["#{host}/#{service}"] = status }
59
+ # Adds the health status for a given service.
60
+ def add_status(service, status)
61
+ @status_mutex.synchronize { @statuses["#{service}"] = status }
62
62
  end
63
63
 
64
- # Clears the status for the given host or service.
65
- def clear_status(host, service)
66
- @status_mutex.synchronize { @statuses.delete("#{host}/#{service}") }
64
+ # Clears the status for the given service.
65
+ def clear_status(service)
66
+ @status_mutex.synchronize { @statuses.delete("#{service}") }
67
67
  end
68
68
 
69
69
  # Clears alls the statuses.
@@ -0,0 +1,28 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: grpc/health/v1/health.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "grpc.health.v1.HealthCheckRequest" do
8
+ optional :service, :string, 1
9
+ end
10
+ add_message "grpc.health.v1.HealthCheckResponse" do
11
+ optional :status, :enum, 1, "grpc.health.v1.HealthCheckResponse.ServingStatus"
12
+ end
13
+ add_enum "grpc.health.v1.HealthCheckResponse.ServingStatus" do
14
+ value :UNKNOWN, 0
15
+ value :SERVING, 1
16
+ value :NOT_SERVING, 2
17
+ end
18
+ end
19
+
20
+ module Grpc
21
+ module Health
22
+ module V1
23
+ HealthCheckRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckRequest").msgclass
24
+ HealthCheckResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse").msgclass
25
+ HealthCheckResponse::ServingStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse.ServingStatus").enummodule
26
+ end
27
+ end
28
+ end
@@ -1,12 +1,12 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # Source: grpc/health/v1alpha/health.proto for package 'grpc.health.v1alpha'
2
+ # Source: grpc/health/v1/health.proto for package 'grpc.health.v1'
3
3
 
4
4
  require 'grpc'
5
- require 'grpc/health/v1alpha/health'
5
+ require 'grpc/health/v1/health'
6
6
 
7
7
  module Grpc
8
8
  module Health
9
- module V1alpha
9
+ module V1
10
10
  module Health
11
11
 
12
12
  # TODO: add proto service documentation here
@@ -16,7 +16,7 @@ module Grpc
16
16
 
17
17
  self.marshal_class_method = :encode
18
18
  self.unmarshal_class_method = :decode
19
- self.service_name = 'grpc.health.v1alpha.Health'
19
+ self.service_name = 'grpc.health.v1.Health'
20
20
 
21
21
  rpc :Check, HealthCheckRequest, HealthCheckResponse
22
22
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2015, Google Inc.
1
+ # Copyright 2015-2016, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -198,6 +198,7 @@ shared_examples 'basic GRPC message delivery is OK' do
198
198
  # confirm the client can receive the server response and status.
199
199
  client_ops = {
200
200
  CallOps::SEND_CLOSE_FROM_CLIENT => nil,
201
+ CallOps::RECV_INITIAL_METADATA => nil,
201
202
  CallOps::RECV_MESSAGE => nil,
202
203
  CallOps::RECV_STATUS_ON_CLIENT => nil
203
204
  }
@@ -1,4 +1,4 @@
1
- # Copyright 2015, Google Inc.
1
+ # Copyright 2015-2016, Google Inc.
2
2
  # All rights reserved.
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -220,19 +220,10 @@ describe GRPC::RpcServer do
220
220
  @srv = RpcServer.new(**opts)
221
221
  end
222
222
 
223
- after(:each) do
224
- @srv.stop
225
- end
226
-
227
223
  it 'starts out false' do
228
224
  expect(@srv.stopped?).to be(false)
229
225
  end
230
226
 
231
- it 'stays false after a #stop is called before #run' do
232
- @srv.stop
233
- expect(@srv.stopped?).to be(false)
234
- end
235
-
236
227
  it 'stays false after the server starts running', server: true do
237
228
  @srv.handle(EchoService)
238
229
  t = Thread.new { @srv.run }
@@ -247,8 +238,8 @@ describe GRPC::RpcServer do
247
238
  t = Thread.new { @srv.run }
248
239
  @srv.wait_till_running
249
240
  @srv.stop
250
- expect(@srv.stopped?).to be(true)
251
241
  t.join
242
+ expect(@srv.stopped?).to be(true)
252
243
  end
253
244
  end
254
245
 
@@ -266,9 +257,7 @@ describe GRPC::RpcServer do
266
257
  server_override: @server
267
258
  }
268
259
  r = RpcServer.new(**opts)
269
- r.run
270
- expect(r.running?).to be(false)
271
- r.stop
260
+ expect { r.run }.to raise_error(RuntimeError)
272
261
  end
273
262
 
274
263
  it 'is true after run is called with a registered service' do
@@ -293,10 +282,6 @@ describe GRPC::RpcServer do
293
282
  @srv = RpcServer.new(**@opts)
294
283
  end
295
284
 
296
- after(:each) do
297
- @srv.stop
298
- end
299
-
300
285
  it 'raises if #run has already been called' do
301
286
  @srv.handle(EchoService)
302
287
  t = Thread.new { @srv.run }
@@ -528,10 +513,6 @@ describe GRPC::RpcServer do
528
513
  @srv = RpcServer.new(**server_opts)
529
514
  end
530
515
 
531
- after(:each) do
532
- @srv.stop
533
- end
534
-
535
516
  it 'should be added to BadStatus when requests fail', server: true do
536
517
  service = FailingService.new
537
518
  @srv.handle(service)
@@ -28,7 +28,7 @@
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
  require 'grpc'
31
- require 'grpc/health/v1alpha/health'
31
+ require 'grpc/health/v1/health'
32
32
  require 'grpc/health/checker'
33
33
  require 'open3'
34
34
  require 'tmpdir'
@@ -43,7 +43,7 @@ describe 'Health protobuf code generation' do
43
43
  skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen'
44
44
  else
45
45
  it 'should already be loaded indirectly i.e, used by the other specs' do
46
- expect(require('grpc/health/v1alpha/health_services')).to be(false)
46
+ expect(require('grpc/health/v1/health_services')).to be(false)
47
47
  end
48
48
 
49
49
  it 'should have the same content as created by code generation' do
@@ -52,7 +52,7 @@ describe 'Health protobuf code generation' do
52
52
 
53
53
  # Get the current content
54
54
  service_path = File.join(root_dir, 'ruby', 'pb', 'grpc',
55
- 'health', 'v1alpha', 'health_services.rb')
55
+ 'health', 'v1', 'health_services.rb')
56
56
  want = nil
57
57
  File.open(service_path) { |f| want = f.read }
58
58
 
@@ -61,12 +61,12 @@ describe 'Health protobuf code generation' do
61
61
  plugin = plugin.strip
62
62
  got = nil
63
63
  Dir.mktmpdir do |tmp_dir|
64
- gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1alpha',
64
+ gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1',
65
65
  'health_services.rb')
66
66
  pid = spawn(
67
67
  'protoc',
68
68
  '-I.',
69
- 'grpc/health/v1alpha/health.proto',
69
+ 'grpc/health/v1/health.proto',
70
70
  "--grpc_out=#{tmp_dir}",
71
71
  "--plugin=protoc-gen-grpc=#{plugin}",
72
72
  chdir: pb_dir)
@@ -81,27 +81,17 @@ end
81
81
 
82
82
  describe Grpc::Health::Checker do
83
83
  StatusCodes = GRPC::Core::StatusCodes
84
- ServingStatus = Grpc::Health::V1alpha::HealthCheckResponse::ServingStatus
85
- HCResp = Grpc::Health::V1alpha::HealthCheckResponse
86
- HCReq = Grpc::Health::V1alpha::HealthCheckRequest
84
+ ServingStatus = Grpc::Health::V1::HealthCheckResponse::ServingStatus
85
+ HCResp = Grpc::Health::V1::HealthCheckResponse
86
+ HCReq = Grpc::Health::V1::HealthCheckRequest
87
87
  success_tests =
88
88
  [
89
89
  {
90
- desc: 'neither host or service are specified',
91
- host: '',
90
+ desc: 'the service is not specified',
92
91
  service: ''
93
92
  }, {
94
- desc: 'only the host is specified',
95
- host: 'test-fake-host',
96
- service: ''
97
- }, {
98
- desc: 'the host and service are specified',
99
- host: 'test-fake-host',
93
+ desc: 'the service is specified',
100
94
  service: 'fake-service-1'
101
- }, {
102
- desc: 'only the service is specified',
103
- host: '',
104
- service: 'fake-service-2'
105
95
  }
106
96
  ]
107
97
 
@@ -114,9 +104,8 @@ describe Grpc::Health::Checker do
114
104
  context 'method `add_status` and `check`' do
115
105
  success_tests.each do |t|
116
106
  it "should succeed when #{t[:desc]}" do
117
- subject.add_status(t[:host], t[:service], ServingStatus::NOT_SERVING)
118
- got = subject.check(HCReq.new(host: t[:host], service: t[:service]),
119
- nil)
107
+ subject.add_status(t[:service], ServingStatus::NOT_SERVING)
108
+ got = subject.check(HCReq.new(service: t[:service]), nil)
120
109
  want = HCResp.new(status: ServingStatus::NOT_SERVING)
121
110
  expect(got).to eq(want)
122
111
  end
@@ -127,7 +116,7 @@ describe Grpc::Health::Checker do
127
116
  success_tests.each do |t|
128
117
  it "should fail with NOT_FOUND when #{t[:desc]}" do
129
118
  blk = proc do
130
- subject.check(HCReq.new(host: t[:host], service: t[:service]), nil)
119
+ subject.check(HCReq.new(service: t[:service]), nil)
131
120
  end
132
121
  expected_msg = /#{StatusCodes::NOT_FOUND}/
133
122
  expect(&blk).to raise_error GRPC::BadStatus, expected_msg
@@ -138,16 +127,14 @@ describe Grpc::Health::Checker do
138
127
  context 'method `clear_status`' do
139
128
  success_tests.each do |t|
140
129
  it "should fail after clearing status when #{t[:desc]}" do
141
- subject.add_status(t[:host], t[:service], ServingStatus::NOT_SERVING)
142
- got = subject.check(HCReq.new(host: t[:host], service: t[:service]),
143
- nil)
130
+ subject.add_status(t[:service], ServingStatus::NOT_SERVING)
131
+ got = subject.check(HCReq.new(service: t[:service]), nil)
144
132
  want = HCResp.new(status: ServingStatus::NOT_SERVING)
145
133
  expect(got).to eq(want)
146
134
 
147
- subject.clear_status(t[:host], t[:service])
135
+ subject.clear_status(t[:service])
148
136
  blk = proc do
149
- subject.check(HCReq.new(host: t[:host], service: t[:service]),
150
- nil)
137
+ subject.check(HCReq.new(service: t[:service]), nil)
151
138
  end
152
139
  expected_msg = /#{StatusCodes::NOT_FOUND}/
153
140
  expect(&blk).to raise_error GRPC::BadStatus, expected_msg
@@ -158,9 +145,8 @@ describe Grpc::Health::Checker do
158
145
  context 'method `clear_all`' do
159
146
  it 'should return NOT_FOUND after being invoked' do
160
147
  success_tests.each do |t|
161
- subject.add_status(t[:host], t[:service], ServingStatus::NOT_SERVING)
162
- got = subject.check(HCReq.new(host: t[:host], service: t[:service]),
163
- nil)
148
+ subject.add_status(t[:service], ServingStatus::NOT_SERVING)
149
+ got = subject.check(HCReq.new(service: t[:service]), nil)
164
150
  want = HCResp.new(status: ServingStatus::NOT_SERVING)
165
151
  expect(got).to eq(want)
166
152
  end
@@ -169,7 +155,7 @@ describe Grpc::Health::Checker do
169
155
 
170
156
  success_tests.each do |t|
171
157
  blk = proc do
172
- subject.check(HCReq.new(host: t[:host], service: t[:service]), nil)
158
+ subject.check(HCReq.new(service: t[:service]), nil)
173
159
  end
174
160
  expected_msg = /#{StatusCodes::NOT_FOUND}/
175
161
  expect(&blk).to raise_error GRPC::BadStatus, expected_msg
@@ -203,7 +189,7 @@ describe Grpc::Health::Checker do
203
189
 
204
190
  it 'should receive the correct status', server: true do
205
191
  @srv.handle(subject)
206
- subject.add_status('', '', ServingStatus::NOT_SERVING)
192
+ subject.add_status('', ServingStatus::NOT_SERVING)
207
193
  t = Thread.new { @srv.run }
208
194
  @srv.wait_till_running
209
195
 
@@ -221,7 +207,7 @@ describe Grpc::Health::Checker do
221
207
  @srv.wait_till_running
222
208
  blk = proc do
223
209
  stub = CheckerStub.new(@host, :this_channel_is_insecure, **@client_opts)
224
- stub.check(HCReq.new(host: 'unknown', service: 'unknown'))
210
+ stub.check(HCReq.new(service: 'unknown'))
225
211
  end
226
212
  expected_msg = /#{StatusCodes::NOT_FOUND}/
227
213
  expect(&blk).to raise_error GRPC::BadStatus, expected_msg
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1.pre1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2016-02-13 00:00:00.000000000 Z
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0.alpha.5.0.2
19
+ version: 3.0.0.alpha.5.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.0.alpha.5.0.2
26
+ version: 3.0.0.alpha.5.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: googleauth
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -241,8 +241,8 @@ files:
241
241
  - src/ruby/pb/README.md
242
242
  - src/ruby/pb/generate_proto_ruby.sh
243
243
  - src/ruby/pb/grpc/health/checker.rb
244
- - src/ruby/pb/grpc/health/v1alpha/health.rb
245
- - src/ruby/pb/grpc/health/v1alpha/health_services.rb
244
+ - src/ruby/pb/grpc/health/v1/health.rb
245
+ - src/ruby/pb/grpc/health/v1/health_services.rb
246
246
  - src/ruby/pb/test/client.rb
247
247
  - src/ruby/pb/test/proto/empty.rb
248
248
  - src/ruby/pb/test/proto/messages.rb
@@ -287,9 +287,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
287
  version: 2.0.0
288
288
  required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  requirements:
290
- - - ">="
290
+ - - ">"
291
291
  - !ruby/object:Gem::Version
292
- version: '0'
292
+ version: 1.3.1
293
293
  requirements: []
294
294
  rubyforge_project:
295
295
  rubygems_version: 2.5.1
@@ -1,29 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: grpc/health/v1alpha/health.proto
3
-
4
- require 'google/protobuf'
5
-
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_message "grpc.health.v1alpha.HealthCheckRequest" do
8
- optional :host, :string, 1
9
- optional :service, :string, 2
10
- end
11
- add_message "grpc.health.v1alpha.HealthCheckResponse" do
12
- optional :status, :enum, 1, "grpc.health.v1alpha.HealthCheckResponse.ServingStatus"
13
- end
14
- add_enum "grpc.health.v1alpha.HealthCheckResponse.ServingStatus" do
15
- value :UNKNOWN, 0
16
- value :SERVING, 1
17
- value :NOT_SERVING, 2
18
- end
19
- end
20
-
21
- module Grpc
22
- module Health
23
- module V1alpha
24
- HealthCheckRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckRequest").msgclass
25
- HealthCheckResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckResponse").msgclass
26
- HealthCheckResponse::ServingStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckResponse.ServingStatus").enummodule
27
- end
28
- end
29
- end