module Aerospike::Node::Refresh::Info

Constants

CMDS_BASE
CMDS_PEERS
CMDS_REBALANCE
CMDS_SERVICES

Public Class Methods

call(node, peers) click to toggle source
# File lib/aerospike/node/refresh/info.rb, line 30
def call(node, peers)
  conn = node.tend_connection
  if peers.use_peers?
    cmds = node.cluster.rack_aware ? CMDS_REBALANCE : CMDS_PEERS
    info_map = ::Aerospike::Info.request(conn, *cmds)
    Verify::PeersGeneration.(node, info_map, peers)
    Verify::PartitionGeneration.(node, info_map)
    Verify::RebalanceGeneration.(node, info_map) if node.cluster.rack_aware
    Verify::Name.(node, info_map)
    Verify::ClusterName.(node, info_map)
  else
    info_map = ::Aerospike::Info.request(conn, *CMDS_SERVICES)
    Verify::PartitionGeneration.(node, info_map)
    Verify::Name.(node, info_map)
    Verify::ClusterName.(node, info_map)
    Refresh::Friends.(node, peers, info_map)
  end

  node.restore_health
  node.responded!

  peers.refresh_count += 1
  node.reset_failures!
rescue ::Aerospike::Exceptions::Aerospike => e
  conn.close if conn
  node.decrease_health
  peers.generation_changed = true if peers.use_peers?
  Refresh::Failed.(node, e)
end