Sha256: e44d1902f877916962e7599821f7e328bbe1ddf8d752db2ee8b83d2292258e2a
Contents?: true
Size: 1.34 KB
Versions: 7
Compression:
Stored size: 1.34 KB
Contents
module DCell class Message attr_reader :id def initialize # Memoize the original object ID so it will get marshalled # Perhaps this should use a real UUID scheme @id = object_id end # Heartbeat messages inform other nodes this node is healthy class Heartbeat < Message def initialize @id = DCell.id end def dispatch node = DCell::Node[@id] node.handle_heartbeat if node end end # Query a node for the address of an actor class Find < Message attr_reader :sender, :name def initialize(sender, name) super() @sender, @name = sender, name end def dispatch @sender << SuccessResponse.new(@id, Celluloid::Actor[@name]) end end # List all registered actors class List < Message attr_reader :sender def initialize(sender) super() @sender = sender end def dispatch @sender << SuccessResponse.new(@id, Celluloid::Actor.registered) end end # Relay a message to the given recipient class Relay < Message attr_reader :recipient, :message def initialize(recipient, message) super() @recipient, @message = recipient, message end def dispatch @recipient << @message end end end end
Version data entries
7 entries across 7 versions & 2 rubygems