grpc 1.30.0-x64-mingw32 → 1.31.1-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
  SHA256:
3
- metadata.gz: 754a53a7e009839e75aefb663287461da7c06eecf48952483ab66e617470f4e3
4
- data.tar.gz: debd514d89efac1ea3fd122e0773dcc246842cb47f92a5966737941e2974cbb5
3
+ metadata.gz: faafeab65f5353ca0f444b65537cdbb1a34384f89b92b7c9ba192afed73da765
4
+ data.tar.gz: bb5534b9c08e59ea17561cf4b7aae6100427254e5c2dfc96bda0d53d895ab701
5
5
  SHA512:
6
- metadata.gz: 55813470e26f3d9c2f1520d27a07234e3ecc6db59082061d7032ec946afe4b02bc66afd924f102a3ce06db9f3ebcb59470a695ef8caa6a4a986313001f977ef9
7
- data.tar.gz: f0a32b5962795b4b7a53ecfe96ebb0489c22ff0587392cfa789c1a8eda6da48438df43d31fe0c87d8cf2514ca6a4827640cb5ccddb09c76c3a3be59e14962c9f
6
+ metadata.gz: f2f0d8339c2bffa0b6bcdbd73e9529f620047ac0e680e0dd26945e3b03598ca72289bb506936756b14b21a12428eb82264067175b5f4d1f6c58ee94cbb9efcb4
7
+ data.tar.gz: 68e0ae63814b10ecd954babb88511a74e5c1071da2e476b83a86f1e1adb55b547377b6d3b7bdc566ba6075d9f7ec1d495c7e588df09152e761d88af74fc64b1b
Binary file
Binary file
@@ -31,19 +31,19 @@ module Math
31
31
 
32
32
  # Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
33
33
  # and remainder.
34
- rpc :Div, DivArgs, DivReply
34
+ rpc :Div, ::Math::DivArgs, ::Math::DivReply
35
35
  # DivMany accepts an arbitrary number of division args from the client stream
36
36
  # and sends back the results in the reply stream. The stream continues until
37
37
  # the client closes its end; the server does the same after sending all the
38
38
  # replies. The stream ends immediately if either end aborts.
39
- rpc :DivMany, stream(DivArgs), stream(DivReply)
39
+ rpc :DivMany, stream(::Math::DivArgs), stream(::Math::DivReply)
40
40
  # Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
41
41
  # generates up to limit numbers; otherwise it continues until the call is
42
42
  # canceled. Unlike Fib above, Fib has no final FibReply.
43
- rpc :Fib, FibArgs, stream(Num)
43
+ rpc :Fib, ::Math::FibArgs, stream(::Math::Num)
44
44
  # Sum sums a stream of numbers, returning the final result once the stream
45
45
  # is closed.
46
- rpc :Sum, stream(Num), Num
46
+ rpc :Sum, stream(::Math::Num), ::Math::Num
47
47
  end
48
48
 
49
49
  Stub = Service.rpc_stub_class
@@ -25,7 +25,7 @@ grpc_config = ENV['GRPC_CONFIG'] || 'opt'
25
25
  ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
26
26
 
27
27
  if ENV['AR'].nil? || ENV['AR'].size == 0
28
- ENV['AR'] = RbConfig::CONFIG['AR'] + ' rcs'
28
+ ENV['AR'] = RbConfig::CONFIG['AR']
29
29
  end
30
30
  if ENV['CC'].nil? || ENV['CC'].size == 0
31
31
  ENV['CC'] = RbConfig::CONFIG['CC']
@@ -37,7 +37,10 @@ if ENV['LD'].nil? || ENV['LD'].size == 0
37
37
  ENV['LD'] = ENV['CC']
38
38
  end
39
39
 
40
- ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/
40
+ if RUBY_PLATFORM =~ /darwin/
41
+ ENV['AR'] = 'libtool'
42
+ ENV['ARFLAGS'] = '-o'
43
+ end
41
44
 
42
45
  ENV['EMBED_OPENSSL'] = 'true'
43
46
  ENV['EMBED_ZLIB'] = 'true'
@@ -48,7 +48,7 @@ static VALUE grpc_rb_sBatchResult;
48
48
 
49
49
  /* grpc_rb_cMdAry is the MetadataArray class whose instances proxy
50
50
  * grpc_metadata_array. */
51
- static VALUE grpc_rb_cMdAry;
51
+ VALUE grpc_rb_cMdAry;
52
52
 
53
53
  /* id_credentials is the name of the hidden ivar that preserves the value
54
54
  * of the credentials added to the call */
@@ -103,7 +103,7 @@ static void grpc_rb_call_destroy(void* p) {
103
103
  xfree(p);
104
104
  }
105
105
 
106
- static const rb_data_type_t grpc_rb_md_ary_data_type = {
106
+ const rb_data_type_t grpc_rb_md_ary_data_type = {
107
107
  "grpc_metadata_array",
108
108
  {GRPC_RB_GC_NOT_MARKED,
109
109
  GRPC_RB_GC_DONT_FREE,
@@ -489,6 +489,7 @@ static int grpc_rb_md_ary_capacity_hash_cb(VALUE key, VALUE val,
489
489
 
490
490
  /* grpc_rb_md_ary_convert converts a ruby metadata hash into
491
491
  a grpc_metadata_array.
492
+ Note that this function may throw exceptions.
492
493
  */
493
494
  void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array* md_ary) {
494
495
  VALUE md_ary_obj = Qnil;
@@ -23,6 +23,10 @@
23
23
 
24
24
  #include <grpc/grpc.h>
25
25
 
26
+ extern const rb_data_type_t grpc_rb_md_ary_data_type;
27
+
28
+ extern VALUE grpc_rb_cMdAry;
29
+
26
30
  /* Gets the wrapped call from a VALUE. */
27
31
  grpc_call* grpc_rb_get_wrapped_call(VALUE v);
28
32
 
@@ -54,10 +54,41 @@ typedef struct callback_params {
54
54
  grpc_credentials_plugin_metadata_cb callback;
55
55
  } callback_params;
56
56
 
57
- static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
57
+ static VALUE grpc_rb_call_credentials_callback(VALUE args) {
58
58
  VALUE result = rb_hash_new();
59
- VALUE metadata = rb_funcall(rb_ary_entry(callback_args, 0), rb_intern("call"),
60
- 1, rb_ary_entry(callback_args, 1));
59
+ VALUE callback_func = rb_ary_entry(args, 0);
60
+ VALUE callback_args = rb_ary_entry(args, 1);
61
+ VALUE md_ary_obj = rb_ary_entry(args, 2);
62
+ if (gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
63
+ VALUE callback_func_str = rb_funcall(callback_func, rb_intern("to_s"), 0);
64
+ VALUE callback_args_str = rb_funcall(callback_args, rb_intern("to_s"), 0);
65
+ VALUE callback_source_info =
66
+ rb_funcall(callback_func, rb_intern("source_location"), 0);
67
+ if (callback_source_info != Qnil) {
68
+ VALUE source_filename = rb_ary_entry(callback_source_info, 0);
69
+ VALUE source_line_number = rb_funcall(
70
+ rb_ary_entry(callback_source_info, 1), rb_intern("to_s"), 0);
71
+ gpr_log(GPR_DEBUG,
72
+ "GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
73
+ "source_filename:%s line_number:%s with arguments:|%s|",
74
+ StringValueCStr(callback_func_str),
75
+ StringValueCStr(source_filename),
76
+ StringValueCStr(source_line_number),
77
+ StringValueCStr(callback_args_str));
78
+ } else {
79
+ gpr_log(GPR_DEBUG,
80
+ "GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
81
+ "(failed to get source filename and line) with arguments:|%s|",
82
+ StringValueCStr(callback_func_str),
83
+ StringValueCStr(callback_args_str));
84
+ }
85
+ }
86
+ VALUE metadata =
87
+ rb_funcall(callback_func, rb_intern("call"), 1, callback_args);
88
+ grpc_metadata_array* md_ary = NULL;
89
+ TypedData_Get_Struct(md_ary_obj, grpc_metadata_array,
90
+ &grpc_rb_md_ary_data_type, md_ary);
91
+ grpc_rb_md_ary_convert(metadata, md_ary);
61
92
  rb_hash_aset(result, rb_str_new2("metadata"), metadata);
62
93
  rb_hash_aset(result, rb_str_new2("status"), INT2NUM(GRPC_STATUS_OK));
63
94
  rb_hash_aset(result, rb_str_new2("details"), rb_str_new2(""));
@@ -67,14 +98,23 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
67
98
  static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
68
99
  VALUE exception_object) {
69
100
  VALUE result = rb_hash_new();
70
- VALUE backtrace =
71
- rb_funcall(rb_funcall(exception_object, rb_intern("backtrace"), 0),
72
- rb_intern("join"), 1, rb_str_new2("\n\tfrom "));
101
+ VALUE backtrace = rb_funcall(exception_object, rb_intern("backtrace"), 0);
102
+ VALUE backtrace_str;
103
+ if (backtrace != Qnil) {
104
+ backtrace_str =
105
+ rb_funcall(backtrace, rb_intern("join"), 1, rb_str_new2("\n\tfrom "));
106
+ } else {
107
+ backtrace_str = rb_str_new2(
108
+ "failed to get backtrace, this exception was likely thrown from native "
109
+ "code");
110
+ }
73
111
  VALUE rb_exception_info =
74
112
  rb_funcall(exception_object, rb_intern("inspect"), 0);
75
113
  (void)args;
76
- gpr_log(GPR_INFO, "Call credentials callback failed: %s\n%s",
77
- StringValueCStr(rb_exception_info), StringValueCStr(backtrace));
114
+ gpr_log(GPR_INFO,
115
+ "GRPC_RUBY call credentials callback failed, exception inspect:|%s| "
116
+ "backtrace:|%s|",
117
+ StringValueCStr(rb_exception_info), StringValueCStr(backtrace_str));
78
118
  rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
79
119
  rb_hash_aset(result, rb_str_new2("status"),
80
120
  INT2NUM(GRPC_STATUS_UNAUTHENTICATED));
@@ -98,17 +138,22 @@ static void grpc_rb_call_credentials_callback_with_gil(void* param) {
98
138
  rb_hash_aset(args, ID2SYM(rb_intern("jwt_aud_uri")), auth_uri);
99
139
  rb_ary_push(callback_args, params->get_metadata);
100
140
  rb_ary_push(callback_args, args);
141
+ // Wrap up the grpc_metadata_array into a ruby object and do the conversion
142
+ // from hash to grpc_metadata_array within the rescue block, because the
143
+ // conversion can throw exceptions.
144
+ rb_ary_push(callback_args,
145
+ TypedData_Wrap_Struct(grpc_rb_cMdAry, &grpc_rb_md_ary_data_type,
146
+ &md_ary));
101
147
  result = rb_rescue(grpc_rb_call_credentials_callback, callback_args,
102
148
  grpc_rb_call_credentials_callback_rescue, Qnil);
103
149
  // Both callbacks return a hash, so result should be a hash
104
- grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")),
105
- &md_ary);
106
150
  status = NUM2INT(rb_hash_aref(result, rb_str_new2("status")));
107
151
  details = rb_hash_aref(result, rb_str_new2("details"));
108
152
  error_details = StringValueCStr(details);
109
153
  params->callback(params->user_data, md_ary.metadata, md_ary.count, status,
110
154
  error_details);
111
155
  grpc_rb_metadata_array_destroy_including_entries(&md_ary);
156
+ grpc_auth_metadata_context_reset(&params->context);
112
157
  gpr_free(params);
113
158
  }
114
159
 
@@ -118,9 +163,9 @@ static int grpc_rb_call_credentials_plugin_get_metadata(
118
163
  grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
119
164
  size_t* num_creds_md, grpc_status_code* status,
120
165
  const char** error_details) {
121
- callback_params* params = gpr_malloc(sizeof(callback_params));
166
+ callback_params* params = gpr_zalloc(sizeof(callback_params));
122
167
  params->get_metadata = (VALUE)state;
123
- params->context = context;
168
+ grpc_auth_metadata_context_copy(&context, &params->context);
124
169
  params->user_data = user_data;
125
170
  params->callback = cb;
126
171
 
@@ -135,6 +135,8 @@ grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_cred
135
135
  grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
136
136
  grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
137
137
  grpc_sts_credentials_create_type grpc_sts_credentials_create_import;
138
+ grpc_auth_metadata_context_copy_type grpc_auth_metadata_context_copy_import;
139
+ grpc_auth_metadata_context_reset_type grpc_auth_metadata_context_reset_import;
138
140
  grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_create_from_plugin_import;
139
141
  grpc_secure_channel_create_type grpc_secure_channel_create_import;
140
142
  grpc_server_credentials_release_type grpc_server_credentials_release_import;
@@ -407,6 +409,8 @@ void grpc_rb_load_imports(HMODULE library) {
407
409
  grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
408
410
  grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
409
411
  grpc_sts_credentials_create_import = (grpc_sts_credentials_create_type) GetProcAddress(library, "grpc_sts_credentials_create");
412
+ grpc_auth_metadata_context_copy_import = (grpc_auth_metadata_context_copy_type) GetProcAddress(library, "grpc_auth_metadata_context_copy");
413
+ grpc_auth_metadata_context_reset_import = (grpc_auth_metadata_context_reset_type) GetProcAddress(library, "grpc_auth_metadata_context_reset");
410
414
  grpc_metadata_credentials_create_from_plugin_import = (grpc_metadata_credentials_create_from_plugin_type) GetProcAddress(library, "grpc_metadata_credentials_create_from_plugin");
411
415
  grpc_secure_channel_create_import = (grpc_secure_channel_create_type) GetProcAddress(library, "grpc_secure_channel_create");
412
416
  grpc_server_credentials_release_import = (grpc_server_credentials_release_type) GetProcAddress(library, "grpc_server_credentials_release");
@@ -380,6 +380,12 @@ extern grpc_google_iam_credentials_create_type grpc_google_iam_credentials_creat
380
380
  typedef grpc_call_credentials*(*grpc_sts_credentials_create_type)(const grpc_sts_credentials_options* options, void* reserved);
381
381
  extern grpc_sts_credentials_create_type grpc_sts_credentials_create_import;
382
382
  #define grpc_sts_credentials_create grpc_sts_credentials_create_import
383
+ typedef void(*grpc_auth_metadata_context_copy_type)(grpc_auth_metadata_context* from, grpc_auth_metadata_context* to);
384
+ extern grpc_auth_metadata_context_copy_type grpc_auth_metadata_context_copy_import;
385
+ #define grpc_auth_metadata_context_copy grpc_auth_metadata_context_copy_import
386
+ typedef void(*grpc_auth_metadata_context_reset_type)(grpc_auth_metadata_context* context);
387
+ extern grpc_auth_metadata_context_reset_type grpc_auth_metadata_context_reset_import;
388
+ #define grpc_auth_metadata_context_reset grpc_auth_metadata_context_reset_import
383
389
  typedef grpc_call_credentials*(*grpc_metadata_credentials_create_from_plugin_type)(grpc_metadata_credentials_plugin plugin, grpc_security_level min_security_level, void* reserved);
384
390
  extern grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_create_from_plugin_import;
385
391
  #define grpc_metadata_credentials_create_from_plugin grpc_metadata_credentials_create_from_plugin_import
@@ -100,7 +100,7 @@ module GRPC
100
100
  channel_args: {},
101
101
  interceptors: [])
102
102
  @ch = ClientStub.setup_channel(channel_override, host, creds,
103
- channel_args)
103
+ channel_args.dup)
104
104
  alt_host = channel_args[Core::Channel::SSL_TARGET]
105
105
  @host = alt_host.nil? ? host : alt_host
106
106
  @propagate_mask = propagate_mask
@@ -172,7 +172,7 @@ module GRPC
172
172
  i = @interceptors.pop
173
173
  return yield unless i
174
174
 
175
- i.send(type, args) do
175
+ i.send(type, **args) do
176
176
  if @interceptors.any?
177
177
  intercept!(type, args) do
178
178
  yield
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.30.0'
17
+ VERSION = '1.31.1'
18
18
  end
@@ -36,7 +36,7 @@ module Grpc
36
36
 
37
37
  # If the requested service is unknown, the call will fail with status
38
38
  # NOT_FOUND.
39
- rpc :Check, HealthCheckRequest, HealthCheckResponse
39
+ rpc :Check, ::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse
40
40
  # Performs a watch for the serving status of the requested service.
41
41
  # The server will immediately send back a message indicating the current
42
42
  # serving status. It will then subsequently send a new message whenever
@@ -52,7 +52,7 @@ module Grpc
52
52
  # should assume this method is not supported and should not retry the
53
53
  # call. If the call terminates with any other status (including OK),
54
54
  # clients should retry the call with appropriate exponential backoff.
55
- rpc :Watch, HealthCheckRequest, stream(HealthCheckResponse)
55
+ rpc :Watch, ::Grpc::Health::V1::HealthCheckRequest, stream(::Grpc::Health::V1::HealthCheckResponse)
56
56
  end
57
57
 
58
58
  Stub = Service.rpc_stub_class
@@ -71,6 +71,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
71
71
  add_message "grpc.testing.LoadBalancerStatsResponse" do
72
72
  map :rpcs_by_peer, :string, :int32, 1
73
73
  optional :num_failures, :int32, 2
74
+ map :rpcs_by_method, :string, :message, 3, "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer"
75
+ end
76
+ add_message "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer" do
77
+ map :rpcs_by_peer, :string, :int32, 1
74
78
  end
75
79
  add_enum "grpc.testing.PayloadType" do
76
80
  value :COMPRESSABLE, 0
@@ -99,6 +103,7 @@ module Grpc
99
103
  ReconnectInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ReconnectInfo").msgclass
100
104
  LoadBalancerStatsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsRequest").msgclass
101
105
  LoadBalancerStatsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse").msgclass
106
+ LoadBalancerStatsResponse::RpcsByPeer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse.RpcsByPeer").msgclass
102
107
  PayloadType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule
103
108
  GrpclbRouteType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GrpclbRouteType").enummodule
104
109
  end
@@ -36,31 +36,31 @@ module Grpc
36
36
  self.service_name = 'grpc.testing.TestService'
37
37
 
38
38
  # One empty request followed by one empty response.
39
- rpc :EmptyCall, Empty, Empty
39
+ rpc :EmptyCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
40
40
  # One request followed by one response.
41
- rpc :UnaryCall, SimpleRequest, SimpleResponse
41
+ rpc :UnaryCall, ::Grpc::Testing::SimpleRequest, ::Grpc::Testing::SimpleResponse
42
42
  # One request followed by one response. Response has cache control
43
43
  # headers set such that a caching HTTP proxy (such as GFE) can
44
44
  # satisfy subsequent requests.
45
- rpc :CacheableUnaryCall, SimpleRequest, SimpleResponse
45
+ rpc :CacheableUnaryCall, ::Grpc::Testing::SimpleRequest, ::Grpc::Testing::SimpleResponse
46
46
  # One request followed by a sequence of responses (streamed download).
47
47
  # The server returns the payload with client desired type and sizes.
48
- rpc :StreamingOutputCall, StreamingOutputCallRequest, stream(StreamingOutputCallResponse)
48
+ rpc :StreamingOutputCall, ::Grpc::Testing::StreamingOutputCallRequest, stream(::Grpc::Testing::StreamingOutputCallResponse)
49
49
  # A sequence of requests followed by one response (streamed upload).
50
50
  # The server returns the aggregated size of client payload as the result.
51
- rpc :StreamingInputCall, stream(StreamingInputCallRequest), StreamingInputCallResponse
51
+ rpc :StreamingInputCall, stream(::Grpc::Testing::StreamingInputCallRequest), ::Grpc::Testing::StreamingInputCallResponse
52
52
  # A sequence of requests with each request served by the server immediately.
53
53
  # As one request could lead to multiple responses, this interface
54
54
  # demonstrates the idea of full duplexing.
55
- rpc :FullDuplexCall, stream(StreamingOutputCallRequest), stream(StreamingOutputCallResponse)
55
+ rpc :FullDuplexCall, stream(::Grpc::Testing::StreamingOutputCallRequest), stream(::Grpc::Testing::StreamingOutputCallResponse)
56
56
  # A sequence of requests followed by a sequence of responses.
57
57
  # The server buffers all the client requests and then serves them in order. A
58
58
  # stream of responses are returned to the client when the server starts with
59
59
  # first request.
60
- rpc :HalfDuplexCall, stream(StreamingOutputCallRequest), stream(StreamingOutputCallResponse)
60
+ rpc :HalfDuplexCall, stream(::Grpc::Testing::StreamingOutputCallRequest), stream(::Grpc::Testing::StreamingOutputCallResponse)
61
61
  # The test server will not implement this method. It will be used
62
62
  # to test the behavior when clients call unimplemented methods.
63
- rpc :UnimplementedCall, Empty, Empty
63
+ rpc :UnimplementedCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
64
64
  end
65
65
 
66
66
  Stub = Service.rpc_stub_class
@@ -77,7 +77,7 @@ module Grpc
77
77
  self.service_name = 'grpc.testing.UnimplementedService'
78
78
 
79
79
  # A call that no server should implement
80
- rpc :UnimplementedCall, Empty, Empty
80
+ rpc :UnimplementedCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
81
81
  end
82
82
 
83
83
  Stub = Service.rpc_stub_class
@@ -92,8 +92,8 @@ module Grpc
92
92
  self.unmarshal_class_method = :decode
93
93
  self.service_name = 'grpc.testing.ReconnectService'
94
94
 
95
- rpc :Start, ReconnectParams, Empty
96
- rpc :Stop, Empty, ReconnectInfo
95
+ rpc :Start, ::Grpc::Testing::ReconnectParams, ::Grpc::Testing::Empty
96
+ rpc :Stop, ::Grpc::Testing::Empty, ::Grpc::Testing::ReconnectInfo
97
97
  end
98
98
 
99
99
  Stub = Service.rpc_stub_class
@@ -109,7 +109,23 @@ module Grpc
109
109
  self.service_name = 'grpc.testing.LoadBalancerStatsService'
110
110
 
111
111
  # Gets the backend distribution for RPCs sent by a test client.
112
- rpc :GetClientStats, LoadBalancerStatsRequest, LoadBalancerStatsResponse
112
+ rpc :GetClientStats, ::Grpc::Testing::LoadBalancerStatsRequest, ::Grpc::Testing::LoadBalancerStatsResponse
113
+ end
114
+
115
+ Stub = Service.rpc_stub_class
116
+ end
117
+ module XdsUpdateHealthService
118
+ # A service to remotely control health status of an xDS test server.
119
+ class Service
120
+
121
+ include GRPC::GenericService
122
+
123
+ self.marshal_class_method = :encode
124
+ self.unmarshal_class_method = :decode
125
+ self.service_name = 'grpc.testing.XdsUpdateHealthService'
126
+
127
+ rpc :SetServing, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
128
+ rpc :SetNotServing, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
113
129
  end
114
130
 
115
131
  Stub = Service.rpc_stub_class
@@ -0,0 +1,23 @@
1
+ // Copyright 2020 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package grpc.foo;
18
+
19
+ option ruby_package = "B::Other";
20
+
21
+ message Foo {
22
+ message Bar { }
23
+ }
@@ -17,6 +17,7 @@ syntax = "proto3";
17
17
  package grpc.testing;
18
18
 
19
19
  import "grpc/testing/package_options_import.proto";
20
+ import "grpc/testing/package_options_import2.proto";
20
21
 
21
22
  // For sanity checking package definitions
22
23
  option ruby_package = "RPC::Test::New::Package::Options";
@@ -34,6 +35,7 @@ message Bar {
34
35
  service AnotherTestService {
35
36
  rpc GetTest(AnotherTestRequest) returns (AnotherTestResponse) { }
36
37
  rpc OtherTest(Thing) returns (Thing) { }
38
+ rpc PackageTest(grpc.testing.Thing) returns (grpc.foo.Foo.Bar) { }
37
39
  rpc FooTest(Foo) returns (Foo) { }
38
40
  rpc NestedMessageTest(Foo) returns (Bar.Baz) { }
39
41
  }
@@ -0,0 +1,27 @@
1
+ // Copyright 2020 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package same_name;
18
+
19
+ service SameName {
20
+ rpc Health(Request) returns (Status);
21
+ }
22
+
23
+ message Status {
24
+ string msg = 1;
25
+ }
26
+
27
+ message Request {}
@@ -0,0 +1,29 @@
1
+ // Copyright 2020 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package other_name;
18
+
19
+ option ruby_package = "SameName2";
20
+
21
+ service SameName2 {
22
+ rpc Health(Request) returns (Status);
23
+ }
24
+
25
+ message Status {
26
+ string msg = 1;
27
+ }
28
+
29
+ message Request {}
@@ -27,7 +27,9 @@ describe 'Code Generation Options' do
27
27
  end
28
28
 
29
29
  it 'should generate and respect Ruby style package options' do
30
- with_protos(%w[grpc/testing/package_options_ruby_style.proto grpc/testing/package_options_import.proto]) do
30
+ with_protos(['grpc/testing/package_options_ruby_style.proto',
31
+ 'grpc/testing/package_options_import.proto',
32
+ 'grpc/testing/package_options_import2.proto']) do
31
33
  expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to raise_error(NameError)
32
34
  expect(require('grpc/testing/package_options_ruby_style_services_pb')).to be_truthy
33
35
  expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to_not raise_error
@@ -38,12 +40,34 @@ describe 'Code Generation Options' do
38
40
  expect(services[:GetTest].output).to eq(RPC::Test::New::Package::Options::AnotherTestResponse)
39
41
  expect(services[:OtherTest].input).to eq(A::Other::Thing)
40
42
  expect(services[:OtherTest].output).to eq(A::Other::Thing)
43
+ expect(services[:PackageTest].input).to eq(A::Other::Thing)
44
+ expect(services[:PackageTest].output).to eq(B::Other::Foo::Bar)
41
45
  expect(services[:FooTest].input).to eq(RPC::Test::New::Package::Options::Foo)
42
46
  expect(services[:FooTest].output).to eq(RPC::Test::New::Package::Options::Foo)
43
47
  expect(services[:NestedMessageTest].input).to eq(RPC::Test::New::Package::Options::Foo)
44
48
  expect(services[:NestedMessageTest].output).to eq(RPC::Test::New::Package::Options::Bar::Baz)
45
49
  end
46
50
  end
51
+
52
+ it 'should generate when package and service has same name' do
53
+ with_protos(['grpc/testing/same_package_service_name.proto']) do
54
+ expect { SameName::SameName::Service }.to raise_error(NameError)
55
+ expect(require('grpc/testing/same_package_service_name_services_pb')).to be_truthy
56
+ expect { SameName::SameName::Service }.to_not raise_error
57
+ expect { SameName::Request }.to_not raise_error
58
+ expect { SameName::Status }.to_not raise_error
59
+ end
60
+ end
61
+
62
+ it 'should generate when ruby_package and service has same name' do
63
+ with_protos(['grpc/testing/same_ruby_package_service_name.proto']) do
64
+ expect { SameName2::SameName2::Service }.to raise_error(NameError)
65
+ expect(require('grpc/testing/same_ruby_package_service_name_services_pb')).to be_truthy
66
+ expect { SameName2::SameName2::Service }.to_not raise_error
67
+ expect { SameName2::Request }.to_not raise_error
68
+ expect { SameName2::Status }.to_not raise_error
69
+ end
70
+ end
47
71
  end
48
72
 
49
73
  def with_protos(file_paths)
@@ -17,12 +17,18 @@ require 'spec_helper'
17
17
 
18
18
  # A test message
19
19
  class EchoMsg
20
- def self.marshal(_o)
21
- ''
20
+ attr_reader :msg
21
+
22
+ def initialize(msg: '')
23
+ @msg = msg
22
24
  end
23
25
 
24
- def self.unmarshal(_o)
25
- EchoMsg.new
26
+ def self.marshal(o)
27
+ o.msg
28
+ end
29
+
30
+ def self.unmarshal(msg)
31
+ EchoMsg.new(msg: msg)
26
32
  end
27
33
  end
28
34
 
@@ -0,0 +1,74 @@
1
+ # Copyright 2020 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'spec_helper'
16
+
17
+ # a test service that checks the cert of its peer
18
+ class UserAgentEchoService
19
+ include GRPC::GenericService
20
+ rpc :an_rpc, EchoMsg, EchoMsg
21
+
22
+ def an_rpc(_req, call)
23
+ EchoMsg.new(msg: call.metadata['user-agent'])
24
+ end
25
+ end
26
+
27
+ UserAgentEchoServiceStub = UserAgentEchoService.rpc_stub_class
28
+
29
+ describe 'user agent' do
30
+ RpcServer = GRPC::RpcServer
31
+
32
+ before(:all) do
33
+ server_opts = {
34
+ poll_period: 1
35
+ }
36
+ @srv = new_rpc_server_for_testing(**server_opts)
37
+ @port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure)
38
+ @srv.handle(UserAgentEchoService)
39
+ @srv_thd = Thread.new { @srv.run }
40
+ @srv.wait_till_running
41
+ end
42
+
43
+ after(:all) do
44
+ expect(@srv.stopped?).to be(false)
45
+ @srv.stop
46
+ @srv_thd.join
47
+ end
48
+
49
+ it 'client sends expected user agent' do
50
+ stub = UserAgentEchoServiceStub.new("localhost:#{@port}",
51
+ :this_channel_is_insecure,
52
+ {})
53
+ response = stub.an_rpc(EchoMsg.new)
54
+ expected_user_agent_prefix = "grpc-ruby/#{GRPC::VERSION}"
55
+ expect(response.msg.start_with?(expected_user_agent_prefix)).to be true
56
+ # check that the expected user agent prefix occurs in the real user agent exactly once
57
+ expect(response.msg.split(expected_user_agent_prefix).size).to eq 2
58
+ end
59
+
60
+ it 'user agent header does not grow when the same channel args hash is used across multiple stubs' do
61
+ shared_channel_args_hash = {}
62
+ 10.times do
63
+ stub = UserAgentEchoServiceStub.new("localhost:#{@port}",
64
+ :this_channel_is_insecure,
65
+ channel_args: shared_channel_args_hash)
66
+ response = stub.an_rpc(EchoMsg.new)
67
+ puts "got echo response: #{response.msg}"
68
+ expected_user_agent_prefix = "grpc-ruby/#{GRPC::VERSION}"
69
+ expect(response.msg.start_with?(expected_user_agent_prefix)).to be true
70
+ # check that the expected user agent prefix occurs in the real user agent exactly once
71
+ expect(response.msg.split(expected_user_agent_prefix).size).to eq 2
72
+ end
73
+ end
74
+ end
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: 1.30.0
4
+ version: 1.31.1
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: 2020-06-22 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -306,7 +306,10 @@ files:
306
306
  - src/ruby/spec/google_rpc_status_utils_spec.rb
307
307
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
308
308
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
309
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto
309
310
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
311
+ - src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto
312
+ - src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto
310
313
  - src/ruby/spec/pb/codegen/package_option_spec.rb
311
314
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
312
315
  - src/ruby/spec/pb/health/checker_spec.rb
@@ -322,6 +325,7 @@ files:
322
325
  - src/ruby/spec/testdata/server1.key
323
326
  - src/ruby/spec/testdata/server1.pem
324
327
  - src/ruby/spec/time_consts_spec.rb
328
+ - src/ruby/spec/user_agent_spec.rb
325
329
  homepage: https://github.com/google/grpc/tree/master/src/ruby
326
330
  licenses:
327
331
  - Apache-2.0
@@ -351,42 +355,46 @@ signing_key:
351
355
  specification_version: 4
352
356
  summary: GRPC system in Ruby
353
357
  test_files:
354
- - src/ruby/spec/spec_helper.rb
355
- - src/ruby/spec/client_auth_spec.rb
356
- - src/ruby/spec/server_spec.rb
357
- - src/ruby/spec/errors_spec.rb
358
- - src/ruby/spec/generic/client_stub_spec.rb
359
- - src/ruby/spec/generic/interceptor_registry_spec.rb
360
- - src/ruby/spec/generic/rpc_server_pool_spec.rb
361
- - src/ruby/spec/generic/rpc_server_spec.rb
362
- - src/ruby/spec/generic/rpc_desc_spec.rb
363
- - src/ruby/spec/generic/active_call_spec.rb
364
- - src/ruby/spec/generic/server_interceptors_spec.rb
365
- - src/ruby/spec/generic/service_spec.rb
366
- - src/ruby/spec/generic/client_interceptors_spec.rb
367
- - src/ruby/spec/channel_credentials_spec.rb
368
358
  - src/ruby/spec/time_consts_spec.rb
369
- - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
359
+ - src/ruby/spec/pb/health/checker_spec.rb
370
360
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
361
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
362
+ - src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto
371
363
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
364
+ - src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto
365
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto
372
366
  - src/ruby/spec/pb/codegen/package_option_spec.rb
373
- - src/ruby/spec/pb/health/checker_spec.rb
374
367
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
375
- - src/ruby/spec/call_spec.rb
368
+ - src/ruby/spec/debug_message_spec.rb
376
369
  - src/ruby/spec/call_credentials_spec.rb
377
370
  - src/ruby/spec/client_server_spec.rb
378
- - src/ruby/spec/compression_options_spec.rb
379
- - src/ruby/spec/channel_spec.rb
371
+ - src/ruby/spec/client_auth_spec.rb
372
+ - src/ruby/spec/server_spec.rb
380
373
  - src/ruby/spec/server_credentials_spec.rb
381
- - src/ruby/spec/debug_message_spec.rb
382
- - src/ruby/spec/channel_connection_spec.rb
383
- - src/ruby/spec/support/services.rb
384
- - src/ruby/spec/support/helpers.rb
385
- - src/ruby/spec/google_rpc_status_utils_spec.rb
386
- - src/ruby/spec/testdata/client.key
374
+ - src/ruby/spec/user_agent_spec.rb
387
375
  - src/ruby/spec/testdata/ca.pem
388
- - src/ruby/spec/testdata/server1.key
389
- - src/ruby/spec/testdata/server1.pem
376
+ - src/ruby/spec/testdata/client.key
390
377
  - src/ruby/spec/testdata/client.pem
391
378
  - src/ruby/spec/testdata/README
379
+ - src/ruby/spec/testdata/server1.key
380
+ - src/ruby/spec/testdata/server1.pem
381
+ - src/ruby/spec/spec_helper.rb
382
+ - src/ruby/spec/generic/rpc_server_pool_spec.rb
383
+ - src/ruby/spec/generic/rpc_desc_spec.rb
384
+ - src/ruby/spec/generic/server_interceptors_spec.rb
385
+ - src/ruby/spec/generic/interceptor_registry_spec.rb
386
+ - src/ruby/spec/generic/client_interceptors_spec.rb
387
+ - src/ruby/spec/generic/client_stub_spec.rb
388
+ - src/ruby/spec/generic/rpc_server_spec.rb
389
+ - src/ruby/spec/generic/active_call_spec.rb
390
+ - src/ruby/spec/generic/service_spec.rb
391
+ - src/ruby/spec/compression_options_spec.rb
392
392
  - src/ruby/spec/error_sanity_spec.rb
393
+ - src/ruby/spec/errors_spec.rb
394
+ - src/ruby/spec/channel_connection_spec.rb
395
+ - src/ruby/spec/call_spec.rb
396
+ - src/ruby/spec/channel_spec.rb
397
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
398
+ - src/ruby/spec/channel_credentials_spec.rb
399
+ - src/ruby/spec/support/services.rb
400
+ - src/ruby/spec/support/helpers.rb