Class: Aerospike::BatchIndexNode
- Inherits:
-
Object
- Object
- Aerospike::BatchIndexNode
- Defined in:
- lib/aerospike/command/batch_index_node.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#keys_by_idx ⇒ Object
Returns the value of attribute keys_by_idx.
-
#node ⇒ Object
Returns the value of attribute node.
Class Method Summary collapse
Instance Method Summary collapse
- #each_key_with_index ⇒ Object
-
#initialize(node, keys_with_idx) ⇒ BatchIndexNode
constructor
A new instance of BatchIndexNode.
- #key_for_index(idx) ⇒ Object
- #keys ⇒ Object
Constructor Details
#initialize(node, keys_with_idx) ⇒ BatchIndexNode
Returns a new instance of BatchIndexNode.
30 31 32 33 |
# File 'lib/aerospike/command/batch_index_node.rb', line 30 def initialize(node, keys_with_idx) @node = node @keys_by_idx = keys_with_idx.map(&:reverse).to_h end |
Instance Attribute Details
#keys_by_idx ⇒ Object
Returns the value of attribute keys_by_idx.
22 23 24 |
# File 'lib/aerospike/command/batch_index_node.rb', line 22 def keys_by_idx @keys_by_idx end |
#node ⇒ Object
Returns the value of attribute node.
22 23 24 |
# File 'lib/aerospike/command/batch_index_node.rb', line 22 def node @node end |
Class Method Details
.generate_list(cluster, replica_policy, keys) ⇒ Object
24 25 26 27 28 |
# File 'lib/aerospike/command/batch_index_node.rb', line 24 def self.generate_list(cluster, replica_policy, keys) keys.each_with_index .group_by { |key, _| cluster.get_node_for_key(replica_policy, key) } .map { |node, keys_with_idx| BatchIndexNode.new(node, keys_with_idx) } end |
Instance Method Details
#each_key_with_index ⇒ Object
39 40 41 42 43 |
# File 'lib/aerospike/command/batch_index_node.rb', line 39 def each_key_with_index keys_by_idx.each do |idx, key| yield key, idx end end |
#key_for_index(idx) ⇒ Object
45 46 47 |
# File 'lib/aerospike/command/batch_index_node.rb', line 45 def key_for_index(idx) keys_by_idx[idx] end |
#keys ⇒ Object
35 36 37 |
# File 'lib/aerospike/command/batch_index_node.rb', line 35 def keys keys_by_idx.values end |