module Protobuf::Rpc::Server

Public Instance Methods

gc_pause() { || ... } click to toggle source
# File lib/protobuf/rpc/server.rb, line 13
def gc_pause
  ::GC.disable if ::Protobuf.gc_pause_server_request?

  yield

  ::GC.enable if ::Protobuf.gc_pause_server_request?
end
handle_request(request_data, parent_env = nil) click to toggle source

Invoke the service method dictated by the proto wrapper request object

# File lib/protobuf/rpc/server.rb, line 23
def handle_request(request_data, parent_env = nil)
  # Create an env object that holds different parts of the environment and
  # is available to all of the middlewares
  env = Env.new('encoded_request' => request_data,
                'log_signature' => log_signature,
                'parent_env' => parent_env)

  # Invoke the middleware stack, the last of which is the service dispatcher
  env = Rpc.middleware.call(env)

  env.encoded_response
end
log_signature() click to toggle source
# File lib/protobuf/rpc/server.rb, line 36
def log_signature
  @_log_signature ||= "[server-#{self.class.name}]"
end