diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb index 309dd337ecd..92203ce2529 100644 --- a/src/ruby/bin/interop/interop_client.rb +++ b/src/ruby/bin/interop/interop_client.rb @@ -47,8 +47,6 @@ require 'minitest' require 'minitest/assertions' require 'grpc' -require 'grpc/generic/client_stub' -require 'grpc/generic/service' require 'third_party/stubby/testing/proto/test.pb' require 'third_party/stubby/testing/proto/messages.pb' diff --git a/src/ruby/bin/interop/interop_server.rb b/src/ruby/bin/interop/interop_server.rb index 9e5c20d4438..35d69f6fd38 100644 --- a/src/ruby/bin/interop/interop_server.rb +++ b/src/ruby/bin/interop/interop_server.rb @@ -46,8 +46,6 @@ require 'forwardable' require 'optparse' require 'grpc' -require 'grpc/generic/service' -require 'grpc/generic/rpc_server' require 'third_party/stubby/testing/proto/test.pb' require 'third_party/stubby/testing/proto/messages.pb' diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb index 947e86adf9f..8a62764c084 100644 --- a/src/ruby/bin/math_client.rb +++ b/src/ruby/bin/math_client.rb @@ -40,8 +40,6 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) require 'grpc' -require 'grpc/generic/client_stub' -require 'grpc/generic/service' require 'math.pb' require 'optparse' diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb index d21ae7ee273..ed39144d7aa 100644 --- a/src/ruby/bin/math_server.rb +++ b/src/ruby/bin/math_server.rb @@ -41,8 +41,6 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) require 'forwardable' require 'grpc' -require 'grpc/generic/service' -require 'grpc/generic/rpc_server' require 'math.pb' require 'optparse' diff --git a/src/ruby/bin/noproto_client.rb b/src/ruby/bin/noproto_client.rb index fbd10a06b53..29ed6d9f7cc 100644 --- a/src/ruby/bin/noproto_client.rb +++ b/src/ruby/bin/noproto_client.rb @@ -37,8 +37,6 @@ lib_dir = File.join(File.dirname(this_dir), 'lib') $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) require 'grpc' -require 'grpc/generic/client_stub' -require 'grpc/generic/service' class EchoMsg def marshal diff --git a/src/ruby/bin/noproto_server.rb b/src/ruby/bin/noproto_server.rb index c5b7c192eb4..7b74fa13ec2 100644 --- a/src/ruby/bin/noproto_server.rb +++ b/src/ruby/bin/noproto_server.rb @@ -37,8 +37,6 @@ lib_dir = File.join(File.dirname(this_dir), 'lib') $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) require 'grpc' -require 'grpc/generic/rpc_server' -require 'grpc/generic/service' class EchoMsg def marshal diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 1012a836b7b..c7eec3388c8 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -34,6 +34,10 @@ require 'grpc/logconfig' require 'grpc/version' require 'grpc/core/event' require 'grpc/core/time_consts' +require 'grpc/generic/active_call' +require 'grpc/generic/client_stub' +require 'grpc/generic/service' +require 'grpc/generic/rpc_server' # alias GRPC GRPC = Google::RPC diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index 95cc7fc7082..187c23843bf 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -28,7 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'forwardable' -require 'grpc' require 'grpc/generic/bidi_call' def assert_event_type(ev, want) @@ -37,7 +36,7 @@ def assert_event_type(ev, want) raise 'Unexpected rpc event: got %s, want %s' % [got, want] unless got == want end -module GRPC +module Google::RPC # The ActiveCall class provides simple methods for sending marshallable # data to a call diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb index 91ceaa90e58..74cc9db57e0 100644 --- a/src/ruby/lib/grpc/generic/bidi_call.rb +++ b/src/ruby/lib/grpc/generic/bidi_call.rb @@ -28,9 +28,9 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'forwardable' -require 'grpc' +require 'grpc/grpc' -module GRPC +module Google::RPC # The BiDiCall class orchestrates exection of a BiDi stream on a client or # server. diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index b0e72262ffa..62628cb1f02 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -27,11 +27,10 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'grpc' require 'grpc/generic/active_call' require 'xray/thread_dump_signal_handler' -module GRPC +module Google::RPC # ClientStub represents an endpoint used to send requests to GRPC servers. class ClientStub diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index b41543e084e..10767c47dec 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -27,9 +27,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'grpc' +require 'grpc/grpc' -module GRPC +module Google::RPC # RpcDesc is a Descriptor of an RPC method. class RpcDesc < Struct.new(:name, :input, :output, :marshal_method, @@ -99,7 +99,7 @@ module GRPC # event. Send a status of deadline exceeded logger.warn("late call: #{active_call}") send_status(active_call, DEADLINE_EXCEEDED, 'late') - rescue Core::EventError => e + rescue EventError => e # This is raised by GRPC internals but should rarely, if ever happen. # Log it, but don't notify the other endpoint.. logger.warn("failed call: #{active_call}\n#{e}") diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 76e7838d0f2..7754b8d7df9 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -27,13 +27,13 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'grpc' +require 'grpc/grpc' require 'grpc/generic/active_call' require 'grpc/generic/service' require 'thread' require 'xray/thread_dump_signal_handler' -module GRPC +module Google::RPC # RpcServer hosts a number of services and makes them available on the # network. diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index 05bb0af8099..6a4356fab9e 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -27,7 +27,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'grpc' require 'grpc/generic/client_stub' require 'grpc/generic/rpc_desc' @@ -51,7 +50,7 @@ class String end -module GRPC +module Google::RPC # Provides behaviour used to implement schema-derived service classes. # diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index a8ee3c0da89..0bebe5dc375 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -28,7 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/generic/active_call' require_relative '../port_picker' include GRPC::Core::StatusCodes diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index c76f3b291ea..42da3f82ec9 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -28,8 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/generic/active_call' -require 'grpc/generic/client_stub' require 'xray/thread_dump_signal_handler' require_relative '../port_picker' diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 8a185df9c76..83979ec1643 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -28,7 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/generic/rpc_server' require 'xray/thread_dump_signal_handler' Pool = GRPC::RpcServer::Pool diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb index 7c9b074abfc..5997fdb3637 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -28,10 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/generic/active_call' -require 'grpc/generic/client_stub' -require 'grpc/generic/rpc_server' -require 'grpc/generic/service' require 'xray/thread_dump_signal_handler' require_relative '../port_picker'