All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cl_scan.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  *****************************************************************************/
22 #pragma once
23 
24 #include <citrusleaf/cl_types.h>
25 #include <citrusleaf/cl_cluster.h>
26 
27 /******************************************************************************
28  * TYPES
29  ******************************************************************************/
30 
31 typedef struct cl_scan_param_field_s cl_scan_param_field;
32 typedef struct cl_scan_parameters_s cl_scan_parameters;
33 typedef struct cl_node_response_s cl_node_response;
34 
35 /**
36  * get many call has the following properties:
37  * you can pass null either with the namespace or the set, and a large iteration will occur
38  * Memory available vanishes after 'return', if you want a copy, make a copy
39  * Non-zero return in the callback aborts the call
40  */
41 
42 typedef enum cl_scan_priority {
48 
49 /**
50  * scan fields
51  * left-to-right bits
52  * 0-3 priority hint = ClScanningPriority
53  * 4 = failOnClusterChange
54  * 5-7 = unused
55  * 8-15 = scan_pct
56  */
58  uint8_t byte1;
59  uint8_t scan_pct;
60 };
61 
62 /**
63  * scan_option info
64  */
66  bool fail_on_cluster_change; // honored by server: terminate scan if cluster in fluctuating state
67  cl_scan_priority priority; // honored by server: priority of scan
68  bool concurrent; // honored on client: work on nodes in parallel or serially
69  uint8_t threads_per_node; // honored on client: have multiple threads per node. @TODO
70 };
71 
75  uint64_t job_id;
76 };
77 
78 /******************************************************************************
79  * INLINE FUNCTIONS
80  ******************************************************************************/
81 
82 static inline void cl_scan_parameters_set_default(cl_scan_parameters *cl_scan_p) {
83  cl_scan_p->fail_on_cluster_change = false;
84  cl_scan_p->concurrent = false;
85  cl_scan_p->threads_per_node = 1; // not honored currently
86  cl_scan_p->priority = CL_SCAN_PRIORITY_AUTO;
87 }
88 
89 
90 /******************************************************************************
91  * FUNCTIONS
92  ******************************************************************************/
93 
94 
95 cl_rv citrusleaf_scan(cl_cluster *asc, char *ns, char *set, cl_bin *bins, int n_bins, bool get_key, citrusleaf_get_many_cb cb, void *udata, bool nobindata);
96 
97 /**
98  * response is a vector of cl_node_response
99  */
100 cf_vector * citrusleaf_scan_all_nodes (
101  cl_cluster *asc, char *ns, char *set, cl_bin *bins, int n_bins, bool nobindata, uint8_t scan_pct,
102  citrusleaf_get_many_cb cb, void *udata, cl_scan_parameters *scan_p
103  );
104 
106  cl_cluster *asc, char *node_name, char *ns, char *set, cl_bin *bins, int n_bins, bool nobindata, uint8_t scan_pct,
107  citrusleaf_get_many_cb cb, void *udata, cl_scan_parameters *scan_p);
108 
109 //
110 // Asynchronous calls to perform operations on many records.
111 //
112 
113 // TODO
114 cf_vector * citrusleaf_terminate_job_all_nodes(cl_cluster *asc, uint64_t job_uid);
115 
116 // TODO
117 cf_vector * citrusleaf_get_job_status_all_nodes(cl_cluster *asc, uint64_t job_uid);
118 
119 
cl_rv
Definition: cl_types.h:64
uint64_t job_id
Definition: cl_scan.h:75
#define NODE_NAME_SIZE
Definition: cl_types.h:52
bool fail_on_cluster_change
Definition: cl_scan.h:66
cl_scan_priority
Definition: cl_scan.h:42
cl_scan_priority priority
Definition: cl_scan.h:67
uint8_t threads_per_node
Definition: cl_scan.h:69
char node_name[NODE_NAME_SIZE]
Definition: cl_scan.h:73
cl_rv citrusleaf_scan(cl_cluster *asc, char *ns, char *set, cl_bin *bins, int n_bins, bool get_key, citrusleaf_get_many_cb cb, void *udata, bool nobindata)
cf_vector * citrusleaf_get_job_status_all_nodes(cl_cluster *asc, uint64_t job_uid)
cl_rv citrusleaf_scan_node(cl_cluster *asc, char *node_name, 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)
cf_vector * citrusleaf_terminate_job_all_nodes(cl_cluster *asc, uint64_t job_uid)
int(* citrusleaf_get_many_cb)(char *ns, cf_digest *keyd, char *set, int result, uint32_t generation, uint32_t ttl, cl_bin *bins, uint16_t n_bins, void *udata)
Definition: cl_types.h:220
cl_rv node_response
Definition: cl_scan.h:74
static void cl_scan_parameters_set_default(cl_scan_parameters *cl_scan_p)
Definition: cl_scan.h:82
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)