|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|