Updates the module name in C extension, ensuring it compiles

pull/567/head
Tim Emiola 10 years ago
parent 67dc149403
commit 409e6c804b
  1. 4
      src/ruby/ext/grpc/rb_byte_buffer.c
  2. 2
      src/ruby/ext/grpc/rb_byte_buffer.h
  3. 12
      src/ruby/ext/grpc/rb_call.c
  4. 2
      src/ruby/ext/grpc/rb_call.h
  5. 4
      src/ruby/ext/grpc/rb_channel.c
  6. 2
      src/ruby/ext/grpc/rb_channel.h
  7. 4
      src/ruby/ext/grpc/rb_completion_queue.c
  8. 2
      src/ruby/ext/grpc/rb_completion_queue.h
  9. 4
      src/ruby/ext/grpc/rb_credentials.c
  10. 2
      src/ruby/ext/grpc/rb_credentials.h
  11. 8
      src/ruby/ext/grpc/rb_event.c
  12. 2
      src/ruby/ext/grpc/rb_event.h
  13. 46
      src/ruby/ext/grpc/rb_grpc.c
  14. 7
      src/ruby/ext/grpc/rb_grpc.h
  15. 4
      src/ruby/ext/grpc/rb_metadata.c
  16. 2
      src/ruby/ext/grpc/rb_metadata.h
  17. 4
      src/ruby/ext/grpc/rb_server.c
  18. 2
      src/ruby/ext/grpc/rb_server.h
  19. 4
      src/ruby/ext/grpc/rb_server_credentials.c
  20. 2
      src/ruby/ext/grpc/rb_server_credentials.h

@ -202,9 +202,9 @@ static VALUE grpc_rb_byte_buffer_init(VALUE self, VALUE src) {
/* rb_cByteBuffer is the ruby class that proxies grpc_byte_buffer. */
VALUE rb_cByteBuffer = Qnil;
void Init_google_rpc_byte_buffer() {
void Init_grpc_byte_buffer() {
rb_cByteBuffer =
rb_define_class_under(rb_mGoogleRpcCore, "ByteBuffer", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "ByteBuffer", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cByteBuffer, grpc_rb_byte_buffer_alloc);

@ -42,7 +42,7 @@
extern VALUE rb_cByteBuffer;
/* Initializes the ByteBuffer class. */
void Init_google_rpc_byte_buffer();
void Init_grpc_byte_buffer();
/* grpc_rb_byte_buffer_create_with_mark creates a grpc_rb_byte_buffer with a
* ruby mark object that will be kept alive while the byte_buffer is alive. */

@ -449,9 +449,9 @@ VALUE rb_cCall = Qnil;
operations; */
VALUE rb_eCallError = Qnil;
void Init_google_rpc_error_codes() {
void Init_grpc_error_codes() {
/* Constants representing the error codes of grpc_call_error in grpc.h */
VALUE rb_RpcErrors = rb_define_module_under(rb_mGoogleRpcCore, "RpcErrors");
VALUE rb_RpcErrors = rb_define_module_under(rb_mGrpcCore, "RpcErrors");
rb_define_const(rb_RpcErrors, "OK", UINT2NUM(GRPC_CALL_OK));
rb_define_const(rb_RpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR));
rb_define_const(rb_RpcErrors, "NOT_ON_SERVER",
@ -500,11 +500,11 @@ void Init_google_rpc_error_codes() {
rb_obj_freeze(rb_error_code_details);
}
void Init_google_rpc_call() {
void Init_grpc_call() {
/* CallError inherits from Exception to signal that it is non-recoverable */
rb_eCallError =
rb_define_class_under(rb_mGoogleRpcCore, "CallError", rb_eException);
rb_cCall = rb_define_class_under(rb_mGoogleRpcCore, "Call", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "CallError", rb_eException);
rb_cCall = rb_define_class_under(rb_mGrpcCore, "Call", rb_cObject);
/* Prevent allocation or inialization of the Call class */
rb_define_alloc_func(rb_cCall, grpc_rb_cannot_alloc);
@ -542,7 +542,7 @@ void Init_google_rpc_call() {
hash_all_calls = rb_hash_new();
rb_define_const(rb_cCall, "INTERNAL_ALL_CALLs", hash_all_calls);
Init_google_rpc_error_codes();
Init_grpc_error_codes();
}
/* Gets the call from the ruby object */

@ -54,6 +54,6 @@ extern VALUE rb_cCall;
extern VALUE rb_eCallError;
/* Initializes the Call class. */
void Init_google_rpc_call();
void Init_grpc_call();
#endif /* GRPC_RB_CALL_H_ */

@ -227,9 +227,9 @@ static VALUE grpc_rb_channel_destroy(VALUE self) {
/* rb_cChannel is the ruby class that proxies grpc_channel. */
VALUE rb_cChannel = Qnil;
void Init_google_rpc_channel() {
void Init_grpc_channel() {
rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject);
rb_cChannel = rb_define_class_under(rb_mGoogleRpcCore, "Channel", rb_cObject);
rb_cChannel = rb_define_class_under(rb_mGrpcCore, "Channel", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cChannel, grpc_rb_channel_alloc);

@ -41,7 +41,7 @@
extern VALUE rb_cChannel;
/* Initializes the Channel class. */
void Init_google_rpc_channel();
void Init_grpc_channel();
/* Gets the wrapped channel from the ruby wrapper */
grpc_channel* grpc_rb_get_wrapped_channel(VALUE v);

@ -159,9 +159,9 @@ static VALUE grpc_rb_completion_queue_pluck(VALUE self, VALUE tag,
/* rb_cCompletionQueue is the ruby class that proxies grpc_completion_queue. */
VALUE rb_cCompletionQueue = Qnil;
void Init_google_rpc_completion_queue() {
void Init_grpc_completion_queue() {
rb_cCompletionQueue =
rb_define_class_under(rb_mGoogleRpcCore, "CompletionQueue", rb_cObject);
rb_define_class_under(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

@ -45,6 +45,6 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v);
extern VALUE rb_cCompletionQueue;
/* Initializes the CompletionQueue class. */
void Init_google_rpc_completion_queue();
void Init_grpc_completion_queue();
#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */

@ -245,9 +245,9 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) {
/* rb_cCredentials is the ruby class that proxies grpc_credentials. */
VALUE rb_cCredentials = Qnil;
void Init_google_rpc_credentials() {
void Init_grpc_credentials() {
rb_cCredentials =
rb_define_class_under(rb_mGoogleRpcCore, "Credentials", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "Credentials", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cCredentials, grpc_rb_credentials_alloc);

@ -42,7 +42,7 @@
extern VALUE rb_cCredentials;
/* Initializes the ruby Credentials class. */
void Init_google_rpc_credentials();
void Init_grpc_credentials();
/* Gets the wrapped credentials from the ruby wrapper */
grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v);

@ -312,10 +312,10 @@ VALUE rb_cEvent = Qnil;
rpc event processing. */
VALUE rb_eEventError = Qnil;
void Init_google_rpc_event() {
void Init_grpc_event() {
rb_eEventError =
rb_define_class_under(rb_mGoogleRpcCore, "EventError", rb_eStandardError);
rb_cEvent = rb_define_class_under(rb_mGoogleRpcCore, "Event", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "EventError", rb_eStandardError);
rb_cEvent = rb_define_class_under(rb_mGrpcCore, "Event", rb_cObject);
/* Prevent allocation or inialization from ruby. */
rb_define_alloc_func(rb_cEvent, grpc_rb_cannot_alloc);
@ -332,7 +332,7 @@ void Init_google_rpc_event() {
/* Constants representing the completion types */
rb_mCompletionType =
rb_define_module_under(rb_mGoogleRpcCore, "CompletionType");
rb_define_module_under(rb_mGrpcCore, "CompletionType");
rb_define_const(rb_mCompletionType, "QUEUE_SHUTDOWN",
INT2NUM(GRPC_QUEUE_SHUTDOWN));
rb_define_const(rb_mCompletionType, "OP_COMPLETE", INT2NUM(GRPC_OP_COMPLETE));

@ -48,6 +48,6 @@ extern VALUE rb_eEventError;
VALUE grpc_rb_new_event(grpc_event *ev);
/* Initializes the Event and EventError classes. */
void Init_google_rpc_event();
void Init_grpc_event();
#endif /* GRPC_RB_EVENT_H_ */

@ -153,10 +153,10 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
return t;
}
void Init_google_status_codes() {
void Init_grpc_status_codes() {
/* Constants representing the status codes or grpc_status_code in status.h */
VALUE rb_mStatusCodes =
rb_define_module_under(rb_mGoogleRpcCore, "StatusCodes");
rb_define_module_under(rb_mGrpcCore, "StatusCodes");
rb_define_const(rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK));
rb_define_const(rb_mStatusCodes, "CANCELLED", INT2NUM(GRPC_STATUS_CANCELLED));
rb_define_const(rb_mStatusCodes, "UNKNOWN", INT2NUM(GRPC_STATUS_UNKNOWN));
@ -214,11 +214,11 @@ VALUE grpc_rb_time_val_to_s(VALUE self) {
}
/* Adds a module with constants that map to gpr's static timeval structs. */
void Init_google_time_consts() {
void Init_grpc_time_consts() {
VALUE rb_mTimeConsts =
rb_define_module_under(rb_mGoogleRpcCore, "TimeConsts");
rb_define_module_under(rb_mGrpcCore, "TimeConsts");
rb_cTimeVal =
rb_define_class_under(rb_mGoogleRpcCore, "TimeSpec", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "TimeSpec", rb_cObject);
rb_define_const(rb_mTimeConsts, "ZERO",
Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
(void *)&gpr_time_0));
@ -240,37 +240,35 @@ void Init_google_time_consts() {
void grpc_rb_shutdown(void *vm) { grpc_shutdown(); }
/* Initialize the Google RPC module structs */
/* Initialize the GRPC module structs */
/* rb_sNewServerRpc is the struct that holds new server rpc details. */
VALUE rb_sNewServerRpc = Qnil;
/* rb_sStatus is the struct that holds status details. */
VALUE rb_sStatus = Qnil;
/* Initialize the Google RPC module. */
VALUE rb_mGoogle = Qnil;
VALUE rb_mGoogleRPC = Qnil;
VALUE rb_mGoogleRpcCore = Qnil;
/* Initialize the GRPC module. */
VALUE rb_mGRPC = Qnil;
VALUE rb_mGrpcCore = Qnil;
void Init_grpc() {
grpc_init();
ruby_vm_at_exit(grpc_rb_shutdown);
rb_mGoogle = rb_define_module("Google");
rb_mGoogleRPC = rb_define_module_under(rb_mGoogle, "RPC");
rb_mGoogleRpcCore = rb_define_module_under(rb_mGoogleRPC, "Core");
rb_mGRPC = rb_define_module("GRPC");
rb_mGrpcCore = rb_define_module_under(rb_mGRPC, "Core");
rb_sNewServerRpc = rb_struct_define("NewServerRpc", "method", "host",
"deadline", "metadata", NULL);
rb_sStatus = rb_struct_define("Status", "code", "details", "metadata", NULL);
Init_google_rpc_byte_buffer();
Init_google_rpc_event();
Init_google_rpc_channel();
Init_google_rpc_completion_queue();
Init_google_rpc_call();
Init_google_rpc_credentials();
Init_google_rpc_metadata();
Init_google_rpc_server();
Init_google_rpc_server_credentials();
Init_google_status_codes();
Init_google_time_consts();
Init_grpc_byte_buffer();
Init_grpc_event();
Init_grpc_channel();
Init_grpc_completion_queue();
Init_grpc_call();
Init_grpc_credentials();
Init_grpc_metadata();
Init_grpc_server();
Init_grpc_server_credentials();
Init_grpc_status_codes();
Init_grpc_time_consts();
}

@ -38,11 +38,8 @@
#include <ruby.h>
#include <grpc/support/time.h>
/* rb_mGoogle is the top-level Google module. */
extern VALUE rb_mGoogle;
/* rb_mGoogleRpcCore is the module containing the ruby wrapper GRPC classes. */
extern VALUE rb_mGoogleRpcCore;
/* rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */
extern VALUE rb_mGrpcCore;
/* Class used to wrap timeval structs. */
extern VALUE rb_cTimeVal;

@ -187,9 +187,9 @@ static VALUE grpc_rb_metadata_value(VALUE self) {
/* rb_cMetadata is the Metadata class whose instances proxy grpc_metadata. */
VALUE rb_cMetadata = Qnil;
void Init_google_rpc_metadata() {
void Init_grpc_metadata() {
rb_cMetadata =
rb_define_class_under(rb_mGoogleRpcCore, "Metadata", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "Metadata", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cMetadata, grpc_rb_metadata_alloc);

@ -48,6 +48,6 @@ extern VALUE grpc_rb_metadata_create_with_mark(VALUE mark, grpc_metadata* md);
grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v);
/* Initializes the Metadata class. */
void Init_google_rpc_metadata();
void Init_grpc_metadata();
#endif /* GRPC_RB_METADATA_H_ */

@ -251,8 +251,8 @@ static VALUE grpc_rb_server_add_http2_port(int argc, VALUE *argv, VALUE self) {
return INT2NUM(recvd_port);
}
void Init_google_rpc_server() {
rb_cServer = rb_define_class_under(rb_mGoogleRpcCore, "Server", rb_cObject);
void Init_grpc_server() {
rb_cServer = rb_define_class_under(rb_mGrpcCore, "Server", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cServer, grpc_rb_server_alloc);

@ -42,7 +42,7 @@
extern VALUE rb_cServer;
/* Initializes the Server class. */
void Init_google_rpc_server();
void Init_grpc_server();
/* Gets the wrapped server from the ruby wrapper */
grpc_server* grpc_rb_get_wrapped_server(VALUE v);

@ -184,9 +184,9 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
grpc_server_credentials. */
VALUE rb_cServerCredentials = Qnil;
void Init_google_rpc_server_credentials() {
void Init_grpc_server_credentials() {
rb_cServerCredentials =
rb_define_class_under(rb_mGoogleRpcCore, "ServerCredentials", rb_cObject);
rb_define_class_under(rb_mGrpcCore, "ServerCredentials", rb_cObject);
/* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(rb_cServerCredentials, grpc_rb_server_credentials_alloc);

@ -42,7 +42,7 @@
extern VALUE rb_cServerCredentials;
/* Initializes the ruby ServerCredentials class. */
void Init_google_rpc_server_credentials();
void Init_grpc_server_credentials();
/* Gets the wrapped server_credentials from the ruby wrapper */
grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v);

Loading…
Cancel
Save