grpc 1.32.0.pre1-x86-linux → 1.35.0-x86-linux

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.

@@ -22,7 +22,7 @@ grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
22
22
 
23
23
  grpc_config = ENV['GRPC_CONFIG'] || 'opt'
24
24
 
25
- ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
25
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.10'
26
26
 
27
27
  if ENV['AR'].nil? || ENV['AR'].size == 0
28
28
  ENV['AR'] = RbConfig::CONFIG['AR']
@@ -29,6 +29,8 @@
29
29
  #include <grpc/support/time.h>
30
30
  #include <ruby/thread.h>
31
31
 
32
+ #include "rb_grpc.h"
33
+
32
34
  typedef struct grpc_rb_event {
33
35
  // callback will be called with argument while holding the GVL
34
36
  void (*callback)(void*);
@@ -58,7 +58,6 @@ grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_external_c
58
58
  grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import;
59
59
  grpc_channel_support_connectivity_watcher_type grpc_channel_support_connectivity_watcher_import;
60
60
  grpc_channel_create_call_type grpc_channel_create_call_import;
61
- grpc_channel_ping_type grpc_channel_ping_import;
62
61
  grpc_channel_register_call_type grpc_channel_register_call_import;
63
62
  grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import;
64
63
  grpc_call_arena_alloc_type grpc_call_arena_alloc_import;
@@ -81,6 +80,9 @@ grpc_server_register_method_type grpc_server_register_method_import;
81
80
  grpc_server_request_registered_call_type grpc_server_request_registered_call_import;
82
81
  grpc_server_create_type grpc_server_create_import;
83
82
  grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
83
+ grpc_server_config_fetcher_xds_create_type grpc_server_config_fetcher_xds_create_import;
84
+ grpc_server_config_fetcher_destroy_type grpc_server_config_fetcher_destroy_import;
85
+ grpc_server_set_config_fetcher_type grpc_server_set_config_fetcher_import;
84
86
  grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
85
87
  grpc_server_start_type grpc_server_start_import;
86
88
  grpc_server_shutdown_and_notify_type grpc_server_shutdown_and_notify_import;
@@ -131,6 +133,7 @@ grpc_composite_call_credentials_create_type grpc_composite_call_credentials_crea
131
133
  grpc_google_compute_engine_credentials_create_type grpc_google_compute_engine_credentials_create_import;
132
134
  grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
133
135
  grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
136
+ grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
134
137
  grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
135
138
  grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
136
139
  grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
@@ -159,18 +162,25 @@ grpc_alts_credentials_create_type grpc_alts_credentials_create_import;
159
162
  grpc_alts_server_credentials_create_type grpc_alts_server_credentials_create_import;
160
163
  grpc_local_credentials_create_type grpc_local_credentials_create_import;
161
164
  grpc_local_server_credentials_create_type grpc_local_server_credentials_create_import;
165
+ grpc_tls_identity_pairs_create_type grpc_tls_identity_pairs_create_import;
166
+ grpc_tls_identity_pairs_add_pair_type grpc_tls_identity_pairs_add_pair_import;
167
+ grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_import;
168
+ grpc_tls_certificate_provider_static_data_create_type grpc_tls_certificate_provider_static_data_create_import;
169
+ grpc_tls_certificate_provider_file_watcher_create_type grpc_tls_certificate_provider_file_watcher_create_import;
170
+ grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
162
171
  grpc_tls_credentials_options_create_type grpc_tls_credentials_options_create_import;
163
172
  grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
164
173
  grpc_tls_credentials_options_set_server_verification_option_type grpc_tls_credentials_options_set_server_verification_option_import;
165
- grpc_tls_credentials_options_set_key_materials_config_type grpc_tls_credentials_options_set_key_materials_config_import;
166
- grpc_tls_credentials_options_set_credential_reload_config_type grpc_tls_credentials_options_set_credential_reload_config_import;
174
+ grpc_tls_credentials_options_set_certificate_provider_type grpc_tls_credentials_options_set_certificate_provider_import;
175
+ grpc_tls_credentials_options_watch_root_certs_type grpc_tls_credentials_options_watch_root_certs_import;
176
+ grpc_tls_credentials_options_set_root_cert_name_type grpc_tls_credentials_options_set_root_cert_name_import;
177
+ grpc_tls_credentials_options_watch_identity_key_cert_pairs_type grpc_tls_credentials_options_watch_identity_key_cert_pairs_import;
178
+ grpc_tls_credentials_options_set_identity_cert_name_type grpc_tls_credentials_options_set_identity_cert_name_import;
167
179
  grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls_credentials_options_set_server_authorization_check_config_import;
168
- grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_create_import;
169
- grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import;
170
- grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import;
171
- grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import;
172
- grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import;
173
180
  grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
181
+ grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authorization_check_config_release_import;
182
+ grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
183
+ grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
174
184
  grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
175
185
  grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
176
186
  grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
@@ -332,7 +342,6 @@ void grpc_rb_load_imports(HMODULE library) {
332
342
  grpc_channel_watch_connectivity_state_import = (grpc_channel_watch_connectivity_state_type) GetProcAddress(library, "grpc_channel_watch_connectivity_state");
333
343
  grpc_channel_support_connectivity_watcher_import = (grpc_channel_support_connectivity_watcher_type) GetProcAddress(library, "grpc_channel_support_connectivity_watcher");
334
344
  grpc_channel_create_call_import = (grpc_channel_create_call_type) GetProcAddress(library, "grpc_channel_create_call");
335
- grpc_channel_ping_import = (grpc_channel_ping_type) GetProcAddress(library, "grpc_channel_ping");
336
345
  grpc_channel_register_call_import = (grpc_channel_register_call_type) GetProcAddress(library, "grpc_channel_register_call");
337
346
  grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call");
338
347
  grpc_call_arena_alloc_import = (grpc_call_arena_alloc_type) GetProcAddress(library, "grpc_call_arena_alloc");
@@ -355,6 +364,9 @@ void grpc_rb_load_imports(HMODULE library) {
355
364
  grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call");
356
365
  grpc_server_create_import = (grpc_server_create_type) GetProcAddress(library, "grpc_server_create");
357
366
  grpc_server_register_completion_queue_import = (grpc_server_register_completion_queue_type) GetProcAddress(library, "grpc_server_register_completion_queue");
367
+ grpc_server_config_fetcher_xds_create_import = (grpc_server_config_fetcher_xds_create_type) GetProcAddress(library, "grpc_server_config_fetcher_xds_create");
368
+ grpc_server_config_fetcher_destroy_import = (grpc_server_config_fetcher_destroy_type) GetProcAddress(library, "grpc_server_config_fetcher_destroy");
369
+ grpc_server_set_config_fetcher_import = (grpc_server_set_config_fetcher_type) GetProcAddress(library, "grpc_server_set_config_fetcher");
358
370
  grpc_server_add_insecure_http2_port_import = (grpc_server_add_insecure_http2_port_type) GetProcAddress(library, "grpc_server_add_insecure_http2_port");
359
371
  grpc_server_start_import = (grpc_server_start_type) GetProcAddress(library, "grpc_server_start");
360
372
  grpc_server_shutdown_and_notify_import = (grpc_server_shutdown_and_notify_type) GetProcAddress(library, "grpc_server_shutdown_and_notify");
@@ -405,6 +417,7 @@ void grpc_rb_load_imports(HMODULE library) {
405
417
  grpc_google_compute_engine_credentials_create_import = (grpc_google_compute_engine_credentials_create_type) GetProcAddress(library, "grpc_google_compute_engine_credentials_create");
406
418
  grpc_max_auth_token_lifetime_import = (grpc_max_auth_token_lifetime_type) GetProcAddress(library, "grpc_max_auth_token_lifetime");
407
419
  grpc_service_account_jwt_access_credentials_create_import = (grpc_service_account_jwt_access_credentials_create_type) GetProcAddress(library, "grpc_service_account_jwt_access_credentials_create");
420
+ grpc_external_account_credentials_create_import = (grpc_external_account_credentials_create_type) GetProcAddress(library, "grpc_external_account_credentials_create");
408
421
  grpc_google_refresh_token_credentials_create_import = (grpc_google_refresh_token_credentials_create_type) GetProcAddress(library, "grpc_google_refresh_token_credentials_create");
409
422
  grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
410
423
  grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
@@ -433,18 +446,25 @@ void grpc_rb_load_imports(HMODULE library) {
433
446
  grpc_alts_server_credentials_create_import = (grpc_alts_server_credentials_create_type) GetProcAddress(library, "grpc_alts_server_credentials_create");
434
447
  grpc_local_credentials_create_import = (grpc_local_credentials_create_type) GetProcAddress(library, "grpc_local_credentials_create");
435
448
  grpc_local_server_credentials_create_import = (grpc_local_server_credentials_create_type) GetProcAddress(library, "grpc_local_server_credentials_create");
449
+ grpc_tls_identity_pairs_create_import = (grpc_tls_identity_pairs_create_type) GetProcAddress(library, "grpc_tls_identity_pairs_create");
450
+ grpc_tls_identity_pairs_add_pair_import = (grpc_tls_identity_pairs_add_pair_type) GetProcAddress(library, "grpc_tls_identity_pairs_add_pair");
451
+ grpc_tls_identity_pairs_destroy_import = (grpc_tls_identity_pairs_destroy_type) GetProcAddress(library, "grpc_tls_identity_pairs_destroy");
452
+ grpc_tls_certificate_provider_static_data_create_import = (grpc_tls_certificate_provider_static_data_create_type) GetProcAddress(library, "grpc_tls_certificate_provider_static_data_create");
453
+ grpc_tls_certificate_provider_file_watcher_create_import = (grpc_tls_certificate_provider_file_watcher_create_type) GetProcAddress(library, "grpc_tls_certificate_provider_file_watcher_create");
454
+ grpc_tls_certificate_provider_release_import = (grpc_tls_certificate_provider_release_type) GetProcAddress(library, "grpc_tls_certificate_provider_release");
436
455
  grpc_tls_credentials_options_create_import = (grpc_tls_credentials_options_create_type) GetProcAddress(library, "grpc_tls_credentials_options_create");
437
456
  grpc_tls_credentials_options_set_cert_request_type_import = (grpc_tls_credentials_options_set_cert_request_type_type) GetProcAddress(library, "grpc_tls_credentials_options_set_cert_request_type");
438
457
  grpc_tls_credentials_options_set_server_verification_option_import = (grpc_tls_credentials_options_set_server_verification_option_type) GetProcAddress(library, "grpc_tls_credentials_options_set_server_verification_option");
439
- grpc_tls_credentials_options_set_key_materials_config_import = (grpc_tls_credentials_options_set_key_materials_config_type) GetProcAddress(library, "grpc_tls_credentials_options_set_key_materials_config");
440
- grpc_tls_credentials_options_set_credential_reload_config_import = (grpc_tls_credentials_options_set_credential_reload_config_type) GetProcAddress(library, "grpc_tls_credentials_options_set_credential_reload_config");
458
+ grpc_tls_credentials_options_set_certificate_provider_import = (grpc_tls_credentials_options_set_certificate_provider_type) GetProcAddress(library, "grpc_tls_credentials_options_set_certificate_provider");
459
+ grpc_tls_credentials_options_watch_root_certs_import = (grpc_tls_credentials_options_watch_root_certs_type) GetProcAddress(library, "grpc_tls_credentials_options_watch_root_certs");
460
+ grpc_tls_credentials_options_set_root_cert_name_import = (grpc_tls_credentials_options_set_root_cert_name_type) GetProcAddress(library, "grpc_tls_credentials_options_set_root_cert_name");
461
+ grpc_tls_credentials_options_watch_identity_key_cert_pairs_import = (grpc_tls_credentials_options_watch_identity_key_cert_pairs_type) GetProcAddress(library, "grpc_tls_credentials_options_watch_identity_key_cert_pairs");
462
+ grpc_tls_credentials_options_set_identity_cert_name_import = (grpc_tls_credentials_options_set_identity_cert_name_type) GetProcAddress(library, "grpc_tls_credentials_options_set_identity_cert_name");
441
463
  grpc_tls_credentials_options_set_server_authorization_check_config_import = (grpc_tls_credentials_options_set_server_authorization_check_config_type) GetProcAddress(library, "grpc_tls_credentials_options_set_server_authorization_check_config");
442
- grpc_tls_key_materials_config_create_import = (grpc_tls_key_materials_config_create_type) GetProcAddress(library, "grpc_tls_key_materials_config_create");
443
- grpc_tls_key_materials_config_set_key_materials_import = (grpc_tls_key_materials_config_set_key_materials_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_key_materials");
444
- grpc_tls_key_materials_config_set_version_import = (grpc_tls_key_materials_config_set_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_version");
445
- grpc_tls_key_materials_config_get_version_import = (grpc_tls_key_materials_config_get_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_get_version");
446
- grpc_tls_credential_reload_config_create_import = (grpc_tls_credential_reload_config_create_type) GetProcAddress(library, "grpc_tls_credential_reload_config_create");
447
464
  grpc_tls_server_authorization_check_config_create_import = (grpc_tls_server_authorization_check_config_create_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_create");
465
+ grpc_tls_server_authorization_check_config_release_import = (grpc_tls_server_authorization_check_config_release_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_release");
466
+ grpc_xds_credentials_create_import = (grpc_xds_credentials_create_type) GetProcAddress(library, "grpc_xds_credentials_create");
467
+ grpc_xds_server_credentials_create_import = (grpc_xds_server_credentials_create_type) GetProcAddress(library, "grpc_xds_server_credentials_create");
448
468
  grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
449
469
  grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
450
470
  grpc_byte_buffer_copy_import = (grpc_byte_buffer_copy_type) GetProcAddress(library, "grpc_byte_buffer_copy");
@@ -47,7 +47,7 @@ extern grpc_compression_algorithm_is_message_type grpc_compression_algorithm_is_
47
47
  typedef int(*grpc_compression_algorithm_is_stream_type)(grpc_compression_algorithm algorithm);
48
48
  extern grpc_compression_algorithm_is_stream_type grpc_compression_algorithm_is_stream_import;
49
49
  #define grpc_compression_algorithm_is_stream grpc_compression_algorithm_is_stream_import
50
- typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice value, grpc_compression_algorithm* algorithm);
50
+ typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice name, grpc_compression_algorithm* algorithm);
51
51
  extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import;
52
52
  #define grpc_compression_algorithm_parse grpc_compression_algorithm_parse_import
53
53
  typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, const char** name);
@@ -149,9 +149,6 @@ extern grpc_channel_support_connectivity_watcher_type grpc_channel_support_conne
149
149
  typedef grpc_call*(*grpc_channel_create_call_type)(grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask, grpc_completion_queue* completion_queue, grpc_slice method, const grpc_slice* host, gpr_timespec deadline, void* reserved);
150
150
  extern grpc_channel_create_call_type grpc_channel_create_call_import;
151
151
  #define grpc_channel_create_call grpc_channel_create_call_import
152
- typedef void(*grpc_channel_ping_type)(grpc_channel* channel, grpc_completion_queue* cq, void* tag, void* reserved);
153
- extern grpc_channel_ping_type grpc_channel_ping_import;
154
- #define grpc_channel_ping grpc_channel_ping_import
155
152
  typedef void*(*grpc_channel_register_call_type)(grpc_channel* channel, const char* method, const char* host, void* reserved);
156
153
  extern grpc_channel_register_call_type grpc_channel_register_call_import;
157
154
  #define grpc_channel_register_call grpc_channel_register_call_import
@@ -218,6 +215,15 @@ extern grpc_server_create_type grpc_server_create_import;
218
215
  typedef void(*grpc_server_register_completion_queue_type)(grpc_server* server, grpc_completion_queue* cq, void* reserved);
219
216
  extern grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
220
217
  #define grpc_server_register_completion_queue grpc_server_register_completion_queue_import
218
+ typedef grpc_server_config_fetcher*(*grpc_server_config_fetcher_xds_create_type)();
219
+ extern grpc_server_config_fetcher_xds_create_type grpc_server_config_fetcher_xds_create_import;
220
+ #define grpc_server_config_fetcher_xds_create grpc_server_config_fetcher_xds_create_import
221
+ typedef void(*grpc_server_config_fetcher_destroy_type)(grpc_server_config_fetcher* config_fetcher);
222
+ extern grpc_server_config_fetcher_destroy_type grpc_server_config_fetcher_destroy_import;
223
+ #define grpc_server_config_fetcher_destroy grpc_server_config_fetcher_destroy_import
224
+ typedef void(*grpc_server_set_config_fetcher_type)(grpc_server* server, grpc_server_config_fetcher* config_fetcher);
225
+ extern grpc_server_set_config_fetcher_type grpc_server_set_config_fetcher_import;
226
+ #define grpc_server_set_config_fetcher grpc_server_set_config_fetcher_import
221
227
  typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server* server, const char* addr);
222
228
  extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
223
229
  #define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import
@@ -368,6 +374,9 @@ extern grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
368
374
  typedef grpc_call_credentials*(*grpc_service_account_jwt_access_credentials_create_type)(const char* json_key, gpr_timespec token_lifetime, void* reserved);
369
375
  extern grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
370
376
  #define grpc_service_account_jwt_access_credentials_create grpc_service_account_jwt_access_credentials_create_import
377
+ typedef grpc_call_credentials*(*grpc_external_account_credentials_create_type)(const char* json_string, const char* scopes_string);
378
+ extern grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
379
+ #define grpc_external_account_credentials_create grpc_external_account_credentials_create_import
371
380
  typedef grpc_call_credentials*(*grpc_google_refresh_token_credentials_create_type)(const char* json_refresh_token, void* reserved);
372
381
  extern grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
373
382
  #define grpc_google_refresh_token_credentials_create grpc_google_refresh_token_credentials_create_import
@@ -452,42 +461,63 @@ extern grpc_local_credentials_create_type grpc_local_credentials_create_import;
452
461
  typedef grpc_server_credentials*(*grpc_local_server_credentials_create_type)(grpc_local_connect_type type);
453
462
  extern grpc_local_server_credentials_create_type grpc_local_server_credentials_create_import;
454
463
  #define grpc_local_server_credentials_create grpc_local_server_credentials_create_import
464
+ typedef grpc_tls_identity_pairs*(*grpc_tls_identity_pairs_create_type)();
465
+ extern grpc_tls_identity_pairs_create_type grpc_tls_identity_pairs_create_import;
466
+ #define grpc_tls_identity_pairs_create grpc_tls_identity_pairs_create_import
467
+ typedef void(*grpc_tls_identity_pairs_add_pair_type)(grpc_tls_identity_pairs* pairs, const char* private_key, const char* cert_chain);
468
+ extern grpc_tls_identity_pairs_add_pair_type grpc_tls_identity_pairs_add_pair_import;
469
+ #define grpc_tls_identity_pairs_add_pair grpc_tls_identity_pairs_add_pair_import
470
+ typedef void(*grpc_tls_identity_pairs_destroy_type)(grpc_tls_identity_pairs* pairs);
471
+ extern grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_import;
472
+ #define grpc_tls_identity_pairs_destroy grpc_tls_identity_pairs_destroy_import
473
+ typedef grpc_tls_certificate_provider*(*grpc_tls_certificate_provider_static_data_create_type)(const char* root_certificate, grpc_tls_identity_pairs* pem_key_cert_pairs);
474
+ extern grpc_tls_certificate_provider_static_data_create_type grpc_tls_certificate_provider_static_data_create_import;
475
+ #define grpc_tls_certificate_provider_static_data_create grpc_tls_certificate_provider_static_data_create_import
476
+ typedef grpc_tls_certificate_provider*(*grpc_tls_certificate_provider_file_watcher_create_type)(const char* private_key_path, const char* identity_certificate_path, const char* root_cert_path, unsigned int refresh_interval_sec);
477
+ extern grpc_tls_certificate_provider_file_watcher_create_type grpc_tls_certificate_provider_file_watcher_create_import;
478
+ #define grpc_tls_certificate_provider_file_watcher_create grpc_tls_certificate_provider_file_watcher_create_import
479
+ typedef void(*grpc_tls_certificate_provider_release_type)(grpc_tls_certificate_provider* provider);
480
+ extern grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
481
+ #define grpc_tls_certificate_provider_release grpc_tls_certificate_provider_release_import
455
482
  typedef grpc_tls_credentials_options*(*grpc_tls_credentials_options_create_type)(void);
456
483
  extern grpc_tls_credentials_options_create_type grpc_tls_credentials_options_create_import;
457
484
  #define grpc_tls_credentials_options_create grpc_tls_credentials_options_create_import
458
- typedef int(*grpc_tls_credentials_options_set_cert_request_type_type)(grpc_tls_credentials_options* options, grpc_ssl_client_certificate_request_type type);
485
+ typedef void(*grpc_tls_credentials_options_set_cert_request_type_type)(grpc_tls_credentials_options* options, grpc_ssl_client_certificate_request_type type);
459
486
  extern grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
460
487
  #define grpc_tls_credentials_options_set_cert_request_type grpc_tls_credentials_options_set_cert_request_type_import
461
- typedef int(*grpc_tls_credentials_options_set_server_verification_option_type)(grpc_tls_credentials_options* options, grpc_tls_server_verification_option server_verification_option);
488
+ typedef void(*grpc_tls_credentials_options_set_server_verification_option_type)(grpc_tls_credentials_options* options, grpc_tls_server_verification_option server_verification_option);
462
489
  extern grpc_tls_credentials_options_set_server_verification_option_type grpc_tls_credentials_options_set_server_verification_option_import;
463
490
  #define grpc_tls_credentials_options_set_server_verification_option grpc_tls_credentials_options_set_server_verification_option_import
464
- typedef int(*grpc_tls_credentials_options_set_key_materials_config_type)(grpc_tls_credentials_options* options, grpc_tls_key_materials_config* config);
465
- extern grpc_tls_credentials_options_set_key_materials_config_type grpc_tls_credentials_options_set_key_materials_config_import;
466
- #define grpc_tls_credentials_options_set_key_materials_config grpc_tls_credentials_options_set_key_materials_config_import
467
- typedef int(*grpc_tls_credentials_options_set_credential_reload_config_type)(grpc_tls_credentials_options* options, grpc_tls_credential_reload_config* config);
468
- extern grpc_tls_credentials_options_set_credential_reload_config_type grpc_tls_credentials_options_set_credential_reload_config_import;
469
- #define grpc_tls_credentials_options_set_credential_reload_config grpc_tls_credentials_options_set_credential_reload_config_import
470
- typedef int(*grpc_tls_credentials_options_set_server_authorization_check_config_type)(grpc_tls_credentials_options* options, grpc_tls_server_authorization_check_config* config);
491
+ typedef void(*grpc_tls_credentials_options_set_certificate_provider_type)(grpc_tls_credentials_options* options, grpc_tls_certificate_provider* provider);
492
+ extern grpc_tls_credentials_options_set_certificate_provider_type grpc_tls_credentials_options_set_certificate_provider_import;
493
+ #define grpc_tls_credentials_options_set_certificate_provider grpc_tls_credentials_options_set_certificate_provider_import
494
+ typedef void(*grpc_tls_credentials_options_watch_root_certs_type)(grpc_tls_credentials_options* options);
495
+ extern grpc_tls_credentials_options_watch_root_certs_type grpc_tls_credentials_options_watch_root_certs_import;
496
+ #define grpc_tls_credentials_options_watch_root_certs grpc_tls_credentials_options_watch_root_certs_import
497
+ typedef void(*grpc_tls_credentials_options_set_root_cert_name_type)(grpc_tls_credentials_options* options, const char* root_cert_name);
498
+ extern grpc_tls_credentials_options_set_root_cert_name_type grpc_tls_credentials_options_set_root_cert_name_import;
499
+ #define grpc_tls_credentials_options_set_root_cert_name grpc_tls_credentials_options_set_root_cert_name_import
500
+ typedef void(*grpc_tls_credentials_options_watch_identity_key_cert_pairs_type)(grpc_tls_credentials_options* options);
501
+ extern grpc_tls_credentials_options_watch_identity_key_cert_pairs_type grpc_tls_credentials_options_watch_identity_key_cert_pairs_import;
502
+ #define grpc_tls_credentials_options_watch_identity_key_cert_pairs grpc_tls_credentials_options_watch_identity_key_cert_pairs_import
503
+ typedef void(*grpc_tls_credentials_options_set_identity_cert_name_type)(grpc_tls_credentials_options* options, const char* identity_cert_name);
504
+ extern grpc_tls_credentials_options_set_identity_cert_name_type grpc_tls_credentials_options_set_identity_cert_name_import;
505
+ #define grpc_tls_credentials_options_set_identity_cert_name grpc_tls_credentials_options_set_identity_cert_name_import
506
+ typedef void(*grpc_tls_credentials_options_set_server_authorization_check_config_type)(grpc_tls_credentials_options* options, grpc_tls_server_authorization_check_config* config);
471
507
  extern grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls_credentials_options_set_server_authorization_check_config_import;
472
508
  #define grpc_tls_credentials_options_set_server_authorization_check_config grpc_tls_credentials_options_set_server_authorization_check_config_import
473
- typedef grpc_tls_key_materials_config*(*grpc_tls_key_materials_config_create_type)(void);
474
- extern grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_create_import;
475
- #define grpc_tls_key_materials_config_create grpc_tls_key_materials_config_create_import
476
- typedef int(*grpc_tls_key_materials_config_set_key_materials_type)(grpc_tls_key_materials_config* config, const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair** pem_key_cert_pairs, size_t num_key_cert_pairs);
477
- extern grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import;
478
- #define grpc_tls_key_materials_config_set_key_materials grpc_tls_key_materials_config_set_key_materials_import
479
- typedef int(*grpc_tls_key_materials_config_set_version_type)(grpc_tls_key_materials_config* config, int version);
480
- extern grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import;
481
- #define grpc_tls_key_materials_config_set_version grpc_tls_key_materials_config_set_version_import
482
- typedef int(*grpc_tls_key_materials_config_get_version_type)(grpc_tls_key_materials_config* config);
483
- extern grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import;
484
- #define grpc_tls_key_materials_config_get_version grpc_tls_key_materials_config_get_version_import
485
- typedef grpc_tls_credential_reload_config*(*grpc_tls_credential_reload_config_create_type)(const void* config_user_data, int (*schedule)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*cancel)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*destruct)(void* config_user_data));
486
- extern grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import;
487
- #define grpc_tls_credential_reload_config_create grpc_tls_credential_reload_config_create_import
488
509
  typedef grpc_tls_server_authorization_check_config*(*grpc_tls_server_authorization_check_config_create_type)(const void* config_user_data, int (*schedule)(void* config_user_data, grpc_tls_server_authorization_check_arg* arg), void (*cancel)(void* config_user_data, grpc_tls_server_authorization_check_arg* arg), void (*destruct)(void* config_user_data));
489
510
  extern grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
490
511
  #define grpc_tls_server_authorization_check_config_create grpc_tls_server_authorization_check_config_create_import
512
+ typedef void(*grpc_tls_server_authorization_check_config_release_type)(grpc_tls_server_authorization_check_config* config);
513
+ extern grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authorization_check_config_release_import;
514
+ #define grpc_tls_server_authorization_check_config_release grpc_tls_server_authorization_check_config_release_import
515
+ typedef grpc_channel_credentials*(*grpc_xds_credentials_create_type)(grpc_channel_credentials* fallback_credentials);
516
+ extern grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
517
+ #define grpc_xds_credentials_create grpc_xds_credentials_create_import
518
+ typedef grpc_server_credentials*(*grpc_xds_server_credentials_create_type)(grpc_server_credentials* fallback_credentials);
519
+ extern grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
520
+ #define grpc_xds_server_credentials_create grpc_xds_server_credentials_create_import
491
521
  typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
492
522
  extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
493
523
  #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
@@ -500,7 +530,7 @@ extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
500
530
  typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer* bb);
501
531
  extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
502
532
  #define grpc_byte_buffer_length grpc_byte_buffer_length_import
503
- typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* byte_buffer);
533
+ typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* bb);
504
534
  extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
505
535
  #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
506
536
  typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer);
@@ -668,7 +698,7 @@ extern grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
668
698
  typedef void(*grpc_slice_buffer_move_into_type)(grpc_slice_buffer* src, grpc_slice_buffer* dst);
669
699
  extern grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
670
700
  #define grpc_slice_buffer_move_into grpc_slice_buffer_move_into_import
671
- typedef void(*grpc_slice_buffer_trim_end_type)(grpc_slice_buffer* src, size_t n, grpc_slice_buffer* garbage);
701
+ typedef void(*grpc_slice_buffer_trim_end_type)(grpc_slice_buffer* sb, size_t n, grpc_slice_buffer* garbage);
672
702
  extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
673
703
  #define grpc_slice_buffer_trim_end grpc_slice_buffer_trim_end_import
674
704
  typedef void(*grpc_slice_buffer_move_first_type)(grpc_slice_buffer* src, size_t n, grpc_slice_buffer* dst);
@@ -680,10 +710,10 @@ extern grpc_slice_buffer_move_first_no_ref_type grpc_slice_buffer_move_first_no_
680
710
  typedef void(*grpc_slice_buffer_move_first_into_buffer_type)(grpc_slice_buffer* src, size_t n, void* dst);
681
711
  extern grpc_slice_buffer_move_first_into_buffer_type grpc_slice_buffer_move_first_into_buffer_import;
682
712
  #define grpc_slice_buffer_move_first_into_buffer grpc_slice_buffer_move_first_into_buffer_import
683
- typedef grpc_slice(*grpc_slice_buffer_take_first_type)(grpc_slice_buffer* src);
713
+ typedef grpc_slice(*grpc_slice_buffer_take_first_type)(grpc_slice_buffer* sb);
684
714
  extern grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
685
715
  #define grpc_slice_buffer_take_first grpc_slice_buffer_take_first_import
686
- typedef void(*grpc_slice_buffer_undo_take_first_type)(grpc_slice_buffer* src, grpc_slice slice);
716
+ typedef void(*grpc_slice_buffer_undo_take_first_type)(grpc_slice_buffer* sb, grpc_slice slice);
687
717
  extern grpc_slice_buffer_undo_take_first_type grpc_slice_buffer_undo_take_first_import;
688
718
  #define grpc_slice_buffer_undo_take_first grpc_slice_buffer_undo_take_first_import
689
719
  typedef void*(*gpr_malloc_type)(size_t size);
@@ -749,7 +779,7 @@ extern gpr_cv_signal_type gpr_cv_signal_import;
749
779
  typedef void(*gpr_cv_broadcast_type)(gpr_cv* cv);
750
780
  extern gpr_cv_broadcast_type gpr_cv_broadcast_import;
751
781
  #define gpr_cv_broadcast gpr_cv_broadcast_import
752
- typedef void(*gpr_once_init_type)(gpr_once* once, void (*init_routine)(void));
782
+ typedef void(*gpr_once_init_type)(gpr_once* once, void (*init_function)(void));
753
783
  extern gpr_once_init_type gpr_once_init_import;
754
784
  #define gpr_once_init gpr_once_init_import
755
785
  typedef void(*gpr_event_init_type)(gpr_event* ev);
@@ -809,7 +839,7 @@ extern gpr_time_init_type gpr_time_init_import;
809
839
  typedef gpr_timespec(*gpr_now_type)(gpr_clock_type clock);
810
840
  extern gpr_now_type gpr_now_import;
811
841
  #define gpr_now gpr_now_import
812
- typedef gpr_timespec(*gpr_convert_clock_type_type)(gpr_timespec t, gpr_clock_type target_clock);
842
+ typedef gpr_timespec(*gpr_convert_clock_type_type)(gpr_timespec t, gpr_clock_type clock_type);
813
843
  extern gpr_convert_clock_type_type gpr_convert_clock_type_import;
814
844
  #define gpr_convert_clock_type gpr_convert_clock_type_import
815
845
  typedef int(*gpr_time_cmp_type)(gpr_timespec a, gpr_timespec b);
@@ -827,22 +857,22 @@ extern gpr_time_add_type gpr_time_add_import;
827
857
  typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
828
858
  extern gpr_time_sub_type gpr_time_sub_import;
829
859
  #define gpr_time_sub gpr_time_sub_import
830
- typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t x, gpr_clock_type clock_type);
860
+ typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t us, gpr_clock_type clock_type);
831
861
  extern gpr_time_from_micros_type gpr_time_from_micros_import;
832
862
  #define gpr_time_from_micros gpr_time_from_micros_import
833
- typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t x, gpr_clock_type clock_type);
863
+ typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t ns, gpr_clock_type clock_type);
834
864
  extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
835
865
  #define gpr_time_from_nanos gpr_time_from_nanos_import
836
- typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t x, gpr_clock_type clock_type);
866
+ typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t ms, gpr_clock_type clock_type);
837
867
  extern gpr_time_from_millis_type gpr_time_from_millis_import;
838
868
  #define gpr_time_from_millis gpr_time_from_millis_import
839
- typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t x, gpr_clock_type clock_type);
869
+ typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t s, gpr_clock_type clock_type);
840
870
  extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
841
871
  #define gpr_time_from_seconds gpr_time_from_seconds_import
842
- typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t x, gpr_clock_type clock_type);
872
+ typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t m, gpr_clock_type clock_type);
843
873
  extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
844
874
  #define gpr_time_from_minutes gpr_time_from_minutes_import
845
- typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t x, gpr_clock_type clock_type);
875
+ typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t h, gpr_clock_type clock_type);
846
876
  extern gpr_time_from_hours_type gpr_time_from_hours_import;
847
877
  #define gpr_time_from_hours gpr_time_from_hours_import
848
878
  typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.32.0.pre1'
17
+ VERSION = '1.35.0'
18
18
  end
@@ -76,6 +76,28 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
76
76
  add_message "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer" do
77
77
  map :rpcs_by_peer, :string, :int32, 1
78
78
  end
79
+ add_message "grpc.testing.LoadBalancerAccumulatedStatsRequest" do
80
+ end
81
+ add_message "grpc.testing.LoadBalancerAccumulatedStatsResponse" do
82
+ map :num_rpcs_started_by_method, :string, :int32, 1
83
+ map :num_rpcs_succeeded_by_method, :string, :int32, 2
84
+ map :num_rpcs_failed_by_method, :string, :int32, 3
85
+ end
86
+ add_message "grpc.testing.ClientConfigureRequest" do
87
+ repeated :types, :enum, 1, "grpc.testing.ClientConfigureRequest.RpcType"
88
+ repeated :metadata, :message, 2, "grpc.testing.ClientConfigureRequest.Metadata"
89
+ end
90
+ add_message "grpc.testing.ClientConfigureRequest.Metadata" do
91
+ optional :type, :enum, 1, "grpc.testing.ClientConfigureRequest.RpcType"
92
+ optional :key, :string, 2
93
+ optional :value, :string, 3
94
+ end
95
+ add_enum "grpc.testing.ClientConfigureRequest.RpcType" do
96
+ value :EMPTY_CALL, 0
97
+ value :UNARY_CALL, 1
98
+ end
99
+ add_message "grpc.testing.ClientConfigureResponse" do
100
+ end
79
101
  add_enum "grpc.testing.PayloadType" do
80
102
  value :COMPRESSABLE, 0
81
103
  end
@@ -104,6 +126,12 @@ module Grpc
104
126
  LoadBalancerStatsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsRequest").msgclass
105
127
  LoadBalancerStatsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse").msgclass
106
128
  LoadBalancerStatsResponse::RpcsByPeer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse.RpcsByPeer").msgclass
129
+ LoadBalancerAccumulatedStatsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerAccumulatedStatsRequest").msgclass
130
+ LoadBalancerAccumulatedStatsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerAccumulatedStatsResponse").msgclass
131
+ ClientConfigureRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ClientConfigureRequest").msgclass
132
+ ClientConfigureRequest::Metadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ClientConfigureRequest.Metadata").msgclass
133
+ ClientConfigureRequest::RpcType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ClientConfigureRequest.RpcType").enummodule
134
+ ClientConfigureResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ClientConfigureResponse").msgclass
107
135
  PayloadType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule
108
136
  GrpclbRouteType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GrpclbRouteType").enummodule
109
137
  end
@@ -110,6 +110,8 @@ module Grpc
110
110
 
111
111
  # Gets the backend distribution for RPCs sent by a test client.
112
112
  rpc :GetClientStats, ::Grpc::Testing::LoadBalancerStatsRequest, ::Grpc::Testing::LoadBalancerStatsResponse
113
+ # Gets the accumulated stats for RPCs sent by a test client.
114
+ rpc :GetClientAccumulatedStats, ::Grpc::Testing::LoadBalancerAccumulatedStatsRequest, ::Grpc::Testing::LoadBalancerAccumulatedStatsResponse
113
115
  end
114
116
 
115
117
  Stub = Service.rpc_stub_class
@@ -128,6 +130,22 @@ module Grpc
128
130
  rpc :SetNotServing, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
129
131
  end
130
132
 
133
+ Stub = Service.rpc_stub_class
134
+ end
135
+ module XdsUpdateClientConfigureService
136
+ # A service to dynamically update the configuration of an xDS test client.
137
+ class Service
138
+
139
+ include GRPC::GenericService
140
+
141
+ self.marshal_class_method = :encode
142
+ self.unmarshal_class_method = :decode
143
+ self.service_name = 'grpc.testing.XdsUpdateClientConfigureService'
144
+
145
+ # Update the tes client's configuration.
146
+ rpc :Configure, ::Grpc::Testing::ClientConfigureRequest, ::Grpc::Testing::ClientConfigureResponse
147
+ end
148
+
131
149
  Stub = Service.rpc_stub_class
132
150
  end
133
151
  end
@@ -39,11 +39,38 @@ require_relative '../src/proto/grpc/testing/empty_pb'
39
39
  require_relative '../src/proto/grpc/testing/messages_pb'
40
40
  require_relative '../src/proto/grpc/testing/test_services_pb'
41
41
 
42
+ class RpcConfig
43
+ def init(rpcs_to_send, metadata_to_send)
44
+ @rpcs_to_send = rpcs_to_send
45
+ @metadata_to_send = metadata_to_send
46
+ end
47
+ def rpcs_to_send
48
+ @rpcs_to_send
49
+ end
50
+ def metadata_to_send
51
+ @metadata_to_send
52
+ end
53
+ end
54
+
55
+ # Some global constant mappings
56
+ $RPC_MAP = {
57
+ 'UnaryCall' => :UNARY_CALL,
58
+ 'EmptyCall' => :EMPTY_CALL,
59
+ }
60
+
42
61
  # Some global variables to be shared by server and client
43
62
  $watchers = Array.new
44
63
  $watchers_mutex = Mutex.new
45
64
  $watchers_cv = ConditionVariable.new
46
65
  $shutdown = false
66
+ # These can be configured by the test runner dynamically
67
+ $rpc_config = RpcConfig.new
68
+ $rpc_config.init([:UNARY_CALL], {})
69
+ # These stats are shared across threads
70
+ $accumulated_stats_mu = Mutex.new
71
+ $num_rpcs_started_by_method = {}
72
+ $num_rpcs_succeeded_by_method = {}
73
+ $num_rpcs_failed_by_method = {}
47
74
 
48
75
  # RubyLogger defines a logger for gRPC based on the standard ruby logger.
49
76
  module RubyLogger
@@ -71,6 +98,31 @@ def create_stub(opts)
71
98
  )
72
99
  end
73
100
 
101
+ class ConfigureTarget < Grpc::Testing::XdsUpdateClientConfigureService::Service
102
+ include Grpc::Testing
103
+
104
+ def configure(req, _call)
105
+ rpcs_to_send = req['types'];
106
+ metadata_to_send = {}
107
+ req['metadata'].each do |m|
108
+ rpc = m.type
109
+ if !metadata_to_send.key?(rpc)
110
+ metadata_to_send[rpc] = {}
111
+ end
112
+ metadata_key = m.key
113
+ metadata_value = m.value
114
+ metadata_to_send[rpc][metadata_key] = metadata_value
115
+ end
116
+ GRPC.logger.info("Configuring new rpcs_to_send and metadata_to_send...")
117
+ GRPC.logger.info(rpcs_to_send)
118
+ GRPC.logger.info(metadata_to_send)
119
+ new_rpc_config = RpcConfig.new
120
+ new_rpc_config.init(rpcs_to_send, metadata_to_send)
121
+ $rpc_config = new_rpc_config
122
+ ClientConfigureResponse.new();
123
+ end
124
+ end
125
+
74
126
  # This implements LoadBalancerStatsService required by the test runner
75
127
  class TestTarget < Grpc::Testing::LoadBalancerStatsService::Service
76
128
  include Grpc::Testing
@@ -109,10 +161,20 @@ class TestTarget < Grpc::Testing::LoadBalancerStatsService::Service
109
161
  num_failures: watcher['no_remote_peer'] + watcher['rpcs_needed']
110
162
  );
111
163
  end
164
+
165
+ def get_client_accumulated_stats(req, _call)
166
+ $accumulated_stats_mu.synchronize do
167
+ LoadBalancerAccumulatedStatsResponse.new(
168
+ num_rpcs_started_by_method: $num_rpcs_started_by_method,
169
+ num_rpcs_succeeded_by_method: $num_rpcs_succeeded_by_method,
170
+ num_rpcs_failed_by_method: $num_rpcs_failed_by_method
171
+ )
172
+ end
173
+ end
112
174
  end
113
175
 
114
176
  # execute 1 RPC and return remote hostname
115
- def execute_rpc(op, fail_on_failed_rpcs)
177
+ def execute_rpc(op, fail_on_failed_rpcs, rpc_stats_key)
116
178
  remote_peer = ""
117
179
  begin
118
180
  op.execute
@@ -120,60 +182,108 @@ def execute_rpc(op, fail_on_failed_rpcs)
120
182
  remote_peer = op.metadata['hostname']
121
183
  end
122
184
  rescue GRPC::BadStatus => e
123
- GRPC.logger.info("ruby xds: rpc failed:|#{e.message}|, " \
124
- "this may or may not be expected")
125
185
  if fail_on_failed_rpcs
126
186
  raise e
127
187
  end
128
188
  end
189
+ $accumulated_stats_mu.synchronize do
190
+ if remote_peer.empty?
191
+ $num_rpcs_failed_by_method[rpc_stats_key] += 1
192
+ else
193
+ $num_rpcs_succeeded_by_method[rpc_stats_key] += 1
194
+ end
195
+ end
129
196
  remote_peer
130
197
  end
131
198
 
199
+ def execute_rpc_in_thread(op, rpc_stats_key)
200
+ Thread.new {
201
+ begin
202
+ op.execute
203
+ # The following should _not_ happen with the current spec
204
+ # because we are only executing RPCs in a thread if we expect it
205
+ # to be kept open, or deadline_exceeded, or dropped by the load
206
+ # balancing policy. These RPCs should not complete successfully.
207
+ # Doing this for consistency
208
+ $accumulated_stats_mu.synchronize do
209
+ $num_rpcs_succeeded_by_method[rpc_stats_key] += 1
210
+ end
211
+ rescue GRPC::BadStatus => e
212
+ # Normal execution arrives here,
213
+ # either because of deadline_exceeded or "call dropped by load
214
+ # balancing policy"
215
+ $accumulated_stats_mu.synchronize do
216
+ $num_rpcs_failed_by_method[rpc_stats_key] += 1
217
+ end
218
+ end
219
+ }
220
+ end
221
+
132
222
  # send 1 rpc every 1/qps second
133
- def run_test_loop(stub, target_seconds_between_rpcs, fail_on_failed_rpcs,
134
- rpcs_to_send, metadata_to_send)
223
+ def run_test_loop(stub, target_seconds_between_rpcs, fail_on_failed_rpcs)
135
224
  include Grpc::Testing
136
225
  simple_req = SimpleRequest.new()
137
226
  empty_req = Empty.new()
138
227
  target_next_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
228
+ # Some RPCs are meant to be "kept open". Since Ruby does not have an
229
+ # async API, we are executing those RPCs in a thread so that they don't
230
+ # block.
231
+ keep_open_threads = Array.new
139
232
  while !$shutdown
140
233
  now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
141
234
  sleep_seconds = target_next_start - now
142
235
  if sleep_seconds < 0
143
236
  target_next_start = now + target_seconds_between_rpcs
144
- GRPC.logger.info(
145
- "ruby xds: warning, rpc takes too long to finish. " \
146
- "Deficit = %.1fms. " \
147
- "If you consistently see this, the qps is too high." \
148
- % [(sleep_seconds * 1000).abs().round(1)])
149
237
  else
150
238
  target_next_start += target_seconds_between_rpcs
151
239
  sleep(sleep_seconds)
152
240
  end
153
241
  deadline = GRPC::Core::TimeConsts::from_relative_time(30) # 30 seconds
154
242
  results = {}
155
- rpcs_to_send.each do |rpc|
156
- metadata = metadata_to_send.key?(rpc) ? metadata_to_send[rpc] : {}
157
- if rpc == 'UnaryCall'
243
+ $rpc_config.rpcs_to_send.each do |rpc|
244
+ # rpc is in the form of :UNARY_CALL or :EMPTY_CALL here
245
+ metadata = $rpc_config.metadata_to_send.key?(rpc) ?
246
+ $rpc_config.metadata_to_send[rpc] : {}
247
+ $accumulated_stats_mu.synchronize do
248
+ $num_rpcs_started_by_method[rpc.to_s] += 1
249
+ num_started = $num_rpcs_started_by_method[rpc.to_s]
250
+ if num_started % 100 == 0
251
+ GRPC.logger.info("Started #{num_started} of #{rpc}")
252
+ end
253
+ end
254
+ if rpc == :UNARY_CALL
158
255
  op = stub.unary_call(simple_req,
159
256
  metadata: metadata,
160
257
  deadline: deadline,
161
258
  return_op: true)
162
- elsif rpc == 'EmptyCall'
259
+ elsif rpc == :EMPTY_CALL
163
260
  op = stub.empty_call(empty_req,
164
261
  metadata: metadata,
165
262
  deadline: deadline,
166
263
  return_op: true)
167
264
  else
168
- raise "Unsupported rpc %s" % [rpc]
265
+ raise "Unsupported rpc #{rpc}"
266
+ end
267
+ rpc_stats_key = rpc.to_s
268
+ if metadata.key?('rpc-behavior') and
269
+ (metadata['rpc-behavior'] == 'keep-open')
270
+ num_open_threads = keep_open_threads.size
271
+ if num_open_threads % 50 == 0
272
+ GRPC.logger.info("number of keep_open_threads = #{num_open_threads}")
273
+ end
274
+ keep_open_threads << execute_rpc_in_thread(op, rpc_stats_key)
275
+ else
276
+ results[rpc] = execute_rpc(op, fail_on_failed_rpcs, rpc_stats_key)
169
277
  end
170
- results[rpc] = execute_rpc(op, fail_on_failed_rpcs)
171
278
  end
172
279
  $watchers_mutex.synchronize do
173
280
  $watchers.each do |watcher|
174
281
  # this is counted once when each group of all rpcs_to_send were done
175
282
  watcher['rpcs_needed'] -= 1
176
283
  results.each do |rpc_name, remote_peer|
284
+ # These stats expect rpc_name to be in the form of
285
+ # UnaryCall or EmptyCall, not the underscore-case all-caps form
286
+ rpc_name = $RPC_MAP.invert()[rpc_name]
177
287
  if remote_peer.strip.empty?
178
288
  # error is counted per individual RPC
179
289
  watcher['no_remote_peer'] += 1
@@ -191,6 +301,7 @@ def run_test_loop(stub, target_seconds_between_rpcs, fail_on_failed_rpcs,
191
301
  $watchers_cv.broadcast
192
302
  end
193
303
  end
304
+ keep_open_threads.each { |thd| thd.join }
194
305
  end
195
306
 
196
307
  # Args is used to hold the command line info.
@@ -242,18 +353,22 @@ def main
242
353
  s = GRPC::RpcServer.new
243
354
  s.add_http2_port(host, :this_port_is_insecure)
244
355
  s.handle(TestTarget)
356
+ s.handle(ConfigureTarget)
245
357
  server_thread = Thread.new {
246
358
  # run the server until the main test runner terminates this process
247
359
  s.run_till_terminated_or_interrupted(['TERM'])
248
360
  }
249
361
 
250
- # The client just sends unary rpcs continuously in a regular interval
362
+ # Initialize stats
363
+ $RPC_MAP.values.each do |rpc|
364
+ $num_rpcs_started_by_method[rpc.to_s] = 0
365
+ $num_rpcs_succeeded_by_method[rpc.to_s] = 0
366
+ $num_rpcs_failed_by_method[rpc.to_s] = 0
367
+ end
368
+
369
+ # The client just sends rpcs continuously in a regular interval
251
370
  stub = create_stub(opts)
252
371
  target_seconds_between_rpcs = (1.0 / opts['qps'].to_f)
253
- rpcs_to_send = []
254
- if opts['rpc']
255
- rpcs_to_send = opts['rpc'].split(',')
256
- end
257
372
  # Convert 'metadata' input in the form of
258
373
  # rpc1:k1:v1,rpc2:k2:v2,rpc1:k3:v3
259
374
  # into
@@ -266,11 +381,13 @@ def main
266
381
  # 'k2' => 'v2'
267
382
  # },
268
383
  # }
384
+ rpcs_to_send = []
269
385
  metadata_to_send = {}
270
386
  if opts['metadata']
271
387
  metadata_entries = opts['metadata'].split(',')
272
388
  metadata_entries.each do |e|
273
389
  (rpc_name, metadata_key, metadata_value) = e.split(':')
390
+ rpc_name = $RPC_MAP[rpc_name]
274
391
  # initialize if we haven't seen this rpc_name yet
275
392
  if !metadata_to_send.key?(rpc_name)
276
393
  metadata_to_send[rpc_name] = {}
@@ -278,12 +395,20 @@ def main
278
395
  metadata_to_send[rpc_name][metadata_key] = metadata_value
279
396
  end
280
397
  end
398
+ if opts['rpc']
399
+ rpcs_to_send = opts['rpc'].split(',')
400
+ end
401
+ if rpcs_to_send.size > 0
402
+ rpcs_to_send.map! { |rpc| $RPC_MAP[rpc] }
403
+ new_rpc_config = RpcConfig.new
404
+ new_rpc_config.init(rpcs_to_send, metadata_to_send)
405
+ $rpc_config = new_rpc_config
406
+ end
281
407
  client_threads = Array.new
282
408
  opts['num_channels'].times {
283
409
  client_threads << Thread.new {
284
410
  run_test_loop(stub, target_seconds_between_rpcs,
285
- opts['fail_on_failed_rpcs'],
286
- rpcs_to_send, metadata_to_send)
411
+ opts['fail_on_failed_rpcs'])
287
412
  }
288
413
  }
289
414