diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 4658f287d39..466ef57d20b 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -42,12 +42,13 @@ #include "rb_completion_queue.h" #include "rb_grpc.h" -/* grpc_sBatchResult is struct class used to hold the results of a batch call */ -static VALUE grpc_sBatchResult; +/* grpc_rb_sBatchResult is struct class used to hold the results of a batch + * call. */ +static VALUE grpc_rb_sBatchResult; -/* grpc_cMdAry is the MetadataArray class whose instances proxy +/* grpc_rb_cMdAry is the MetadataArray class whose instances proxy * grpc_metadata_array. */ -static VALUE grpc_cMdAry; +static VALUE grpc_rb_cMdAry; /* id_cq is the name of the hidden ivar that preserves a reference to a * completion queue */ @@ -70,7 +71,7 @@ static ID id_metadata; * received by the call and subsequently saved on it. */ static ID id_status; -/* sym_* are the symbol for attributes of grpc_sBatchResult. */ +/* sym_* are the symbol for attributes of grpc_rb_sBatchResult. */ static VALUE sym_send_message; static VALUE sym_send_metadata; static VALUE sym_send_close; @@ -126,7 +127,7 @@ static VALUE grpc_rb_call_cancel(VALUE self) { Data_Get_Struct(self, grpc_call, call); err = grpc_call_cancel(call); if (err != GRPC_CALL_OK) { - rb_raise(grpc_eCallError, "cancel failed: %s (code=%d)", + rb_raise(grpc_rb_eCallError, "cancel failed: %s (code=%d)", grpc_call_error_detail_of(err), err); } @@ -148,7 +149,7 @@ static VALUE grpc_rb_call_get_status(VALUE self) { Saves a status object on the call. */ static VALUE grpc_rb_call_set_status(VALUE self, VALUE status) { - if (!NIL_P(status) && rb_obj_class(status) != grpc_sStatus) { + if (!NIL_P(status) && rb_obj_class(status) != grpc_rb_sStatus) { rb_raise(rb_eTypeError, "bad status: got:<%s> want: ", rb_obj_classname(status)); return Qnil; @@ -257,7 +258,8 @@ void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array *md_ary) { /* Initialize the array, compute it's capacity, then fill it. */ grpc_metadata_array_init(md_ary); - md_ary_obj = Data_Wrap_Struct(grpc_cMdAry, GC_NOT_MARKED, GC_DONT_FREE, md_ary); + md_ary_obj = + Data_Wrap_Struct(grpc_rb_cMdAry, GC_NOT_MARKED, GC_DONT_FREE, md_ary); rb_hash_foreach(md_ary_hash, grpc_rb_md_ary_capacity_hash_cb, md_ary_obj); md_ary->metadata = gpr_malloc(md_ary->capacity * sizeof(grpc_metadata)); rb_hash_foreach(md_ary_hash, grpc_rb_md_ary_fill_hash_cb, md_ary_obj); @@ -470,8 +472,8 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack* st, VALUE ops_hash) { after the results have run */ static VALUE grpc_run_batch_stack_build_result(run_batch_stack* st) { size_t i = 0; - VALUE result = rb_struct_new(grpc_sBatchResult, Qnil, Qnil, Qnil, Qnil, Qnil, - Qnil, Qnil, Qnil, NULL); + VALUE result = rb_struct_new(grpc_rb_sBatchResult, Qnil, Qnil, Qnil, Qnil, + Qnil, Qnil, Qnil, Qnil, NULL); for (i = 0; i < st->op_num; i++) { switch(st->ops[i].op) { case GRPC_OP_SEND_INITIAL_METADATA: @@ -498,7 +500,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack* st) { rb_struct_aset( result, sym_status, - rb_struct_new(grpc_sStatus, + rb_struct_new(grpc_rb_sStatus, UINT2NUM(st->recv_status), (st->recv_status_details == NULL ? Qnil @@ -556,19 +558,20 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE cqueue, VALUE tag, err = grpc_call_start_batch(call, st.ops, st.op_num, ROBJECT(tag)); if (err != GRPC_CALL_OK) { grpc_run_batch_stack_cleanup(&st); - rb_raise(grpc_eCallError, "grpc_call_start_batch failed with %s (code=%d)", + rb_raise(grpc_rb_eCallError, + "grpc_call_start_batch failed with %s (code=%d)", grpc_call_error_detail_of(err), err); return; } ev = grpc_rb_completion_queue_pluck_event(cqueue, tag, timeout); if (ev == NULL) { grpc_run_batch_stack_cleanup(&st); - rb_raise(grpc_eOutOfTime, "grpc_call_start_batch timed out"); + rb_raise(grpc_rb_eOutOfTime, "grpc_call_start_batch timed out"); return; } if (ev->data.op_complete != GRPC_OP_OK) { grpc_run_batch_stack_cleanup(&st); - rb_raise(grpc_eCallError, "start_batch completion failed, (code=%d)", + rb_raise(grpc_rb_eCallError, "start_batch completion failed, (code=%d)", ev->data.op_complete); return; } @@ -579,37 +582,38 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE cqueue, VALUE tag, return result; } -/* grpc_cCall is the ruby class that proxies grpc_call. */ -VALUE grpc_cCall = Qnil; +/* grpc_rb_cCall is the ruby class that proxies grpc_call. */ +VALUE grpc_rb_cCall = Qnil; -/* grpc_eCallError is the ruby class of the exception thrown during call +/* grpc_rb_eCallError is the ruby class of the exception thrown during call operations; */ -VALUE grpc_eCallError = Qnil; +VALUE grpc_rb_eCallError = Qnil; -/* grpc_eOutOfTime is the ruby class of the exception thrown to indicate +/* grpc_rb_eOutOfTime is the ruby class of the exception thrown to indicate a timeout. */ -VALUE grpc_eOutOfTime = Qnil; +VALUE grpc_rb_eOutOfTime = Qnil; void Init_grpc_error_codes() { /* Constants representing the error codes of grpc_call_error in grpc.h */ - VALUE grpc_mRpcErrors = rb_define_module_under(grpc_mGrpcCore, "RpcErrors"); - rb_define_const(grpc_mRpcErrors, "OK", UINT2NUM(GRPC_CALL_OK)); - rb_define_const(grpc_mRpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR)); - rb_define_const(grpc_mRpcErrors, "NOT_ON_SERVER", + VALUE grpc_rb_mRpcErrors = + rb_define_module_under(grpc_rb_mGrpcCore, "RpcErrors"); + rb_define_const(grpc_rb_mRpcErrors, "OK", UINT2NUM(GRPC_CALL_OK)); + rb_define_const(grpc_rb_mRpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR)); + rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_SERVER", UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER)); - rb_define_const(grpc_mRpcErrors, "NOT_ON_CLIENT", + rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_CLIENT", UINT2NUM(GRPC_CALL_ERROR_NOT_ON_CLIENT)); - rb_define_const(grpc_mRpcErrors, "ALREADY_ACCEPTED", + rb_define_const(grpc_rb_mRpcErrors, "ALREADY_ACCEPTED", UINT2NUM(GRPC_CALL_ERROR_ALREADY_ACCEPTED)); - rb_define_const(grpc_mRpcErrors, "ALREADY_INVOKED", + rb_define_const(grpc_rb_mRpcErrors, "ALREADY_INVOKED", UINT2NUM(GRPC_CALL_ERROR_ALREADY_INVOKED)); - rb_define_const(grpc_mRpcErrors, "NOT_INVOKED", + rb_define_const(grpc_rb_mRpcErrors, "NOT_INVOKED", UINT2NUM(GRPC_CALL_ERROR_NOT_INVOKED)); - rb_define_const(grpc_mRpcErrors, "ALREADY_FINISHED", + rb_define_const(grpc_rb_mRpcErrors, "ALREADY_FINISHED", UINT2NUM(GRPC_CALL_ERROR_ALREADY_FINISHED)); - rb_define_const(grpc_mRpcErrors, "TOO_MANY_OPERATIONS", + rb_define_const(grpc_rb_mRpcErrors, "TOO_MANY_OPERATIONS", UINT2NUM(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS)); - rb_define_const(grpc_mRpcErrors, "INVALID_FLAGS", + rb_define_const(grpc_rb_mRpcErrors, "INVALID_FLAGS", UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS)); /* Add the detail strings to a Hash */ @@ -637,13 +641,13 @@ void Init_grpc_error_codes() { rb_str_new2("outstanding read or write present")); rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS), rb_str_new2("a bad flag was given")); - rb_define_const(grpc_mRpcErrors, "ErrorMessages", rb_error_code_details); + rb_define_const(grpc_rb_mRpcErrors, "ErrorMessages", rb_error_code_details); rb_obj_freeze(rb_error_code_details); } void Init_grpc_op_codes() { /* Constants representing operation type codes in grpc.h */ - VALUE rb_CallOps = rb_define_module_under(grpc_mGrpcCore, "CallOps"); + VALUE rb_CallOps = rb_define_module_under(grpc_rb_mGrpcCore, "CallOps"); rb_define_const(rb_CallOps, "SEND_INITIAL_METADATA", UINT2NUM(GRPC_OP_SEND_INITIAL_METADATA)); rb_define_const(rb_CallOps, "SEND_MESSAGE", UINT2NUM(GRPC_OP_SEND_MESSAGE)); @@ -663,26 +667,27 @@ void Init_grpc_op_codes() { void Init_grpc_call() { /* CallError inherits from Exception to signal that it is non-recoverable */ - grpc_eCallError = - rb_define_class_under(grpc_mGrpcCore, "CallError", rb_eException); - grpc_eOutOfTime = - rb_define_class_under(grpc_mGrpcCore, "OutOfTime", rb_eException); - grpc_cCall = rb_define_class_under(grpc_mGrpcCore, "Call", rb_cObject); - grpc_cMdAry = rb_define_class_under(grpc_mGrpcCore, "MetadataArray", - rb_cObject); + grpc_rb_eCallError = + rb_define_class_under(grpc_rb_mGrpcCore, "CallError", rb_eException); + grpc_rb_eOutOfTime = + rb_define_class_under(grpc_rb_mGrpcCore, "OutOfTime", rb_eException); + grpc_rb_cCall = rb_define_class_under(grpc_rb_mGrpcCore, "Call", rb_cObject); + grpc_rb_cMdAry = rb_define_class_under(grpc_rb_mGrpcCore, "MetadataArray", + rb_cObject); /* Prevent allocation or inialization of the Call class */ - rb_define_alloc_func(grpc_cCall, grpc_rb_cannot_alloc); - rb_define_method(grpc_cCall, "initialize", grpc_rb_cannot_init, 0); - rb_define_method(grpc_cCall, "initialize_copy", grpc_rb_cannot_init_copy, 1); + rb_define_alloc_func(grpc_rb_cCall, grpc_rb_cannot_alloc); + rb_define_method(grpc_rb_cCall, "initialize", grpc_rb_cannot_init, 0); + rb_define_method(grpc_rb_cCall, "initialize_copy", + grpc_rb_cannot_init_copy, 1); /* Add ruby analogues of the Call methods. */ - rb_define_method(grpc_cCall, "run_batch", grpc_rb_call_run_batch, 4); - rb_define_method(grpc_cCall, "cancel", grpc_rb_call_cancel, 0); - rb_define_method(grpc_cCall, "status", grpc_rb_call_get_status, 0); - rb_define_method(grpc_cCall, "status=", grpc_rb_call_set_status, 1); - rb_define_method(grpc_cCall, "metadata", grpc_rb_call_get_metadata, 0); - rb_define_method(grpc_cCall, "metadata=", grpc_rb_call_set_metadata, 1); + rb_define_method(grpc_rb_cCall, "run_batch", grpc_rb_call_run_batch, 4); + rb_define_method(grpc_rb_cCall, "cancel", grpc_rb_call_cancel, 0); + rb_define_method(grpc_rb_cCall, "status", grpc_rb_call_get_status, 0); + rb_define_method(grpc_rb_cCall, "status=", grpc_rb_call_set_status, 1); + rb_define_method(grpc_rb_cCall, "metadata", grpc_rb_call_get_metadata, 0); + rb_define_method(grpc_rb_cCall, "metadata=", grpc_rb_call_set_metadata, 1); /* Ids used to support call attributes */ id_metadata = rb_intern("metadata"); @@ -703,7 +708,7 @@ void Init_grpc_call() { sym_cancelled = ID2SYM(rb_intern("cancelled")); /* The Struct used to return the run_batch result. */ - grpc_sBatchResult = rb_struct_define( + grpc_rb_sBatchResult = rb_struct_define( "BatchResult", "send_message", "send_metadata", @@ -718,7 +723,7 @@ void Init_grpc_call() { /* The hash for reference counting calls, to ensure they can't be destroyed * more than once */ hash_all_calls = rb_hash_new(); - rb_define_const(grpc_cCall, "INTERNAL_ALL_CALLs", hash_all_calls); + rb_define_const(grpc_rb_cCall, "INTERNAL_ALL_CALLs", hash_all_calls); Init_grpc_error_codes(); Init_grpc_op_codes(); @@ -744,5 +749,6 @@ VALUE grpc_rb_wrap_call(grpc_call *c) { rb_hash_aset(hash_all_calls, OFFT2NUM((VALUE)c), UINT2NUM(NUM2UINT(obj) + 1)); } - return Data_Wrap_Struct(grpc_cCall, GC_NOT_MARKED, grpc_rb_call_destroy, c); + return Data_Wrap_Struct(grpc_rb_cCall, GC_NOT_MARKED, + grpc_rb_call_destroy, c); } diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index ed4fdd58e0c..e20a34c74e2 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -49,16 +49,16 @@ const char* grpc_call_error_detail_of(grpc_call_error err); /* Converts a metadata array to a hash. */ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary); -/* grpc_cCall is the Call class whose instances proxy grpc_call. */ -extern VALUE grpc_cCall; +/* grpc_rb_cCall is the Call class whose instances proxy grpc_call. */ +extern VALUE grpc_rb_cCall; -/* grpc_eCallError is the ruby class of the exception thrown during call +/* grpc_rb_eCallError is the ruby class of the exception thrown during call operations. */ -extern VALUE grpc_eCallError; +extern VALUE grpc_rb_eCallError; -/* grpc_eOutOfTime is the ruby class of the exception thrown to indicate +/* grpc_rb_eOutOfTime is the ruby class of the exception thrown to indicate a timeout. */ -extern VALUE grpc_eOutOfTime; +extern VALUE grpc_rb_eOutOfTime; /* Initializes the Call class. */ void Init_grpc_call(); diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 215afc7d194..3480280a03c 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -60,7 +60,7 @@ static ID id_cqueue; /* Used during the conversion of a hash to channel args during channel setup */ -static VALUE grpc_cChannelArgs; +static VALUE grpc_rb_cChannelArgs; /* grpc_rb_channel wraps a grpc_channel. It provides a peer ruby object, * 'mark' to minimize copying when a channel is created from ruby. */ @@ -170,7 +170,7 @@ static VALUE grpc_rb_channel_init_copy(VALUE copy, VALUE orig) { /* Raise an error if orig is not a channel object or a subclass. */ if (TYPE(orig) != T_DATA || RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_channel_free) { - rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_cChannel)); + rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_rb_cChannel)); return Qnil; } @@ -240,36 +240,38 @@ static VALUE grpc_rb_channel_destroy(VALUE self) { return Qnil; } -/* grpc_cChannel is the ruby class that proxies grpc_channel. */ -VALUE grpc_cChannel = Qnil; +/* grpc_rb_cChannel is the ruby class that proxies grpc_channel. */ +VALUE grpc_rb_cChannel = Qnil; void Init_grpc_channel() { - grpc_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); - grpc_cChannel = rb_define_class_under(grpc_mGrpcCore, "Channel", rb_cObject); + grpc_rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); + grpc_rb_cChannel = + rb_define_class_under(grpc_rb_mGrpcCore, "Channel", rb_cObject); /* Allocates an object managed by the ruby runtime */ - rb_define_alloc_func(grpc_cChannel, grpc_rb_channel_alloc); + rb_define_alloc_func(grpc_rb_cChannel, grpc_rb_channel_alloc); /* Provides a ruby constructor and support for dup/clone. */ - rb_define_method(grpc_cChannel, "initialize", grpc_rb_channel_init, -1); - rb_define_method(grpc_cChannel, "initialize_copy", grpc_rb_channel_init_copy, - 1); + rb_define_method(grpc_rb_cChannel, "initialize", grpc_rb_channel_init, -1); + rb_define_method(grpc_rb_cChannel, "initialize_copy", + grpc_rb_channel_init_copy, 1); /* Add ruby analogues of the Channel methods. */ - rb_define_method(grpc_cChannel, "create_call", grpc_rb_channel_create_call, 4); - rb_define_method(grpc_cChannel, "destroy", grpc_rb_channel_destroy, 0); - rb_define_alias(grpc_cChannel, "close", "destroy"); + rb_define_method(grpc_rb_cChannel, "create_call", + grpc_rb_channel_create_call, 4); + rb_define_method(grpc_rb_cChannel, "destroy", grpc_rb_channel_destroy, 0); + rb_define_alias(grpc_rb_cChannel, "close", "destroy"); id_channel = rb_intern("__channel"); id_cqueue = rb_intern("__cqueue"); id_target = rb_intern("__target"); - rb_define_const(grpc_cChannel, "SSL_TARGET", + rb_define_const(grpc_rb_cChannel, "SSL_TARGET", ID2SYM(rb_intern(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG))); - rb_define_const(grpc_cChannel, "ENABLE_CENSUS", + rb_define_const(grpc_rb_cChannel, "ENABLE_CENSUS", ID2SYM(rb_intern(GRPC_ARG_ENABLE_CENSUS))); - rb_define_const(grpc_cChannel, "MAX_CONCURRENT_STREAMS", + rb_define_const(grpc_rb_cChannel, "MAX_CONCURRENT_STREAMS", ID2SYM(rb_intern(GRPC_ARG_MAX_CONCURRENT_STREAMS))); - rb_define_const(grpc_cChannel, "MAX_MESSAGE_LENGTH", + rb_define_const(grpc_rb_cChannel, "MAX_MESSAGE_LENGTH", ID2SYM(rb_intern(GRPC_ARG_MAX_MESSAGE_LENGTH))); } diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index d5725ce9e08..5c57b31fb28 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -37,8 +37,8 @@ #include #include -/* grpc_cChannel is the Channel class whose instances proxy grpc_channel. */ -extern VALUE grpc_cChannel; +/* grpc_rb_cChannel is the Channel class whose instances proxy grpc_channel. */ +extern VALUE grpc_rb_cChannel; /* Initializes the Channel class. */ void Init_grpc_channel(); diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c index 6e486a57c3b..9b92ec1514e 100644 --- a/src/ruby/ext/grpc/rb_channel_args.c +++ b/src/ruby/ext/grpc/rb_channel_args.c @@ -109,7 +109,7 @@ typedef struct channel_convert_params { static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) { ID id_size = rb_intern("size"); - VALUE grpc_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); + VALUE grpc_rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); channel_convert_params* params = (channel_convert_params*)as_value; size_t num_args = 0; @@ -126,7 +126,7 @@ static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) { MEMZERO(params->dst->args, grpc_arg, num_args); rb_hash_foreach(params->src_hash, grpc_rb_channel_create_in_process_add_args_hash_cb, - Data_Wrap_Struct(grpc_cChannelArgs, GC_NOT_MARKED, + Data_Wrap_Struct(grpc_rb_cChannelArgs, GC_NOT_MARKED, GC_DONT_FREE, params->dst)); /* reset num_args as grpc_rb_channel_create_in_process_add_args_hash_cb * decrements it during has processing */ diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 888744f3c3a..20ce1b909c1 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -166,25 +166,27 @@ grpc_event* grpc_rb_completion_queue_pluck_event(VALUE self, VALUE tag, return next_call.event; } -/* grpc_cCompletionQueue is the ruby class that proxies grpc_completion_queue. */ -VALUE grpc_cCompletionQueue = Qnil; +/* grpc_rb_cCompletionQueue is the ruby class that proxies + * grpc_completion_queue. */ +VALUE grpc_rb_cCompletionQueue = Qnil; void Init_grpc_completion_queue() { - grpc_cCompletionQueue = - rb_define_class_under(grpc_mGrpcCore, "CompletionQueue", rb_cObject); + grpc_rb_cCompletionQueue = + rb_define_class_under(grpc_rb_mGrpcCore, "CompletionQueue", rb_cObject); /* constructor: uses an alloc func without an initializer. Using a simple alloc func works here as the grpc header does not specify any args for this func, so no separate initialization step is necessary. */ - rb_define_alloc_func(grpc_cCompletionQueue, grpc_rb_completion_queue_alloc); + rb_define_alloc_func(grpc_rb_cCompletionQueue, + grpc_rb_completion_queue_alloc); /* Add the next method that waits for the next event. */ - rb_define_method(grpc_cCompletionQueue, "next", grpc_rb_completion_queue_next, - 1); + rb_define_method(grpc_rb_cCompletionQueue, "next", + grpc_rb_completion_queue_next, 1); /* Add the pluck method that waits for the next event of given tag */ - rb_define_method(grpc_cCompletionQueue, "pluck", grpc_rb_completion_queue_pluck, - 2); + rb_define_method(grpc_rb_cCompletionQueue, "pluck", + grpc_rb_completion_queue_pluck, 2); } /* Gets the wrapped completion queue from the ruby wrapper */ diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h index 27cf6d78f58..1bfb80e4995 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.h +++ b/src/ruby/ext/grpc/rb_completion_queue.h @@ -48,9 +48,9 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v); grpc_event* grpc_rb_completion_queue_pluck_event(VALUE cqueue, VALUE tag, VALUE timeout); -/* grpc_cCompletionQueue is the CompletionQueue class whose instances proxy +/* grpc_rb_cCompletionQueue is the CompletionQueue class whose instances proxy grpc_completion_queue. */ -extern VALUE grpc_cCompletionQueue; +extern VALUE grpc_rb_cCompletionQueue; /* Initializes the CompletionQueue class. */ void Init_grpc_completion_queue(); diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c index 0a8e23b9f73..1504a4884ea 100644 --- a/src/ruby/ext/grpc/rb_credentials.c +++ b/src/ruby/ext/grpc/rb_credentials.c @@ -107,7 +107,7 @@ static VALUE grpc_rb_credentials_init_copy(VALUE copy, VALUE orig) { /* Raise an error if orig is not a credentials object or a subclass. */ if (TYPE(orig) != T_DATA || RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_credentials_free) { - rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_cCredentials)); + rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_rb_cCredentials)); } Data_Get_Struct(orig, grpc_rb_credentials, orig_cred); @@ -178,7 +178,7 @@ static VALUE grpc_rb_composite_credentials_create(VALUE self, VALUE other) { } wrapper->mark = Qnil; - return Data_Wrap_Struct(grpc_cCredentials, grpc_rb_credentials_mark, + return Data_Wrap_Struct(grpc_rb_cCredentials, grpc_rb_credentials_mark, grpc_rb_credentials_free, wrapper); } @@ -242,30 +242,31 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) { return self; } -/* grpc_cCredentials is the ruby class that proxies grpc_credentials. */ -VALUE grpc_cCredentials = Qnil; +/* grpc_rb_cCredentials is the ruby class that proxies grpc_credentials. */ +VALUE grpc_rb_cCredentials = Qnil; void Init_grpc_credentials() { - grpc_cCredentials = - rb_define_class_under(grpc_mGrpcCore, "Credentials", rb_cObject); + grpc_rb_cCredentials = + rb_define_class_under(grpc_rb_mGrpcCore, "Credentials", rb_cObject); /* Allocates an object managed by the ruby runtime */ - rb_define_alloc_func(grpc_cCredentials, grpc_rb_credentials_alloc); + rb_define_alloc_func(grpc_rb_cCredentials, grpc_rb_credentials_alloc); /* Provides a ruby constructor and support for dup/clone. */ - rb_define_method(grpc_cCredentials, "initialize", grpc_rb_credentials_init, -1); - rb_define_method(grpc_cCredentials, "initialize_copy", + rb_define_method(grpc_rb_cCredentials, "initialize", + grpc_rb_credentials_init, -1); + rb_define_method(grpc_rb_cCredentials, "initialize_copy", grpc_rb_credentials_init_copy, 1); /* Provide static funcs that create new special instances. */ - rb_define_singleton_method(grpc_cCredentials, "default", + rb_define_singleton_method(grpc_rb_cCredentials, "default", grpc_rb_default_credentials_create, 0); - rb_define_singleton_method(grpc_cCredentials, "compute_engine", + rb_define_singleton_method(grpc_rb_cCredentials, "compute_engine", grpc_rb_compute_engine_credentials_create, 0); /* Provide other methods. */ - rb_define_method(grpc_cCredentials, "compose", + rb_define_method(grpc_rb_cCredentials, "compose", grpc_rb_composite_credentials_create, 1); id_pem_cert_chain = rb_intern("__pem_cert_chain"); diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h index 399506524c4..dc0a3d01e81 100644 --- a/src/ruby/ext/grpc/rb_credentials.h +++ b/src/ruby/ext/grpc/rb_credentials.h @@ -37,9 +37,9 @@ #include #include -/* grpc_cCredentials is the ruby class whose instances proxy +/* grpc_rb_cCredentials is the ruby class whose instances proxy grpc_credentials. */ -extern VALUE grpc_cCredentials; +extern VALUE grpc_rb_cCredentials; /* Initializes the ruby Credentials class. */ void Init_grpc_credentials(); diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 41d12ed64fc..4f30a6216a3 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -50,7 +50,7 @@ const RUBY_DATA_FUNC GC_NOT_MARKED = NULL; const RUBY_DATA_FUNC GC_DONT_FREE = NULL; -VALUE grpc_cTimeVal = Qnil; +VALUE grpc_rb_cTimeVal = Qnil; /* Alloc func that blocks allocation of a given object by raising an * exception. */ @@ -96,7 +96,7 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) { switch (TYPE(time)) { case T_DATA: - if (CLASS_OF(time) == grpc_cTimeVal) { + if (CLASS_OF(time) == grpc_rb_cTimeVal) { Data_Get_Struct(time, gpr_timespec, time_const); t = *time_const; } else if (CLASS_OF(time) == rb_cTime) { @@ -152,35 +152,41 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) { void Init_grpc_status_codes() { /* Constants representing the status codes or grpc_status_code in status.h */ - VALUE grpc_mStatusCodes = - rb_define_module_under(grpc_mGrpcCore, "StatusCodes"); - rb_define_const(grpc_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK)); - rb_define_const(grpc_mStatusCodes, "CANCELLED", INT2NUM(GRPC_STATUS_CANCELLED)); - rb_define_const(grpc_mStatusCodes, "UNKNOWN", INT2NUM(GRPC_STATUS_UNKNOWN)); - rb_define_const(grpc_mStatusCodes, "INVALID_ARGUMENT", + VALUE grpc_rb_mStatusCodes = + rb_define_module_under(grpc_rb_mGrpcCore, "StatusCodes"); + rb_define_const(grpc_rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK)); + rb_define_const(grpc_rb_mStatusCodes, "CANCELLED", + INT2NUM(GRPC_STATUS_CANCELLED)); + rb_define_const(grpc_rb_mStatusCodes, "UNKNOWN", + INT2NUM(GRPC_STATUS_UNKNOWN)); + rb_define_const(grpc_rb_mStatusCodes, "INVALID_ARGUMENT", INT2NUM(GRPC_STATUS_INVALID_ARGUMENT)); - rb_define_const(grpc_mStatusCodes, "DEADLINE_EXCEEDED", + rb_define_const(grpc_rb_mStatusCodes, "DEADLINE_EXCEEDED", INT2NUM(GRPC_STATUS_DEADLINE_EXCEEDED)); - rb_define_const(grpc_mStatusCodes, "NOT_FOUND", INT2NUM(GRPC_STATUS_NOT_FOUND)); - rb_define_const(grpc_mStatusCodes, "ALREADY_EXISTS", + rb_define_const(grpc_rb_mStatusCodes, "NOT_FOUND", + INT2NUM(GRPC_STATUS_NOT_FOUND)); + rb_define_const(grpc_rb_mStatusCodes, "ALREADY_EXISTS", INT2NUM(GRPC_STATUS_ALREADY_EXISTS)); - rb_define_const(grpc_mStatusCodes, "PERMISSION_DENIED", + rb_define_const(grpc_rb_mStatusCodes, "PERMISSION_DENIED", INT2NUM(GRPC_STATUS_PERMISSION_DENIED)); - rb_define_const(grpc_mStatusCodes, "UNAUTHENTICATED", + rb_define_const(grpc_rb_mStatusCodes, "UNAUTHENTICATED", INT2NUM(GRPC_STATUS_UNAUTHENTICATED)); - rb_define_const(grpc_mStatusCodes, "RESOURCE_EXHAUSTED", + rb_define_const(grpc_rb_mStatusCodes, "RESOURCE_EXHAUSTED", INT2NUM(GRPC_STATUS_RESOURCE_EXHAUSTED)); - rb_define_const(grpc_mStatusCodes, "FAILED_PRECONDITION", + rb_define_const(grpc_rb_mStatusCodes, "FAILED_PRECONDITION", INT2NUM(GRPC_STATUS_FAILED_PRECONDITION)); - rb_define_const(grpc_mStatusCodes, "ABORTED", INT2NUM(GRPC_STATUS_ABORTED)); - rb_define_const(grpc_mStatusCodes, "OUT_OF_RANGE", + rb_define_const(grpc_rb_mStatusCodes, "ABORTED", + INT2NUM(GRPC_STATUS_ABORTED)); + rb_define_const(grpc_rb_mStatusCodes, "OUT_OF_RANGE", INT2NUM(GRPC_STATUS_OUT_OF_RANGE)); - rb_define_const(grpc_mStatusCodes, "UNIMPLEMENTED", + rb_define_const(grpc_rb_mStatusCodes, "UNIMPLEMENTED", INT2NUM(GRPC_STATUS_UNIMPLEMENTED)); - rb_define_const(grpc_mStatusCodes, "INTERNAL", INT2NUM(GRPC_STATUS_INTERNAL)); - rb_define_const(grpc_mStatusCodes, "UNAVAILABLE", + rb_define_const(grpc_rb_mStatusCodes, "INTERNAL", + INT2NUM(GRPC_STATUS_INTERNAL)); + rb_define_const(grpc_rb_mStatusCodes, "UNAVAILABLE", INT2NUM(GRPC_STATUS_UNAVAILABLE)); - rb_define_const(grpc_mStatusCodes, "DATA_LOSS", INT2NUM(GRPC_STATUS_DATA_LOSS)); + rb_define_const(grpc_rb_mStatusCodes, "DATA_LOSS", + INT2NUM(GRPC_STATUS_DATA_LOSS)); } /* id_at is the constructor method of the ruby standard Time class. */ @@ -212,22 +218,25 @@ VALUE grpc_rb_time_val_to_s(VALUE self) { /* Adds a module with constants that map to gpr's static timeval structs. */ void Init_grpc_time_consts() { - VALUE grpc_mTimeConsts = - rb_define_module_under(grpc_mGrpcCore, "TimeConsts"); - grpc_cTimeVal = - rb_define_class_under(grpc_mGrpcCore, "TimeSpec", rb_cObject); - rb_define_const(grpc_mTimeConsts, "ZERO", - Data_Wrap_Struct(grpc_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE, + VALUE grpc_rb_mTimeConsts = + rb_define_module_under(grpc_rb_mGrpcCore, "TimeConsts"); + grpc_rb_cTimeVal = + rb_define_class_under(grpc_rb_mGrpcCore, "TimeSpec", rb_cObject); + rb_define_const(grpc_rb_mTimeConsts, "ZERO", + Data_Wrap_Struct(grpc_rb_cTimeVal, + GC_NOT_MARKED, GC_DONT_FREE, (void *)&gpr_time_0)); - rb_define_const(grpc_mTimeConsts, "INFINITE_FUTURE", - Data_Wrap_Struct(grpc_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE, + rb_define_const(grpc_rb_mTimeConsts, "INFINITE_FUTURE", + Data_Wrap_Struct(grpc_rb_cTimeVal, + GC_NOT_MARKED, GC_DONT_FREE, (void *)&gpr_inf_future)); - rb_define_const(grpc_mTimeConsts, "INFINITE_PAST", - Data_Wrap_Struct(grpc_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE, + rb_define_const(grpc_rb_mTimeConsts, "INFINITE_PAST", + Data_Wrap_Struct(grpc_rb_cTimeVal, + GC_NOT_MARKED, GC_DONT_FREE, (void *)&gpr_inf_past)); - rb_define_method(grpc_cTimeVal, "to_time", grpc_rb_time_val_to_time, 0); - rb_define_method(grpc_cTimeVal, "inspect", grpc_rb_time_val_inspect, 0); - rb_define_method(grpc_cTimeVal, "to_s", grpc_rb_time_val_to_s, 0); + rb_define_method(grpc_rb_cTimeVal, "to_time", grpc_rb_time_val_to_time, 0); + rb_define_method(grpc_rb_cTimeVal, "inspect", grpc_rb_time_val_inspect, 0); + rb_define_method(grpc_rb_cTimeVal, "to_s", grpc_rb_time_val_to_s, 0); id_at = rb_intern("at"); id_inspect = rb_intern("inspect"); id_to_s = rb_intern("to_s"); @@ -239,23 +248,25 @@ void grpc_rb_shutdown(void *vm) { grpc_shutdown(); } /* Initialize the GRPC module structs */ -/* grpc_sNewServerRpc is the struct that holds new server rpc details. */ -VALUE grpc_sNewServerRpc = Qnil; -/* grpc_sStatus is the struct that holds status details. */ -VALUE grpc_sStatus = Qnil; +/* grpc_rb_sNewServerRpc is the struct that holds new server rpc details. */ +VALUE grpc_rb_sNewServerRpc = Qnil; +/* grpc_rb_sStatus is the struct that holds status details. */ +VALUE grpc_rb_sStatus = Qnil; /* Initialize the GRPC module. */ -VALUE grpc_mGRPC = Qnil; -VALUE grpc_mGrpcCore = Qnil; +VALUE grpc_rb_mGRPC = Qnil; +VALUE grpc_rb_mGrpcCore = Qnil; void Init_grpc() { grpc_init(); ruby_vm_at_exit(grpc_rb_shutdown); - grpc_mGRPC = rb_define_module("GRPC"); - grpc_mGrpcCore = rb_define_module_under(grpc_mGRPC, "Core"); - grpc_sNewServerRpc = rb_struct_define("NewServerRpc", "method", "host", - "deadline", "metadata", "call", NULL); - grpc_sStatus = rb_struct_define("Status", "code", "details", "metadata", NULL); + grpc_rb_mGRPC = rb_define_module("GRPC"); + grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core"); + grpc_rb_sNewServerRpc = + rb_struct_define("NewServerRpc", "method", "host", + "deadline", "metadata", "call", NULL); + grpc_rb_sStatus = + rb_struct_define("Status", "code", "details", "metadata", NULL); sym_code = ID2SYM(rb_intern("code")); sym_details = ID2SYM(rb_intern("details")); sym_metadata = ID2SYM(rb_intern("metadata")); diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 558a1c47778..3a93029556f 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -38,25 +38,25 @@ #include #include -/* grpc_mGrpcCore is the module containing the ruby wrapper GRPC classes. */ -extern VALUE grpc_mGrpcCore; +/* grpc_rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */ +extern VALUE grpc_rb_mGrpcCore; /* Class used to wrap timeval structs. */ -extern VALUE grpc_cTimeVal; +extern VALUE grpc_rb_cTimeVal; -/* grpc_sNewServerRpc is the struct that holds new server rpc details. */ -extern VALUE grpc_sNewServerRpc; +/* grpc_rb_sNewServerRpc is the struct that holds new server rpc details. */ +extern VALUE grpc_rb_sNewServerRpc; -/* grpc_sStruct is the struct that holds status details. */ -extern VALUE grpc_sStatus; +/* grpc_rb_sStruct is the struct that holds status details. */ +extern VALUE grpc_rb_sStatus; -/* sym_code is the symbol for the code attribute of grpc_sStatus. */ +/* sym_code is the symbol for the code attribute of grpc_rb_sStatus. */ VALUE sym_code; -/* sym_details is the symbol for the details attribute of grpc_sStatus. */ +/* sym_details is the symbol for the details attribute of grpc_rb_sStatus. */ VALUE sym_details; -/* sym_metadata is the symbol for the metadata attribute of grpc_sStatus. */ +/* sym_metadata is the symbol for the metadata attribute of grpc_rb_sStatus. */ VALUE sym_metadata; /* GC_NOT_MARKED is used in calls to Data_Wrap_Struct to indicate that the diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index c81906b60fd..33d9d695008 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -43,8 +43,8 @@ #include "rb_server_credentials.h" #include "rb_grpc.h" -/* grpc_cServer is the ruby class that proxies grpc_server. */ -VALUE grpc_cServer = Qnil; +/* grpc_rb_cServer is the ruby class that proxies grpc_server. */ +VALUE grpc_rb_cServer = Qnil; /* id_at is the constructor method of the ruby standard Time class. */ static ID id_at; @@ -143,7 +143,7 @@ static VALUE grpc_rb_server_init_copy(VALUE copy, VALUE orig) { /* Raise an error if orig is not a server object or a subclass. */ if (TYPE(orig) != T_DATA || RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_server_free) { - rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_cServer)); + rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_rb_cServer)); } Data_Get_Struct(orig, grpc_rb_server, orig_srv); @@ -208,7 +208,8 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue, ROBJECT(tag_new)); if (err != GRPC_CALL_OK) { grpc_request_call_stack_cleanup(&st); - rb_raise(grpc_eCallError, "grpc_server_request_call failed: %s (code=%d)", + rb_raise(grpc_rb_eCallError, + "grpc_server_request_call failed: %s (code=%d)", grpc_call_error_detail_of(err), err); return Qnil; } @@ -220,14 +221,14 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue, if (ev->data.op_complete != GRPC_OP_OK) { grpc_request_call_stack_cleanup(&st); grpc_event_finish(ev); - rb_raise(grpc_eCallError, "request_call completion failed: (code=%d)", + rb_raise(grpc_rb_eCallError, "request_call completion failed: (code=%d)", ev->data.op_complete); return Qnil; } /* build the NewServerRpc struct result */ result = rb_struct_new( - grpc_sNewServerRpc, + grpc_rb_sNewServerRpc, rb_str_new2(st.details.method), rb_str_new2(st.details.host), rb_funcall(rb_cTime, id_at, 2, INT2NUM(st.details.deadline.tv_sec), @@ -313,21 +314,25 @@ static VALUE grpc_rb_server_add_http2_port(int argc, VALUE *argv, VALUE self) { } void Init_grpc_server() { - grpc_cServer = rb_define_class_under(grpc_mGrpcCore, "Server", rb_cObject); + grpc_rb_cServer = + rb_define_class_under(grpc_rb_mGrpcCore, "Server", rb_cObject); /* Allocates an object managed by the ruby runtime */ - rb_define_alloc_func(grpc_cServer, grpc_rb_server_alloc); + rb_define_alloc_func(grpc_rb_cServer, grpc_rb_server_alloc); /* Provides a ruby constructor and support for dup/clone. */ - rb_define_method(grpc_cServer, "initialize", grpc_rb_server_init, 2); - rb_define_method(grpc_cServer, "initialize_copy", grpc_rb_server_init_copy, 1); + rb_define_method(grpc_rb_cServer, "initialize", grpc_rb_server_init, 2); + rb_define_method(grpc_rb_cServer, "initialize_copy", + grpc_rb_server_init_copy, 1); /* Add the server methods. */ - rb_define_method(grpc_cServer, "request_call", grpc_rb_server_request_call, 3); - rb_define_method(grpc_cServer, "start", grpc_rb_server_start, 0); - rb_define_method(grpc_cServer, "destroy", grpc_rb_server_destroy, 0); - rb_define_alias(grpc_cServer, "close", "destroy"); - rb_define_method(grpc_cServer, "add_http2_port", grpc_rb_server_add_http2_port, + rb_define_method(grpc_rb_cServer, "request_call", + grpc_rb_server_request_call, 3); + rb_define_method(grpc_rb_cServer, "start", grpc_rb_server_start, 0); + rb_define_method(grpc_rb_cServer, "destroy", grpc_rb_server_destroy, 0); + rb_define_alias(grpc_rb_cServer, "close", "destroy"); + rb_define_method(grpc_rb_cServer, "add_http2_port", + grpc_rb_server_add_http2_port, -1); id_at = rb_intern("at"); } diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h index 8bd4f449799..22e88a7d46e 100644 --- a/src/ruby/ext/grpc/rb_server.h +++ b/src/ruby/ext/grpc/rb_server.h @@ -37,9 +37,9 @@ #include #include -/* grpc_cServer is the Server class whose instances proxy +/* grpc_rb_cServer is the Server class whose instances proxy grpc_byte_buffer. */ -extern VALUE grpc_cServer; +extern VALUE grpc_rb_cServer; /* Initializes the Server class. */ void Init_grpc_server(); diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index bdeb93d58b0..8b813eaca1c 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -109,7 +109,7 @@ static VALUE grpc_rb_server_credentials_init_copy(VALUE copy, VALUE orig) { if (TYPE(orig) != T_DATA || RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_server_credentials_free) { rb_raise(rb_eTypeError, "not a %s", - rb_obj_classname(grpc_cServerCredentials)); + rb_obj_classname(grpc_rb_cServerCredentials)); } Data_Get_Struct(orig, grpc_rb_server_credentials, orig_ch); @@ -180,21 +180,22 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs, return self; } -/* grpc_cServerCredentials is the ruby class that proxies +/* grpc_rb_cServerCredentials is the ruby class that proxies grpc_server_credentials. */ -VALUE grpc_cServerCredentials = Qnil; +VALUE grpc_rb_cServerCredentials = Qnil; void Init_grpc_server_credentials() { - grpc_cServerCredentials = - rb_define_class_under(grpc_mGrpcCore, "ServerCredentials", rb_cObject); + grpc_rb_cServerCredentials = + rb_define_class_under(grpc_rb_mGrpcCore, "ServerCredentials", rb_cObject); /* Allocates an object managed by the ruby runtime */ - rb_define_alloc_func(grpc_cServerCredentials, grpc_rb_server_credentials_alloc); + rb_define_alloc_func(grpc_rb_cServerCredentials, + grpc_rb_server_credentials_alloc); /* Provides a ruby constructor and support for dup/clone. */ - rb_define_method(grpc_cServerCredentials, "initialize", + rb_define_method(grpc_rb_cServerCredentials, "initialize", grpc_rb_server_credentials_init, 3); - rb_define_method(grpc_cServerCredentials, "initialize_copy", + rb_define_method(grpc_rb_cServerCredentials, "initialize_copy", grpc_rb_server_credentials_init_copy, 1); id_pem_cert_chain = rb_intern("__pem_cert_chain"); diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h index bca6e281f44..f79a8693581 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.h +++ b/src/ruby/ext/grpc/rb_server_credentials.h @@ -37,9 +37,9 @@ #include #include -/* grpc_cServerCredentials is the ruby class whose instances proxy +/* grpc_rb_cServerCredentials is the ruby class whose instances proxy grpc_server_credentials. */ -extern VALUE grpc_cServerCredentials; +extern VALUE grpc_rb_cServerCredentials; /* Initializes the ruby ServerCredentials class. */ void Init_grpc_server_credentials();