Class: Bones::RPC::Synchronous::Node

Inherits:
Node
  • Object
show all
Defined in:
lib/bones/rpc/synchronous/node.rb

Overview

Represents a client to a node in a server cluster.

Since:

  • 0.0.1

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

#instrumenter

Instance Method Summary collapse

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

#instrument

Constructor Details

#initialize(*args) ⇒ Node

Returns a new instance of Node.

Since:

  • 0.0.1



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

Since:

  • 0.0.1



16
17
18
# File 'lib/bones/rpc/synchronous/node.rb', line 16

def abort(cause)
  raise cause
end

#asyncObject

Since:

  • 0.0.1



20
21
22
# File 'lib/bones/rpc/synchronous/node.rb', line 20

def async
  self
end

#connectionObject

Since:

  • 0.0.1



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_actorObject

Since:

  • 0.0.1



24
25
26
# File 'lib/bones/rpc/synchronous/node.rb', line 24

def current_actor
  self
end