Sha256: 14a6cb9a518c94d1456c93c506667dc69cebf2c3eb4db2e902f39c04f07f77c9
Contents?: true
Size: 1.34 KB
Versions: 3
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 :caller, :name def initialize(caller, name) super() @caller, @name = caller, name end def dispatch @caller << SuccessResponse.new(@id, Celluloid::Actor[@name]) end end # List all registered actors class List < Message attr_reader :caller def initialize(caller) super() @caller = caller end def dispatch @caller << 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dcell-0.13.0 | lib/dcell/messages.rb |
dcell-0.13.0.pre | lib/dcell/messages.rb |
dcell-0.12.0.pre | lib/dcell/messages.rb |