lib/dcell/directory.rb in dcell-0.10.0 vs lib/dcell/directory.rb in dcell-0.12.0.pre

- old
+ new

@@ -1,35 +1,23 @@ module DCell # Directory of nodes connected to the DCell cluster module Directory extend self - @@directory = {} - @@directory_lock = Mutex.new - # Get the URL for a particular Node ID def get(node_id) - @@directory_lock.synchronize do - @@directory[node_id] - end + DCell.registry.get_node node_id end alias_method :[], :get # Set the address of a particular Node ID def set(node_id, addr) - @@directory_lock.synchronize do - @@directory[node_id] = addr - end + DCell.registry.set_node node_id, addr end alias_method :[]=, :set # List all of the node IDs in the directory def all - @@directory_lock.synchronize { @@directory.keys } - end - - # Clear the directory. - def clear - @@directory_lock.synchronize { @@directory.clear } + DCell.registry.nodes end end end