Class: Bones::RPC::Synchronous::Node
- Defined in:
- lib/bones/rpc/synchronous/node.rb
Overview
Represents a client to a node in a server cluster.
Constant Summary
Constants included from Instrumentable
Instrumentable::TOPIC, Instrumentable::WARN
Instance Attribute Summary
Attributes inherited from Node
#address, #cluster, #down_at, #latency, #options, #refreshed_at
Attributes included from Instrumentable
Instance Method Summary collapse
-
#abort(cause) ⇒ Object
Compatability with Celluloid.
- #async ⇒ Object
- #connection ⇒ Object
- #current_actor ⇒ Object
-
#initialize(*args) ⇒ Node
constructor
A new instance of Node.
Methods inherited from Node
#==, #adapter, #attach, #cleanup_socket, #connect, #connected?, #detach, #disconnect, #down, #down?, #ensure_connected, #handle_message, #inspect, #needs_refresh?, #notify, #refresh, #refresh_timeout, #registry_empty?, #request, #synchronize
Methods included from Instrumentable
Constructor Details
#initialize(*args) ⇒ Node
Returns a new instance of Node.
38 39 40 41 |
# File 'lib/bones/rpc/synchronous/node.rb', line 38 def initialize(*args) @mutex = ::Mutex.new super(*args) end |
Instance Method Details
#abort(cause) ⇒ Object
Compatability with Celluloid
16 17 18 |
# File 'lib/bones/rpc/synchronous/node.rb', line 16 def abort(cause) raise cause end |
#async ⇒ Object
20 21 22 |
# File 'lib/bones/rpc/synchronous/node.rb', line 20 def async self end |
#connection ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/bones/rpc/synchronous/node.rb', line 28 def connection @mutex.synchronize do if block_given? yield @connection else @connection end end end |
#current_actor ⇒ Object
24 25 26 |
# File 'lib/bones/rpc/synchronous/node.rb', line 24 def current_actor self end |