![]() |
In order to execute a scan using the Scan API, an as_scan object must be initialized and populated.
Before using an as_scan, it must be initialized via either:
as_scan_init() should be used on a stack allocated as_scan. It will initialize the as_scan with the given namespace and set. On success, it will return a pointer to the initialized as_scan. Otherwise, NULL is returned.
as_scan_new() should be used to allocate and initialize a heap allocated as_scan. It will allocate the as_scan, then initialized it with the given namespace and set. On success, it will return a pointer to the initialized as_scan. Otherwise, NULL is returned.
When you are finished with the as_scan, you can destroy it and associated resources:
An initialized as_query can be populated with additional fields.
as_scan_select() is used to specify the bins to be selected by the scan. If a scan specifies bins to be selected, then only those bins will be returned. If no bins are selected, then all bins will be returned.
Before adding bins to select, the select structure must be initialized via either:
Both functions are given the number of bins to be selected.
A complete example using as_scan_select_inita()
A scan can return only record meta data, and exclude bins.
A scan can be made to scan all the nodes in parallel
A scan can define the percentage of record in the cluster to be scaned.
To set the priority of the scan, the set as_scan.priority.
The priority of a scan can be defined as either:
AS_SCAN_PRIORITY_AUTO
AS_SCAN_PRIORITY_LOW
AS_SCAN_PRIORITY_MEDIUM
AS_SCAN_PRIORITY_HIGH
A UDF can be applied to each record scanned.
To define the UDF for the scan, use as_scan_apply_each().
Definition at line 289 of file src/include/aerospike/as_scan.h.
#include "as_scan.h"
Public Member Functions | |
as_namespace | ns |
Data Fields | |
as_udf_call | apply_each |
bool | concurrent |
bool | no_bins |
as_namespace | ns |
uint8_t | percent |
as_scan_priority | priority |
as_scan_bins | select |
as_set | set |
Private Attributes | |
bool | _free |
Related Functions | |
(Note that these are not member functions.) | |
bool | as_scan_apply_each (as_scan *scan, const char *module, const char *function, as_list *arglist) |
void | as_scan_destroy (as_scan *scan) |
as_scan * | as_scan_init (as_scan *scan, const as_namespace ns, const as_set set) |
as_scan * | as_scan_new (const as_namespace ns, const as_set set) |
bool | as_scan_select (as_scan *scan, const char *bin) |
bool | as_scan_select_init (as_scan *scan, uint16_t n) |
bool | as_scan_set_nobins (as_scan *scan, bool nobins) |
bool | as_scan_set_percent (as_scan *scan, uint8_t percent) |
bool | as_scan_set_priority (as_scan *scan, as_scan_priority priority) |
as_namespace ns |
Namespace to be scanned.
Should be initialized via either:
Definition at line 334 of file target/Linux-x86_64/include/aerospike/as_scan.h.
|
related |
Apply a UDF to each record scanned on the server.
scan | The scan to apply the UDF to. |
module | The module containing the function to execute. |
function | The function to execute. |
arglist | The arguments for the function. |
|
related |
Releases all resources allocated to the scan.
|
related |
Initializes a scan.
When you no longer require the scan, you should release the scan and related resources via as_scan_destroy()
.
scan | The scan to initialize. |
ns | The namespace to scan. |
set | The set to scan. |
|
related |
Create and initializes a new scan on the heap.
When you no longer require the scan, you should release the scan and related resources via as_scan_destroy()
.
ns | The namespace to scan. |
set | The set to scan. |
|
related |
Select bins to be projected from matching records.
You have to ensure as_scan.select has sufficient capacity, prior to adding a bin. If capacity is insufficient then false is returned.
scan | The scan to modify. |
bin | The name of the bin to select. |
|
related |
Initializes as_scan.select
with a capacity of n
using malloc()
.
For stack allocation, use as_scan_select_inita()
.
scan | The scan to initialize. |
n | The number of bins to allocate. |
|
related |
Do not return bins. This will only return the metadata for the records.
scan | The scan to set the priority on. |
nobins | If true, then do not return bins. |
|
related |
The percentage of data to scan.
scan | The scan to set the priority on. |
percent | The percent to scan. |
|
related |
Set the priority for the scan.
scan | The scan to set the priority on. |
priority | The priority for the scan. |
|
private |
If true, then as_scan_destroy() will free this instance.
Definition at line 295 of file src/include/aerospike/as_scan.h.
as_udf_call as_scan::apply_each |
Apply the UDF for each record scanned on the server.
Should be set via as_scan_apply_each()
.
Definition at line 362 of file src/include/aerospike/as_scan.h.
bool as_scan::concurrent |
Set to true if the scan should scan all the nodes in parallel
Default value is AS_SCAN_CONCURRENT_DEFAULT.
Definition at line 323 of file src/include/aerospike/as_scan.h.
bool as_scan::no_bins |
Set to true if the scan should return only the metadata of the record.
Default value is AS_SCAN_NOBINS_DEFAULT.
Definition at line 316 of file src/include/aerospike/as_scan.h.
as_namespace ns |
Namespace to be scanned.
Should be initialized via either:
Definition at line 334 of file src/include/aerospike/as_scan.h.
uint8_t as_scan::percent |
Percentage of the data to scan.
Default value is AS_SCAN_PERCENT_DEFAULT.
Definition at line 309 of file src/include/aerospike/as_scan.h.
as_scan_priority as_scan::priority |
Priority of scan.
Default value is AS_SCAN_PRIORITY_DEFAULT.
Definition at line 302 of file src/include/aerospike/as_scan.h.
as_scan_bins as_scan::select |
Name of bins to select.
Use either of the following function to initialize:
Use as_scan_select() to populate.
Definition at line 355 of file src/include/aerospike/as_scan.h.
as_set as_scan::set |
Set to be scanned.
Should be initialized via either:
Definition at line 344 of file src/include/aerospike/as_scan.h.