grpc 1.7.3-x64-mingw32 → 1.8.0-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 +4 -4
- data/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/ext/grpc/extconf.rb +4 -2
- data/src/ruby/ext/grpc/rb_byte_buffer.c +5 -5
- data/src/ruby/ext/grpc/rb_byte_buffer.h +2 -2
- data/src/ruby/ext/grpc/rb_call.c +41 -42
- data/src/ruby/ext/grpc/rb_call.h +6 -6
- data/src/ruby/ext/grpc/rb_call_credentials.c +30 -30
- data/src/ruby/ext/grpc/rb_channel.c +87 -87
- data/src/ruby/ext/grpc/rb_channel_credentials.c +23 -23
- data/src/ruby/ext/grpc/rb_completion_queue.c +11 -11
- data/src/ruby/ext/grpc/rb_completion_queue.h +3 -3
- data/src/ruby/ext/grpc/rb_compression_options.c +20 -20
- data/src/ruby/ext/grpc/rb_event_thread.c +14 -14
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +8 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -58
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +242 -306
- data/src/ruby/ext/grpc/rb_server.c +23 -23
- data/src/ruby/ext/grpc/rb_server_credentials.c +13 -13
- data/src/ruby/lib/grpc/2.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +25 -12
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +14 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dd970dc370c47575042eb9f63d5767db8eb32d6758f41b8cff8bbb46438dc60
|
4
|
+
data.tar.gz: 6e93f89b30e74b369c61cf8ac59806f1e63947f6c71ebaa36005572be1e632f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31b5cbf4c754cf6f7eb4ebd7b4103f84b1b0b87766fea732b8cd447844972f0ba017156a6c70d709ec58ae1c191dc546742ddbbcf55c07b59edd557fdb62123
|
7
|
+
data.tar.gz: 6e78523890c31acdd9ee86c9ccb4622e8d9e313dd4f579c142f91c5abcf6e122884a6327fda3ec4d3e5a6b2c876701e4149d04f44ea21c4b978a1605203efd7e
|
data/grpc_c.32.ruby
CHANGED
Binary file
|
data/grpc_c.64.ruby
CHANGED
Binary file
|
@@ -41,6 +41,7 @@ LIB_DIRS = [
|
|
41
41
|
]
|
42
42
|
|
43
43
|
windows = RUBY_PLATFORM =~ /mingw|mswin/
|
44
|
+
bsd = RUBY_PLATFORM =~ /bsd/
|
44
45
|
|
45
46
|
grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
|
46
47
|
|
@@ -60,7 +61,7 @@ ENV['EMBED_ZLIB'] = 'true'
|
|
60
61
|
ENV['EMBED_CARES'] = 'true'
|
61
62
|
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
|
62
63
|
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
|
63
|
-
ENV['
|
64
|
+
ENV['CPPFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
|
64
65
|
|
65
66
|
output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
|
66
67
|
grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
|
@@ -70,7 +71,8 @@ unless windows
|
|
70
71
|
puts 'Building internal gRPC into ' + grpc_lib_dir
|
71
72
|
nproc = 4
|
72
73
|
nproc = Etc.nprocessors * 2 if Etc.respond_to? :nprocessors
|
73
|
-
|
74
|
+
make = bsd ? 'gmake' : 'make'
|
75
|
+
system("#{make} -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config} Q=")
|
74
76
|
exit 1 unless $? == 0
|
75
77
|
end
|
76
78
|
|
@@ -26,14 +26,14 @@
|
|
26
26
|
#include <grpc/slice.h>
|
27
27
|
#include "rb_grpc.h"
|
28
28
|
|
29
|
-
grpc_byte_buffer
|
29
|
+
grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char* string, size_t length) {
|
30
30
|
grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
|
31
|
-
grpc_byte_buffer
|
31
|
+
grpc_byte_buffer* buffer = grpc_raw_byte_buffer_create(&slice, 1);
|
32
32
|
grpc_slice_unref(slice);
|
33
33
|
return buffer;
|
34
34
|
}
|
35
35
|
|
36
|
-
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer
|
36
|
+
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer* buffer) {
|
37
37
|
VALUE rb_string;
|
38
38
|
grpc_byte_buffer_reader reader;
|
39
39
|
grpc_slice next;
|
@@ -46,7 +46,7 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
|
|
46
46
|
return Qnil;
|
47
47
|
}
|
48
48
|
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
|
49
|
-
rb_str_cat(rb_string, (const char
|
49
|
+
rb_str_cat(rb_string, (const char*)GRPC_SLICE_START_PTR(next),
|
50
50
|
GRPC_SLICE_LENGTH(next));
|
51
51
|
grpc_slice_unref(next);
|
52
52
|
}
|
@@ -59,6 +59,6 @@ VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice) {
|
|
59
59
|
rb_raise(rb_eRuntimeError,
|
60
60
|
"attempt to convert uninitialized grpc_slice to ruby string");
|
61
61
|
}
|
62
|
-
return rb_str_new((char
|
62
|
+
return rb_str_new((char*)GRPC_SLICE_START_PTR(slice),
|
63
63
|
GRPC_SLICE_LENGTH(slice));
|
64
64
|
}
|
@@ -24,10 +24,10 @@
|
|
24
24
|
#include <grpc/grpc.h>
|
25
25
|
|
26
26
|
/* Converts a char* with a length to a grpc_byte_buffer */
|
27
|
-
grpc_byte_buffer
|
27
|
+
grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char* string, size_t length);
|
28
28
|
|
29
29
|
/* Converts a grpc_byte_buffer to a ruby string */
|
30
|
-
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer
|
30
|
+
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer* buffer);
|
31
31
|
|
32
32
|
/* Converts a grpc_slice to a ruby string */
|
33
33
|
VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice);
|
data/src/ruby/ext/grpc/rb_call.c
CHANGED
@@ -24,7 +24,6 @@
|
|
24
24
|
#include <grpc/grpc.h>
|
25
25
|
#include <grpc/impl/codegen/compression_types.h>
|
26
26
|
#include <grpc/support/alloc.h>
|
27
|
-
#include <grpc/support/alloc.h>
|
28
27
|
#include <grpc/support/log.h>
|
29
28
|
|
30
29
|
#include "rb_byte_buffer.h"
|
@@ -81,11 +80,11 @@ static VALUE sym_status;
|
|
81
80
|
static VALUE sym_cancelled;
|
82
81
|
|
83
82
|
typedef struct grpc_rb_call {
|
84
|
-
grpc_call
|
85
|
-
grpc_completion_queue
|
83
|
+
grpc_call* wrapped;
|
84
|
+
grpc_completion_queue* queue;
|
86
85
|
} grpc_rb_call;
|
87
86
|
|
88
|
-
static void destroy_call(grpc_rb_call
|
87
|
+
static void destroy_call(grpc_rb_call* call) {
|
89
88
|
/* Ensure that we only try to destroy the call once */
|
90
89
|
if (call->wrapped != NULL) {
|
91
90
|
grpc_call_unref(call->wrapped);
|
@@ -96,19 +95,19 @@ static void destroy_call(grpc_rb_call *call) {
|
|
96
95
|
}
|
97
96
|
|
98
97
|
/* Destroys a Call. */
|
99
|
-
static void grpc_rb_call_destroy(void
|
98
|
+
static void grpc_rb_call_destroy(void* p) {
|
100
99
|
if (p == NULL) {
|
101
100
|
return;
|
102
101
|
}
|
103
|
-
destroy_call((grpc_rb_call
|
102
|
+
destroy_call((grpc_rb_call*)p);
|
104
103
|
xfree(p);
|
105
104
|
}
|
106
105
|
|
107
|
-
static size_t md_ary_datasize(const void
|
108
|
-
const grpc_metadata_array
|
106
|
+
static size_t md_ary_datasize(const void* p) {
|
107
|
+
const grpc_metadata_array* const ary = (grpc_metadata_array*)p;
|
109
108
|
size_t i, datasize = sizeof(grpc_metadata_array);
|
110
109
|
for (i = 0; i < ary->count; ++i) {
|
111
|
-
const grpc_metadata
|
110
|
+
const grpc_metadata* const md = &ary->metadata[i];
|
112
111
|
datasize += GRPC_SLICE_LENGTH(md->key);
|
113
112
|
datasize += GRPC_SLICE_LENGTH(md->value);
|
114
113
|
}
|
@@ -151,9 +150,9 @@ static const rb_data_type_t grpc_call_data_type = {"grpc_call",
|
|
151
150
|
VALUE rb_error_code_details;
|
152
151
|
|
153
152
|
/* Obtains the error detail string for given error code */
|
154
|
-
const char
|
153
|
+
const char* grpc_call_error_detail_of(grpc_call_error err) {
|
155
154
|
VALUE detail_ref = rb_hash_aref(rb_error_code_details, UINT2NUM(err));
|
156
|
-
const char
|
155
|
+
const char* detail = "unknown error code!";
|
157
156
|
if (detail_ref != Qnil) {
|
158
157
|
detail = StringValueCStr(detail_ref);
|
159
158
|
}
|
@@ -163,7 +162,7 @@ const char *grpc_call_error_detail_of(grpc_call_error err) {
|
|
163
162
|
/* Called by clients to cancel an RPC on the server.
|
164
163
|
Can be called multiple times, from any thread. */
|
165
164
|
static VALUE grpc_rb_call_cancel(VALUE self) {
|
166
|
-
grpc_rb_call
|
165
|
+
grpc_rb_call* call = NULL;
|
167
166
|
grpc_call_error err;
|
168
167
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
169
168
|
// This call has been closed
|
@@ -187,7 +186,7 @@ static VALUE grpc_rb_call_cancel(VALUE self) {
|
|
187
186
|
* message. */
|
188
187
|
static VALUE grpc_rb_call_cancel_with_status(VALUE self, VALUE status_code,
|
189
188
|
VALUE details) {
|
190
|
-
grpc_rb_call
|
189
|
+
grpc_rb_call* call = NULL;
|
191
190
|
grpc_call_error err;
|
192
191
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
193
192
|
// This call has been closed
|
@@ -217,7 +216,7 @@ static VALUE grpc_rb_call_cancel_with_status(VALUE self, VALUE status_code,
|
|
217
216
|
processed.
|
218
217
|
*/
|
219
218
|
static VALUE grpc_rb_call_close(VALUE self) {
|
220
|
-
grpc_rb_call
|
219
|
+
grpc_rb_call* call = NULL;
|
221
220
|
TypedData_Get_Struct(self, grpc_rb_call, &grpc_call_data_type, call);
|
222
221
|
if (call != NULL) {
|
223
222
|
destroy_call(call);
|
@@ -230,8 +229,8 @@ static VALUE grpc_rb_call_close(VALUE self) {
|
|
230
229
|
/* Called to obtain the peer that this call is connected to. */
|
231
230
|
static VALUE grpc_rb_call_get_peer(VALUE self) {
|
232
231
|
VALUE res = Qnil;
|
233
|
-
grpc_rb_call
|
234
|
-
char
|
232
|
+
grpc_rb_call* call = NULL;
|
233
|
+
char* peer = NULL;
|
235
234
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
236
235
|
rb_raise(grpc_rb_eCallError, "Cannot get peer value on closed call");
|
237
236
|
return Qnil;
|
@@ -246,9 +245,9 @@ static VALUE grpc_rb_call_get_peer(VALUE self) {
|
|
246
245
|
|
247
246
|
/* Called to obtain the x509 cert of an authenticated peer. */
|
248
247
|
static VALUE grpc_rb_call_get_peer_cert(VALUE self) {
|
249
|
-
grpc_rb_call
|
248
|
+
grpc_rb_call* call = NULL;
|
250
249
|
VALUE res = Qnil;
|
251
|
-
grpc_auth_context
|
250
|
+
grpc_auth_context* ctx = NULL;
|
252
251
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
253
252
|
rb_raise(grpc_rb_eCallError, "Cannot get peer cert on closed call");
|
254
253
|
return Qnil;
|
@@ -264,7 +263,7 @@ static VALUE grpc_rb_call_get_peer_cert(VALUE self) {
|
|
264
263
|
{
|
265
264
|
grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
|
266
265
|
ctx, GRPC_X509_PEM_CERT_PROPERTY_NAME);
|
267
|
-
const grpc_auth_property
|
266
|
+
const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it);
|
268
267
|
if (prop == NULL) {
|
269
268
|
return Qnil;
|
270
269
|
}
|
@@ -379,8 +378,8 @@ static VALUE grpc_rb_call_set_write_flag(VALUE self, VALUE write_flag) {
|
|
379
378
|
|
380
379
|
Sets credentials on a call */
|
381
380
|
static VALUE grpc_rb_call_set_credentials(VALUE self, VALUE credentials) {
|
382
|
-
grpc_rb_call
|
383
|
-
grpc_call_credentials
|
381
|
+
grpc_rb_call* call = NULL;
|
382
|
+
grpc_call_credentials* creds;
|
384
383
|
grpc_call_error err;
|
385
384
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
386
385
|
rb_raise(grpc_rb_eCallError, "Cannot set credentials of closed call");
|
@@ -407,12 +406,12 @@ static VALUE grpc_rb_call_set_credentials(VALUE self, VALUE credentials) {
|
|
407
406
|
grpc_rb_md_ary_capacity_hash_cb
|
408
407
|
*/
|
409
408
|
static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
410
|
-
grpc_metadata_array
|
409
|
+
grpc_metadata_array* md_ary = NULL;
|
411
410
|
long array_length;
|
412
411
|
long i;
|
413
412
|
grpc_slice key_slice;
|
414
413
|
grpc_slice value_slice;
|
415
|
-
char
|
414
|
+
char* tmp_str = NULL;
|
416
415
|
|
417
416
|
if (TYPE(key) == T_SYMBOL) {
|
418
417
|
key_slice = grpc_slice_from_static_string(rb_id2name(SYM2ID(key)));
|
@@ -482,7 +481,7 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
|
482
481
|
*/
|
483
482
|
static int grpc_rb_md_ary_capacity_hash_cb(VALUE key, VALUE val,
|
484
483
|
VALUE md_ary_obj) {
|
485
|
-
grpc_metadata_array
|
484
|
+
grpc_metadata_array* md_ary = NULL;
|
486
485
|
|
487
486
|
(void)key;
|
488
487
|
|
@@ -503,7 +502,7 @@ static int grpc_rb_md_ary_capacity_hash_cb(VALUE key, VALUE val,
|
|
503
502
|
/* grpc_rb_md_ary_convert converts a ruby metadata hash into
|
504
503
|
a grpc_metadata_array.
|
505
504
|
*/
|
506
|
-
void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array
|
505
|
+
void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array* md_ary) {
|
507
506
|
VALUE md_ary_obj = Qnil;
|
508
507
|
if (md_ary_hash == Qnil) {
|
509
508
|
return; /* Do nothing if the expected has value is nil */
|
@@ -524,7 +523,7 @@ void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array *md_ary) {
|
|
524
523
|
}
|
525
524
|
|
526
525
|
/* Converts a metadata array to a hash. */
|
527
|
-
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array
|
526
|
+
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array* md_ary) {
|
528
527
|
VALUE key = Qnil;
|
529
528
|
VALUE new_ary = Qnil;
|
530
529
|
VALUE value = Qnil;
|
@@ -587,7 +586,7 @@ static int grpc_rb_call_check_op_keys_hash_cb(VALUE key, VALUE val,
|
|
587
586
|
struct to the 'send_status_from_server' portion of an op.
|
588
587
|
*/
|
589
588
|
static void grpc_rb_op_update_status_from_server(
|
590
|
-
grpc_op
|
589
|
+
grpc_op* op, grpc_metadata_array* md_ary, grpc_slice* send_status_details,
|
591
590
|
VALUE status) {
|
592
591
|
VALUE code = rb_struct_aref(status, sym_code);
|
593
592
|
VALUE details = rb_struct_aref(status, sym_details);
|
@@ -627,7 +626,7 @@ typedef struct run_batch_stack {
|
|
627
626
|
grpc_metadata_array send_trailing_metadata;
|
628
627
|
|
629
628
|
/* Data being received */
|
630
|
-
grpc_byte_buffer
|
629
|
+
grpc_byte_buffer* recv_message;
|
631
630
|
grpc_metadata_array recv_metadata;
|
632
631
|
grpc_metadata_array recv_trailing_metadata;
|
633
632
|
int recv_cancelled;
|
@@ -639,7 +638,7 @@ typedef struct run_batch_stack {
|
|
639
638
|
|
640
639
|
/* grpc_run_batch_stack_init ensures the run_batch_stack is properly
|
641
640
|
* initialized */
|
642
|
-
static void grpc_run_batch_stack_init(run_batch_stack
|
641
|
+
static void grpc_run_batch_stack_init(run_batch_stack* st,
|
643
642
|
unsigned write_flag) {
|
644
643
|
MEMZERO(st, run_batch_stack, 1);
|
645
644
|
grpc_metadata_array_init(&st->send_metadata);
|
@@ -651,7 +650,7 @@ static void grpc_run_batch_stack_init(run_batch_stack *st,
|
|
651
650
|
}
|
652
651
|
|
653
652
|
void grpc_rb_metadata_array_destroy_including_entries(
|
654
|
-
grpc_metadata_array
|
653
|
+
grpc_metadata_array* array) {
|
655
654
|
size_t i;
|
656
655
|
if (array->metadata) {
|
657
656
|
for (i = 0; i < array->count; i++) {
|
@@ -664,7 +663,7 @@ void grpc_rb_metadata_array_destroy_including_entries(
|
|
664
663
|
|
665
664
|
/* grpc_run_batch_stack_cleanup ensures the run_batch_stack is properly
|
666
665
|
* cleaned up */
|
667
|
-
static void grpc_run_batch_stack_cleanup(run_batch_stack
|
666
|
+
static void grpc_run_batch_stack_cleanup(run_batch_stack* st) {
|
668
667
|
size_t i = 0;
|
669
668
|
|
670
669
|
grpc_rb_metadata_array_destroy_including_entries(&st->send_metadata);
|
@@ -693,7 +692,7 @@ static void grpc_run_batch_stack_cleanup(run_batch_stack *st) {
|
|
693
692
|
|
694
693
|
/* grpc_run_batch_stack_fill_ops fills the run_batch_stack ops array from
|
695
694
|
* ops_hash */
|
696
|
-
static void grpc_run_batch_stack_fill_ops(run_batch_stack
|
695
|
+
static void grpc_run_batch_stack_fill_ops(run_batch_stack* st, VALUE ops_hash) {
|
697
696
|
VALUE this_op = Qnil;
|
698
697
|
VALUE this_value = Qnil;
|
699
698
|
VALUE ops_ary = rb_ary_new();
|
@@ -760,7 +759,7 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack *st, VALUE ops_hash) {
|
|
760
759
|
|
761
760
|
/* grpc_run_batch_stack_build_result fills constructs a ruby BatchResult struct
|
762
761
|
after the results have run */
|
763
|
-
static VALUE grpc_run_batch_stack_build_result(run_batch_stack
|
762
|
+
static VALUE grpc_run_batch_stack_build_result(run_batch_stack* st) {
|
764
763
|
size_t i = 0;
|
765
764
|
VALUE result = rb_struct_new(grpc_rb_sBatchResult, Qnil, Qnil, Qnil, Qnil,
|
766
765
|
Qnil, Qnil, Qnil, Qnil, NULL);
|
@@ -823,14 +822,14 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) {
|
|
823
822
|
Only one operation of each type can be active at once in any given
|
824
823
|
batch */
|
825
824
|
static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
|
826
|
-
run_batch_stack
|
827
|
-
grpc_rb_call
|
825
|
+
run_batch_stack* st = NULL;
|
826
|
+
grpc_rb_call* call = NULL;
|
828
827
|
grpc_event ev;
|
829
828
|
grpc_call_error err;
|
830
829
|
VALUE result = Qnil;
|
831
830
|
VALUE rb_write_flag = rb_ivar_get(self, id_write_flag);
|
832
831
|
unsigned write_flag = 0;
|
833
|
-
void
|
832
|
+
void* tag = (void*)&st;
|
834
833
|
|
835
834
|
if (RTYPEDDATA_DATA(self) == NULL) {
|
836
835
|
rb_raise(grpc_rb_eCallError, "Cannot run batch on closed call");
|
@@ -997,8 +996,8 @@ void Init_grpc_call() {
|
|
997
996
|
rb_define_method(grpc_rb_cCall, "metadata=", grpc_rb_call_set_metadata, 1);
|
998
997
|
rb_define_method(grpc_rb_cCall, "trailing_metadata",
|
999
998
|
grpc_rb_call_get_trailing_metadata, 0);
|
1000
|
-
rb_define_method(grpc_rb_cCall,
|
1001
|
-
grpc_rb_call_set_trailing_metadata, 1);
|
999
|
+
rb_define_method(grpc_rb_cCall,
|
1000
|
+
"trailing_metadata=", grpc_rb_call_set_trailing_metadata, 1);
|
1002
1001
|
rb_define_method(grpc_rb_cCall, "write_flag", grpc_rb_call_get_write_flag, 0);
|
1003
1002
|
rb_define_method(grpc_rb_cCall, "write_flag=", grpc_rb_call_set_write_flag,
|
1004
1003
|
1);
|
@@ -1035,15 +1034,15 @@ void Init_grpc_call() {
|
|
1035
1034
|
}
|
1036
1035
|
|
1037
1036
|
/* Gets the call from the ruby object */
|
1038
|
-
grpc_call
|
1039
|
-
grpc_rb_call
|
1037
|
+
grpc_call* grpc_rb_get_wrapped_call(VALUE v) {
|
1038
|
+
grpc_rb_call* call = NULL;
|
1040
1039
|
TypedData_Get_Struct(v, grpc_rb_call, &grpc_call_data_type, call);
|
1041
1040
|
return call->wrapped;
|
1042
1041
|
}
|
1043
1042
|
|
1044
1043
|
/* Obtains the wrapped object for a given call */
|
1045
|
-
VALUE grpc_rb_wrap_call(grpc_call
|
1046
|
-
grpc_rb_call
|
1044
|
+
VALUE grpc_rb_wrap_call(grpc_call* c, grpc_completion_queue* q) {
|
1045
|
+
grpc_rb_call* wrapper;
|
1047
1046
|
if (c == NULL || q == NULL) {
|
1048
1047
|
return Qnil;
|
1049
1048
|
}
|
data/src/ruby/ext/grpc/rb_call.h
CHANGED
@@ -24,24 +24,24 @@
|
|
24
24
|
#include <grpc/grpc.h>
|
25
25
|
|
26
26
|
/* Gets the wrapped call from a VALUE. */
|
27
|
-
grpc_call
|
27
|
+
grpc_call* grpc_rb_get_wrapped_call(VALUE v);
|
28
28
|
|
29
29
|
/* Gets the VALUE corresponding to given grpc_call. */
|
30
|
-
VALUE grpc_rb_wrap_call(grpc_call
|
30
|
+
VALUE grpc_rb_wrap_call(grpc_call* c, grpc_completion_queue* q);
|
31
31
|
|
32
32
|
/* Provides the details of an call error */
|
33
|
-
const char
|
33
|
+
const char* grpc_call_error_detail_of(grpc_call_error err);
|
34
34
|
|
35
35
|
/* Converts a metadata array to a hash. */
|
36
|
-
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array
|
36
|
+
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array* md_ary);
|
37
37
|
|
38
38
|
/* grpc_rb_md_ary_convert converts a ruby metadata hash into
|
39
39
|
a grpc_metadata_array.
|
40
40
|
*/
|
41
|
-
void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array
|
41
|
+
void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array* md_ary);
|
42
42
|
|
43
43
|
void grpc_rb_metadata_array_destroy_including_entries(
|
44
|
-
grpc_metadata_array
|
44
|
+
grpc_metadata_array* md_ary);
|
45
45
|
|
46
46
|
/* grpc_rb_eCallError is the ruby class of the exception thrown during call
|
47
47
|
operations. */
|
@@ -44,13 +44,13 @@ typedef struct grpc_rb_call_credentials {
|
|
44
44
|
VALUE mark;
|
45
45
|
|
46
46
|
/* The actual credentials */
|
47
|
-
grpc_call_credentials
|
47
|
+
grpc_call_credentials* wrapped;
|
48
48
|
} grpc_rb_call_credentials;
|
49
49
|
|
50
50
|
typedef struct callback_params {
|
51
51
|
VALUE get_metadata;
|
52
52
|
grpc_auth_metadata_context context;
|
53
|
-
void
|
53
|
+
void* user_data;
|
54
54
|
grpc_credentials_plugin_metadata_cb callback;
|
55
55
|
} callback_params;
|
56
56
|
|
@@ -82,8 +82,8 @@ static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
|
|
82
82
|
return result;
|
83
83
|
}
|
84
84
|
|
85
|
-
static void grpc_rb_call_credentials_callback_with_gil(void
|
86
|
-
callback_params
|
85
|
+
static void grpc_rb_call_credentials_callback_with_gil(void* param) {
|
86
|
+
callback_params* const params = (callback_params*)param;
|
87
87
|
VALUE auth_uri = rb_str_new_cstr(params->context.service_url);
|
88
88
|
/* Pass the arguments to the proc in a hash, which currently only has they key
|
89
89
|
'auth_uri' */
|
@@ -93,7 +93,7 @@ static void grpc_rb_call_credentials_callback_with_gil(void *param) {
|
|
93
93
|
grpc_metadata_array md_ary;
|
94
94
|
grpc_status_code status;
|
95
95
|
VALUE details;
|
96
|
-
char
|
96
|
+
char* error_details;
|
97
97
|
grpc_metadata_array_init(&md_ary);
|
98
98
|
rb_hash_aset(args, ID2SYM(rb_intern("jwt_aud_uri")), auth_uri);
|
99
99
|
rb_ary_push(callback_args, params->get_metadata);
|
@@ -113,34 +113,34 @@ static void grpc_rb_call_credentials_callback_with_gil(void *param) {
|
|
113
113
|
}
|
114
114
|
|
115
115
|
static int grpc_rb_call_credentials_plugin_get_metadata(
|
116
|
-
void
|
117
|
-
grpc_credentials_plugin_metadata_cb cb, void
|
116
|
+
void* state, grpc_auth_metadata_context context,
|
117
|
+
grpc_credentials_plugin_metadata_cb cb, void* user_data,
|
118
118
|
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
|
119
|
-
size_t
|
120
|
-
const char
|
121
|
-
callback_params
|
119
|
+
size_t* num_creds_md, grpc_status_code* status,
|
120
|
+
const char** error_details) {
|
121
|
+
callback_params* params = gpr_malloc(sizeof(callback_params));
|
122
122
|
params->get_metadata = (VALUE)state;
|
123
123
|
params->context = context;
|
124
124
|
params->user_data = user_data;
|
125
125
|
params->callback = cb;
|
126
126
|
|
127
127
|
grpc_rb_event_queue_enqueue(grpc_rb_call_credentials_callback_with_gil,
|
128
|
-
(void
|
128
|
+
(void*)(params));
|
129
129
|
return 0; // Async return.
|
130
130
|
}
|
131
131
|
|
132
|
-
static void grpc_rb_call_credentials_plugin_destroy(void
|
132
|
+
static void grpc_rb_call_credentials_plugin_destroy(void* state) {
|
133
133
|
(void)state;
|
134
134
|
// Not sure what needs to be done here
|
135
135
|
}
|
136
136
|
|
137
137
|
/* Destroys the credentials instances. */
|
138
|
-
static void grpc_rb_call_credentials_free(void
|
139
|
-
grpc_rb_call_credentials
|
138
|
+
static void grpc_rb_call_credentials_free(void* p) {
|
139
|
+
grpc_rb_call_credentials* wrapper;
|
140
140
|
if (p == NULL) {
|
141
141
|
return;
|
142
142
|
}
|
143
|
-
wrapper = (grpc_rb_call_credentials
|
143
|
+
wrapper = (grpc_rb_call_credentials*)p;
|
144
144
|
grpc_call_credentials_release(wrapper->wrapped);
|
145
145
|
wrapper->wrapped = NULL;
|
146
146
|
|
@@ -148,12 +148,12 @@ static void grpc_rb_call_credentials_free(void *p) {
|
|
148
148
|
}
|
149
149
|
|
150
150
|
/* Protects the mark object from GC */
|
151
|
-
static void grpc_rb_call_credentials_mark(void
|
152
|
-
grpc_rb_call_credentials
|
151
|
+
static void grpc_rb_call_credentials_mark(void* p) {
|
152
|
+
grpc_rb_call_credentials* wrapper = NULL;
|
153
153
|
if (p == NULL) {
|
154
154
|
return;
|
155
155
|
}
|
156
|
-
wrapper = (grpc_rb_call_credentials
|
156
|
+
wrapper = (grpc_rb_call_credentials*)p;
|
157
157
|
if (wrapper->mark != Qnil) {
|
158
158
|
rb_gc_mark(wrapper->mark);
|
159
159
|
}
|
@@ -175,7 +175,7 @@ static rb_data_type_t grpc_rb_call_credentials_data_type = {
|
|
175
175
|
/* Allocates CallCredentials instances.
|
176
176
|
Provides safe initial defaults for the instance fields. */
|
177
177
|
static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
|
178
|
-
grpc_rb_call_credentials
|
178
|
+
grpc_rb_call_credentials* wrapper = ALLOC(grpc_rb_call_credentials);
|
179
179
|
wrapper->wrapped = NULL;
|
180
180
|
wrapper->mark = Qnil;
|
181
181
|
return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type,
|
@@ -185,9 +185,9 @@ static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
|
|
185
185
|
/* Creates a wrapping object for a given call credentials. This should only be
|
186
186
|
* called with grpc_call_credentials objects that are not already associated
|
187
187
|
* with any Ruby object */
|
188
|
-
VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials
|
188
|
+
VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials* c, VALUE mark) {
|
189
189
|
VALUE rb_wrapper;
|
190
|
-
grpc_rb_call_credentials
|
190
|
+
grpc_rb_call_credentials* wrapper;
|
191
191
|
if (c == NULL) {
|
192
192
|
return Qnil;
|
193
193
|
}
|
@@ -208,8 +208,8 @@ static ID id_callback;
|
|
208
208
|
proc: (required) Proc that generates auth metadata
|
209
209
|
Initializes CallCredential instances. */
|
210
210
|
static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
|
211
|
-
grpc_rb_call_credentials
|
212
|
-
grpc_call_credentials
|
211
|
+
grpc_rb_call_credentials* wrapper = NULL;
|
212
|
+
grpc_call_credentials* creds = NULL;
|
213
213
|
grpc_metadata_credentials_plugin plugin;
|
214
214
|
|
215
215
|
grpc_ruby_once_init();
|
@@ -223,7 +223,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
|
|
223
223
|
rb_raise(rb_eTypeError, "Argument to CallCredentials#new must be a proc");
|
224
224
|
return Qnil;
|
225
225
|
}
|
226
|
-
plugin.state = (void
|
226
|
+
plugin.state = (void*)proc;
|
227
227
|
plugin.type = "";
|
228
228
|
|
229
229
|
creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL);
|
@@ -239,11 +239,11 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
|
|
239
239
|
return self;
|
240
240
|
}
|
241
241
|
|
242
|
-
static VALUE grpc_rb_call_credentials_compose(int argc, VALUE
|
242
|
+
static VALUE grpc_rb_call_credentials_compose(int argc, VALUE* argv,
|
243
243
|
VALUE self) {
|
244
|
-
grpc_call_credentials
|
245
|
-
grpc_call_credentials
|
246
|
-
grpc_call_credentials
|
244
|
+
grpc_call_credentials* creds;
|
245
|
+
grpc_call_credentials* other;
|
246
|
+
grpc_call_credentials* prev = NULL;
|
247
247
|
VALUE mark;
|
248
248
|
if (argc == 0) {
|
249
249
|
return self;
|
@@ -282,8 +282,8 @@ void Init_grpc_call_credentials() {
|
|
282
282
|
}
|
283
283
|
|
284
284
|
/* Gets the wrapped grpc_call_credentials from the ruby wrapper */
|
285
|
-
grpc_call_credentials
|
286
|
-
grpc_rb_call_credentials
|
285
|
+
grpc_call_credentials* grpc_rb_get_wrapped_call_credentials(VALUE v) {
|
286
|
+
grpc_rb_call_credentials* wrapper = NULL;
|
287
287
|
TypedData_Get_Struct(v, grpc_rb_call_credentials,
|
288
288
|
&grpc_rb_call_credentials_data_type, wrapper);
|
289
289
|
return wrapper->wrapped;
|