I would like to scan a set of data. How can I do this?

How do I scan a set of data using the C Client API and Aerospike database?

Postby young » Fri May 24, 2013 8:53 am

There are 2 methods for scanning through data.

The citrusleaf_scan() with a set should work and is documented in the API. However, citrusleaf_scan_all_nodes() is a newer and better API to use. This function will trigger a scan from all the nodes in parallel from the client layer. On the other hand, the old scan method sends the scan request to one node which in turn will trigger scan on all nodes thereby creating an extra hop. We will be depricating that mechanism. So, please use the new API.

This method is new enough that it may not appear in the API documentation. Here is a brief explanation

cf_vector *
citrusleaf_scan_all_nodes (cl_cluster *asc, char *ns, char *set, cl_bin *bins, int n_bins, bool nobindata, uint8_t scan_pct,
     citrusleaf_get_many_cb cb, void *udata, cl_scan_parameters *scan_p);

The meaning of params which are common with citrusleaf_scan() are the same

  • nobindata - true/false whether the bin data should be returned or not. false is used in cases where we want only metadata of record.
  • scan_pct - what percentage of the set should be fetched. Useful if you only want to sample the data.
  • scan_p - description is in citrusleaf.h where cl_scan_parameters structure is defined.