Primary index
Use the Aerospike Ruby client to scan all records in a specified namespace and set.
Example
This example counts the number of records returned:
require 'rubygems'require 'aerospike'
include Aerospike
client = Client.new("127.0.0.1")
spolicy = ScanPolicy.newspolicy.concurrent_nodes = truespolicy.include_bin_data = false
recs = client.scan_all('test', 'demoset', [], spolicy)
record_count = 0recs.each do |r| record_count += 1end
puts record_count
client.close
The scan policy is initialized, and if
concurrent_nodes = true
(default), queries nodes in parallel for records using threads. Otherwise, queries each node sequentially.include_bin_data = true
(default), specifies bins (all bins by default) to return with each record.
The scan can now execute. On error, the scan stops and an error returns as an exception to the original executing thread.