module Pione::Agent::TupleSpaceClientOperation
Public Instance Methods
base_location()
click to toggle source
# File lib/pione/agent/tuple-space-client.rb, line 32 def base_location read(TupleSpace::BaseLocationTuple.any).location end
bye()
click to toggle source
Send a bye message to the tuple space server.
# File lib/pione/agent/tuple-space-client.rb, line 18 def bye Util.ignore_exception do take!(TupleSpace::AgentTuple.new(agent_type: agent_type, uuid: uuid)) end end
finalize()
click to toggle source
Sends a bye message to the tuple space servers and terminate myself.
# File lib/pione/agent/tuple-space-client.rb, line 5 def finalize unless current_state == :terminated bye terminate end end
hello()
click to toggle source
Send a hello message to the tuple space server.
# File lib/pione/agent/tuple-space-client.rb, line 13 def hello write(TupleSpace::AgentTuple.new(agent_type: agent_type, uuid: uuid)) end
notify_exception(e)
click to toggle source
Notify the agent happened a exception.
# File lib/pione/agent/tuple-space-client.rb, line 25 def notify_exception(e) # ignore exception because the exception caused tuple server is down... Util.ignore_exception do write(TupleSpace::ExceptionTuple.new(uuid, agent_type, e)) end end
read(*args)
click to toggle source
Protected read.
Calls superclass method
# File lib/pione/agent/tuple-space-client.rb, line 44 def read(*args) tuple = super(*args, &method(:set_current_tuple_entry)) set_current_tuple_entry(nil) return tuple end
take(*args)
click to toggle source
Protected take.
Calls superclass method
# File lib/pione/agent/tuple-space-client.rb, line 37 def take(*args) tuple = super(*args, &method(:set_current_tuple_entry)) set_current_tuple_entry(nil) return tuple end
Private Instance Methods
cancel_current_tuple_entry()
click to toggle source
Cancel current tuple’s entry.
# File lib/pione/agent/tuple-space-client.rb, line 64 def cancel_current_tuple_entry current_tuple_entry.cancel if current_tuple_entry end
current_tuple_entry()
click to toggle source
Return current tuple’s entry.
# File lib/pione/agent/tuple-space-client.rb, line 53 def current_tuple_entry @__current_tuple_entry__ end
set_current_tuple_entry(entry)
click to toggle source
Set current operating tuple entry.
# File lib/pione/agent/tuple-space-client.rb, line 58 def set_current_tuple_entry(entry) @__current_tuple_entry__ = entry entry.instance_eval {if @place then def @place.to_s; ""; end; end } end