Sha256: 8470b7f355206f429e4f094f6baefc2379891c6f8bbc6f108fb1e1bea9a77f72

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 KB

Contents

require 'protobuf'
require 'protobuf/logger'
require 'protobuf/rpc/rpc.pb'
require 'protobuf/rpc/buffer'
require 'protobuf/rpc/env'
require 'protobuf/rpc/error'
require 'protobuf/rpc/middleware'
require 'protobuf/rpc/service_dispatcher'

module Protobuf
  module Rpc
    module Server
      def gc_pause
        ::GC.disable if ::Protobuf.gc_pause_server_request?

        yield

        ::GC.enable if ::Protobuf.gc_pause_server_request?
      end

      # Invoke the service method dictated by the proto wrapper request object
      #
      def handle_request(request_data)
        # 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)

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

        env.encoded_response
      end

      def log_signature
        @_log_signature ||= "[server-#{self.class.name}]"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
protobuffy-3.5.1 lib/protobuf/rpc/server.rb
protobuffy-3.4.0 lib/protobuf/rpc/server.rb
protobuffy-3.3.0 lib/protobuf/rpc/server.rb
protobuffy-3.2.0 lib/protobuf/rpc/server.rb
protobuffy-3.1.0 lib/protobuf/rpc/server.rb
protobuf-3.2.1 lib/protobuf/rpc/server.rb
protobuf-3.2.0 lib/protobuf/rpc/server.rb
protobuf-3.1.0 lib/protobuf/rpc/server.rb
protobuf-3.0.5 lib/protobuf/rpc/server.rb
protobuf-3.0.4 lib/protobuf/rpc/server.rb
protobuf-3.0.3 lib/protobuf/rpc/server.rb
protobuf-3.0.2 lib/protobuf/rpc/server.rb
protobuf-3.0.1 lib/protobuf/rpc/server.rb
protobuf-3.0.0 lib/protobuf/rpc/server.rb
protobuf-3.0.0.rc2 lib/protobuf/rpc/server.rb
protobuf-3.0.0.rc1 lib/protobuf/rpc/server.rb