grpc 1.34.0-x86-mingw32 → 1.35.0.pre1-x86-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.

Binary file
Binary file
@@ -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*);
@@ -80,6 +80,9 @@ grpc_server_register_method_type grpc_server_register_method_import;
80
80
  grpc_server_request_registered_call_type grpc_server_request_registered_call_import;
81
81
  grpc_server_create_type grpc_server_create_import;
82
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;
83
86
  grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
84
87
  grpc_server_start_type grpc_server_start_import;
85
88
  grpc_server_shutdown_and_notify_type grpc_server_shutdown_and_notify_import;
@@ -130,6 +133,7 @@ grpc_composite_call_credentials_create_type grpc_composite_call_credentials_crea
130
133
  grpc_google_compute_engine_credentials_create_type grpc_google_compute_engine_credentials_create_import;
131
134
  grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
132
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;
133
137
  grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
134
138
  grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
135
139
  grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
@@ -162,6 +166,7 @@ grpc_tls_identity_pairs_create_type grpc_tls_identity_pairs_create_import;
162
166
  grpc_tls_identity_pairs_add_pair_type grpc_tls_identity_pairs_add_pair_import;
163
167
  grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_import;
164
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;
165
170
  grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
166
171
  grpc_tls_credentials_options_create_type grpc_tls_credentials_options_create_import;
167
172
  grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
@@ -175,6 +180,7 @@ grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls
175
180
  grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
176
181
  grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authorization_check_config_release_import;
177
182
  grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
183
+ grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
178
184
  grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
179
185
  grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
180
186
  grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
@@ -358,6 +364,9 @@ void grpc_rb_load_imports(HMODULE library) {
358
364
  grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call");
359
365
  grpc_server_create_import = (grpc_server_create_type) GetProcAddress(library, "grpc_server_create");
360
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");
361
370
  grpc_server_add_insecure_http2_port_import = (grpc_server_add_insecure_http2_port_type) GetProcAddress(library, "grpc_server_add_insecure_http2_port");
362
371
  grpc_server_start_import = (grpc_server_start_type) GetProcAddress(library, "grpc_server_start");
363
372
  grpc_server_shutdown_and_notify_import = (grpc_server_shutdown_and_notify_type) GetProcAddress(library, "grpc_server_shutdown_and_notify");
@@ -408,6 +417,7 @@ void grpc_rb_load_imports(HMODULE library) {
408
417
  grpc_google_compute_engine_credentials_create_import = (grpc_google_compute_engine_credentials_create_type) GetProcAddress(library, "grpc_google_compute_engine_credentials_create");
409
418
  grpc_max_auth_token_lifetime_import = (grpc_max_auth_token_lifetime_type) GetProcAddress(library, "grpc_max_auth_token_lifetime");
410
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");
411
421
  grpc_google_refresh_token_credentials_create_import = (grpc_google_refresh_token_credentials_create_type) GetProcAddress(library, "grpc_google_refresh_token_credentials_create");
412
422
  grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
413
423
  grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
@@ -440,6 +450,7 @@ void grpc_rb_load_imports(HMODULE library) {
440
450
  grpc_tls_identity_pairs_add_pair_import = (grpc_tls_identity_pairs_add_pair_type) GetProcAddress(library, "grpc_tls_identity_pairs_add_pair");
441
451
  grpc_tls_identity_pairs_destroy_import = (grpc_tls_identity_pairs_destroy_type) GetProcAddress(library, "grpc_tls_identity_pairs_destroy");
442
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");
443
454
  grpc_tls_certificate_provider_release_import = (grpc_tls_certificate_provider_release_type) GetProcAddress(library, "grpc_tls_certificate_provider_release");
444
455
  grpc_tls_credentials_options_create_import = (grpc_tls_credentials_options_create_type) GetProcAddress(library, "grpc_tls_credentials_options_create");
445
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");
@@ -453,6 +464,7 @@ void grpc_rb_load_imports(HMODULE library) {
453
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");
454
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");
455
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");
456
468
  grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
457
469
  grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
458
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);
@@ -215,6 +215,15 @@ extern grpc_server_create_type grpc_server_create_import;
215
215
  typedef void(*grpc_server_register_completion_queue_type)(grpc_server* server, grpc_completion_queue* cq, void* reserved);
216
216
  extern grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
217
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
218
227
  typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server* server, const char* addr);
219
228
  extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
220
229
  #define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import
@@ -365,6 +374,9 @@ extern grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
365
374
  typedef grpc_call_credentials*(*grpc_service_account_jwt_access_credentials_create_type)(const char* json_key, gpr_timespec token_lifetime, void* reserved);
366
375
  extern grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
367
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
368
380
  typedef grpc_call_credentials*(*grpc_google_refresh_token_credentials_create_type)(const char* json_refresh_token, void* reserved);
369
381
  extern grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
370
382
  #define grpc_google_refresh_token_credentials_create grpc_google_refresh_token_credentials_create_import
@@ -461,6 +473,9 @@ extern grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_impo
461
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);
462
474
  extern grpc_tls_certificate_provider_static_data_create_type grpc_tls_certificate_provider_static_data_create_import;
463
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
464
479
  typedef void(*grpc_tls_certificate_provider_release_type)(grpc_tls_certificate_provider* provider);
465
480
  extern grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
466
481
  #define grpc_tls_certificate_provider_release grpc_tls_certificate_provider_release_import
@@ -500,6 +515,9 @@ extern grpc_tls_server_authorization_check_config_release_type grpc_tls_server_a
500
515
  typedef grpc_channel_credentials*(*grpc_xds_credentials_create_type)(grpc_channel_credentials* fallback_credentials);
501
516
  extern grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
502
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
503
521
  typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
504
522
  extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
505
523
  #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
@@ -512,7 +530,7 @@ extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
512
530
  typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer* bb);
513
531
  extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
514
532
  #define grpc_byte_buffer_length grpc_byte_buffer_length_import
515
- typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* byte_buffer);
533
+ typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* bb);
516
534
  extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
517
535
  #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
518
536
  typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer);
@@ -680,7 +698,7 @@ extern grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
680
698
  typedef void(*grpc_slice_buffer_move_into_type)(grpc_slice_buffer* src, grpc_slice_buffer* dst);
681
699
  extern grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
682
700
  #define grpc_slice_buffer_move_into grpc_slice_buffer_move_into_import
683
- 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);
684
702
  extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
685
703
  #define grpc_slice_buffer_trim_end grpc_slice_buffer_trim_end_import
686
704
  typedef void(*grpc_slice_buffer_move_first_type)(grpc_slice_buffer* src, size_t n, grpc_slice_buffer* dst);
@@ -692,10 +710,10 @@ extern grpc_slice_buffer_move_first_no_ref_type grpc_slice_buffer_move_first_no_
692
710
  typedef void(*grpc_slice_buffer_move_first_into_buffer_type)(grpc_slice_buffer* src, size_t n, void* dst);
693
711
  extern grpc_slice_buffer_move_first_into_buffer_type grpc_slice_buffer_move_first_into_buffer_import;
694
712
  #define grpc_slice_buffer_move_first_into_buffer grpc_slice_buffer_move_first_into_buffer_import
695
- 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);
696
714
  extern grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
697
715
  #define grpc_slice_buffer_take_first grpc_slice_buffer_take_first_import
698
- 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);
699
717
  extern grpc_slice_buffer_undo_take_first_type grpc_slice_buffer_undo_take_first_import;
700
718
  #define grpc_slice_buffer_undo_take_first grpc_slice_buffer_undo_take_first_import
701
719
  typedef void*(*gpr_malloc_type)(size_t size);
@@ -761,7 +779,7 @@ extern gpr_cv_signal_type gpr_cv_signal_import;
761
779
  typedef void(*gpr_cv_broadcast_type)(gpr_cv* cv);
762
780
  extern gpr_cv_broadcast_type gpr_cv_broadcast_import;
763
781
  #define gpr_cv_broadcast gpr_cv_broadcast_import
764
- 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));
765
783
  extern gpr_once_init_type gpr_once_init_import;
766
784
  #define gpr_once_init gpr_once_init_import
767
785
  typedef void(*gpr_event_init_type)(gpr_event* ev);
@@ -821,7 +839,7 @@ extern gpr_time_init_type gpr_time_init_import;
821
839
  typedef gpr_timespec(*gpr_now_type)(gpr_clock_type clock);
822
840
  extern gpr_now_type gpr_now_import;
823
841
  #define gpr_now gpr_now_import
824
- 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);
825
843
  extern gpr_convert_clock_type_type gpr_convert_clock_type_import;
826
844
  #define gpr_convert_clock_type gpr_convert_clock_type_import
827
845
  typedef int(*gpr_time_cmp_type)(gpr_timespec a, gpr_timespec b);
@@ -839,22 +857,22 @@ extern gpr_time_add_type gpr_time_add_import;
839
857
  typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
840
858
  extern gpr_time_sub_type gpr_time_sub_import;
841
859
  #define gpr_time_sub gpr_time_sub_import
842
- 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);
843
861
  extern gpr_time_from_micros_type gpr_time_from_micros_import;
844
862
  #define gpr_time_from_micros gpr_time_from_micros_import
845
- 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);
846
864
  extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
847
865
  #define gpr_time_from_nanos gpr_time_from_nanos_import
848
- 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);
849
867
  extern gpr_time_from_millis_type gpr_time_from_millis_import;
850
868
  #define gpr_time_from_millis gpr_time_from_millis_import
851
- 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);
852
870
  extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
853
871
  #define gpr_time_from_seconds gpr_time_from_seconds_import
854
- 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);
855
873
  extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
856
874
  #define gpr_time_from_minutes gpr_time_from_minutes_import
857
- 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);
858
876
  extern gpr_time_from_hours_type gpr_time_from_hours_import;
859
877
  #define gpr_time_from_hours gpr_time_from_hours_import
860
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.34.0'
17
+ VERSION = '1.35.0.pre1'
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