Class: THTP::Client::Dispatcher
- Inherits:
-
Object
- Object
- THTP::Client::Dispatcher
- Includes:
- Utils
- Defined in:
- lib/thtp/client.rb
Overview
RPC-over-HTTP protocol implementation and executor
Constant Summary collapse
- SUCCESS_FIELD =
the Thrift result field that’s set if everything went fine
'success'
Instance Method Summary collapse
-
#initialize(service, connection, protocol) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Methods included from Utils
#args_class, #canonical_name, #deserialize, #deserialize_buffer, #deserialize_stream, #elapsed_ms, #extract_rpcs, #get_time, #jsonify, #result_class, #serialize, #serialize_buffer, #serialize_stream
Constructor Details
#initialize(service, connection, protocol) ⇒ Dispatcher
Returns a new instance of Dispatcher.
31 32 33 34 35 36 37 38 39 |
# File 'lib/thtp/client.rb', line 31 def initialize(service, connection, protocol) @service = service @connection = connection @protocol = protocol # define RPC proxy methods on this instance extract_rpcs(service).each do |rpc| define_singleton_method(rpc) { |*rpc_args| post_rpc(rpc, *rpc_args) } end end |