Method: Aerospike::AdminCommand#read_roles

Defined in:
lib/aerospike/command/admin_command.rb

#read_roles(cluster, policy) ⇒ Object

[View source]

500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/aerospike/command/admin_command.rb', line 500

def read_roles(cluster, policy)
  write_size
  node = cluster.random_node

  timeout = 1
  timeout = policy.timeout if policy != nil && policy.timeout > 0

  status = -1
  list = []
  begin
    conn = node.get_connection(timeout)
    conn.write(@data_buffer, @data_offset)
    status, list = read_role_blocks(conn)
    node.put_connection(conn)
  rescue => e
    conn.close if conn
    raise e
  end

  raise Exceptions::Aerospike.new(status) if status > 0

  return list
end