Module: Aerospike::Node::Verify::Name

Defined in:
lib/aerospike/node/verify/name.rb

Class Method Summary collapse

Class Method Details

.call(node, info_map) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/aerospike/node/verify/name.rb', line 25

def call(node, info_map)
  info_name = info_map['node']

  if !info_name
    node.decrease_health
    raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::INVALID_NODE_ERROR, 'Node name is empty')
  end

  if !(node.name == info_name)
    # Set node to inactive immediately.
    node.inactive!
    raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::INVALID_NODE_ERROR, "Node name has changed. Old=#{node.name} New= #{info_name}")
  end
end