lib/hash_ring.rb
def iterate_nodes(string_key)
    returned_values = []
    pos = self.get_node_pos(string_key)
    @_sorted_keys[pos, @_sorted_keys.length].each do |ring_index|
      key = @ring[ring_index]
      next if returned_values.include?(key)
      returned_values.push(key)
    end
    
    @_sorted_keys.each_index do |i|
      break if i >= pos

      key = @ring[@_sorted_keys[i]]
      next if returned_values.include?(key)
      returned_values.push(key)      
    end

    returned_values
  end
#
# Returns an array of nodes where the key could be stored, starting
# at the correct position.
Returns an array of nodes where the key could be stored, starting
at the correct position.
Returns an array of nodes where the key could be stored starting at the correct position .
def iterate_nodes(string_key)
    returned_values = []
    pos = self.get_node_pos(string_key)
    @_sorted_keys[pos, @_sorted_keys.length].each do |ring_index|
      key = @ring[ring_index]
      next if returned_values.include?(key)
      returned_values.push(key)
    end
    @_sorted_keys.each_index do |i|
      break if i >= pos
      key = @ring[@_sorted_keys[i]]
      next if returned_values.include?(key)
      returned_values.push(key)      
    end
    returned_values
  end
def iterate_nodes ( string_key ) returned_values = [ ] pos = self . get_node_pos ( string_key ) @_sorted_keys [ pos , @_sorted_keys . length ] . each do | ring_index | key = @ring [ ring_index ] next if returned_values . include? ( key ) returned_values . push ( key ) end @_sorted_keys . each_index do | i | break if i >= pos key = @ring [ @_sorted_keys [ i ] ] next if returned_values . include? ( key ) returned_values . push ( key ) end returned_values end
Returns an array of nodes where the key could be stored, starting
at the correct position.
Returns an array of nodes where the key could be stored starting at the correct position .
string_key