All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions
aerospike_scan.h File Reference
#include <aerospike/aerospike.h>
#include <aerospike/as_error.h>
#include <aerospike/as_policy.h>
#include <aerospike/as_scan.h>
#include <aerospike/as_status.h>
#include <aerospike/as_val.h>
+ Include dependency graph for aerospike_scan.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef bool(* aerospike_scan_foreach_callback )(const as_val *val, void *udata)
 

Functions

as_status aerospike_scan_background (aerospike *as, as_error *err, const as_policy_scan *policy, const as_scan *scan, uint64_t *scan_id)
 
as_status aerospike_scan_foreach (aerospike *as, as_error *err, const as_policy_scan *policy, const as_scan *scan, aerospike_scan_foreach_callback callback, void *udata)
 
as_status aerospike_scan_info (aerospike *as, as_error *err, const as_policy_info *policy, uint64_t scan_id, as_scan_info *info)
 
as_status aerospike_scan_node (aerospike *as, as_error *err, const as_policy_scan *policy, const as_scan *scan, const char *node_name, aerospike_scan_foreach_callback callback, void *udata)
 
as_status aerospike_scan_wait (aerospike *as, as_error *err, const as_policy_info *policy, uint64_t scan_id, uint32_t interval_ms)
 

Function Documentation

as_status aerospike_scan_node ( aerospike as,
as_error err,
const as_policy_scan policy,
const as_scan scan,
const char *  node_name,
aerospike_scan_foreach_callback  callback,
void *  udata 
)

Scan the records in the specified namespace and set for a single node.

The callback function will be called for each record scanned. When all records have been scanned, then callback will be called with a NULL value for the record.

char* node_names = NULL;
int n_nodes = 0;
as_cluster_get_node_names(as->cluster, &n_nodes, &node_names);
if (n_nodes <= 0)
return <error>;
as_scan scan;
as_scan_init(&scan, "test", "demo");
if (aerospike_scan_node(&as, &err, NULL, &scan, node_names[0], callback, NULL) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
free(node_names);
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
scanThe scan to execute against the cluster.
node_nameThe node name to scan.
callbackThe function to be called for each record scanned.
udataUser-data to be passed to the callback.
Returns
AEROSPIKE_OK on success. Otherwise an error occurred.
as_status aerospike_scan_wait ( aerospike as,
as_error err,
const as_policy_info policy,
uint64_t  scan_id,
uint32_t  interval_ms 
)

Wait for a background scan to be completed by servers.

uint64_t scan_id = 1234;
aerospike_scan_wait(&as, &err, NULL, scan_id, 0);
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
scan_idThe id for the scan job.
interval_msThe polling interval in milliseconds. If zero, 1000 ms is used.
Returns
AEROSPIKE_OK on success. Otherwise an error occurred.