class Cassandra::Cluster::Schema::ReplicationStrategies::Simple

@private

Public Instance Methods

replication_map(token_hosts, token_ring, replication_options) click to toggle source
   # File lib/cassandra/cluster/schema/replication_strategies/simple.rb
26 def replication_map(token_hosts, token_ring, replication_options)
27   factor = Integer(replication_options['replication_factor'])
28   size   = token_ring.size
29   factor = size if size < factor
30   replication_map = ::Hash.new
31 
32   token_ring.each_with_index do |token, i|
33     replication_map[token] = factor.times.map do |j|
34       token_hosts[token_ring[(i + j) % size]]
35     end.freeze
36   end
37 
38   replication_map
39 end