Sha256: 1bbe7dc9cbab9ed462eb417101ca6789eeeb760adcddcbff9a5f74f1f9500a2f

Contents?: true

Size: 1.05 KB

Versions: 36

Compression:

Stored size: 1.05 KB

Contents

require 'protobuf'
require 'protobuf/logging'
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

36 entries across 36 versions & 2 rubygems

Version Path
protobuf-3.7.2.pre1 lib/protobuf/rpc/server.rb
protobuf-3.7.1 lib/protobuf/rpc/server.rb
protobuf-3.7.0 lib/protobuf/rpc/server.rb
protobuf-3.7.0.pre3 lib/protobuf/rpc/server.rb
protobuf-3.6.12 lib/protobuf/rpc/server.rb
protobuf-3.6.11 lib/protobuf/rpc/server.rb
protobuf-3.6.10 lib/protobuf/rpc/server.rb
protobuf-3.7.0.pre2 lib/protobuf/rpc/server.rb
protobuf-3.6.9 lib/protobuf/rpc/server.rb
protobuf-3.7.0.pre1 lib/protobuf/rpc/server.rb
protobuf-3.7.0.pre0 lib/protobuf/rpc/server.rb
protobuf-3.6.7 lib/protobuf/rpc/server.rb
protobuf-3.6.6 lib/protobuf/rpc/server.rb
protobuf-3.6.2 lib/protobuf/rpc/server.rb
protobuf-3.6.1 lib/protobuf/rpc/server.rb
protobuf-3.6.0 lib/protobuf/rpc/server.rb
protobuf-3.5.5 lib/protobuf/rpc/server.rb
protobuf-3.5.4 lib/protobuf/rpc/server.rb
protobuf-3.5.3 lib/protobuf/rpc/server.rb
protobuf-3.5.2 lib/protobuf/rpc/server.rb