Sha256: b9aca26110de25952bfe36e24a55eebb4d87e1a6a15124dd2c371b803fe971a1

Contents?: true

Size: 378 Bytes

Versions: 5

Compression:

Stored size: 378 Bytes

Contents

module ConsistentHashing

  # Public: represents a virtual point on the hash ring
  #
  class VirtualPoint
    attr_reader :node, :index

    def initialize(node, index)
      @node = node
      @index = index.to_i
    end

    # Public: set a new index for the virtual point. Useful if the point gets duplicated
    def index=(index)
      @index = index.to_i
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
consistent-hashing-2.0.0 lib/consistent_hashing/virtual_point.rb
consistent-hashing-1.0.0 lib/consistent_hashing/virtual_point.rb
consistent-hashing-0.2.1 lib/consistent_hashing/virtual_point.rb
consistent-hashing-0.2.0 lib/consistent_hashing/virtual_point.rb
consistent-hashing-0.1.0 lib/consistent_hashing/virtual_point.rb