All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
aerospike_llist.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2016 Aerospike, Inc.
3  *
4  * Portions may be licensed to Aerospike, Inc. under one or more contributor
5  * license agreements.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8  * use this file except in compliance with the License. You may obtain a copy of
9  * the License at http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14  * License for the specific language governing permissions and limitations under
15  * the License.
16  */
17 #pragma once
18 
19 /**
20  * Functionality related to Large List Data Type
21  */
22 
23 #include <aerospike/aerospike.h>
24 #include <aerospike/as_error.h>
25 #include <aerospike/as_ldt.h>
27 #include <aerospike/as_policy.h>
28 #include <aerospike/as_status.h>
29 #include <aerospike/as_key.h>
30 #include <aerospike/as_val.h>
31 #include <aerospike/as_boolean.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /******************************************************************************
38  * FUNCTIONS
39  *****************************************************************************/
40 
41 /**
42  * Add a value into the llist.
43  *
44  * ~~~~~~~~~~{.c}
45  * as_key key;
46  * as_key_init(&key, "myns", "myset", "mykey");
47  *
48  * as_ldt llist;
49  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
50  *
51  * as_integer ival;
52  * as_integer_init(&ival, 123);
53  *
54  * if ( aerospike_llist_add(&as, &err, NULL, &key, &llist, (as_val *) &ival) != AEROSPIKE_OK ) {
55  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
56  * }
57  * ~~~~~~~~~~
58  *
59  * @param as The aerospike instance to use for this operation.
60  * @param err The as_error to be populated if an error occurs.
61  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
62  * @param key The key of the record.
63  * @param ldt The ldt bin to insert values to.
64  * @param val The value to insert into the llist.
65  *
66  * @return AEROSPIKE_OK if successful. Otherwise an error.
67  *
68  * @ingroup ldt_operations
69  */
71  aerospike * as, as_error * err, const as_policy_apply * policy,
72  const as_key * key, const as_ldt * ldt, const as_val * val);
73 
74 /**
75  * Add / update a value into the llist. Existing value will be overwritten.
76  *
77  * ~~~~~~~~~~{.c}
78  * as_key key;
79  * as_key_init(&key, "myns", "myset", "mykey");
80  *
81  * as_ldt llist;
82  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
83  *
84  * as_integer ival;
85  * as_integer_init(&ival, 123);
86  *
87  * if ( aerospike_llist_update(&as, &err, NULL, &key, &llist, (as_val *) &ival) != AEROSPIKE_OK ) {
88  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
89  * }
90  * ~~~~~~~~~~
91  *
92  * @param as The aerospike instance to use for this operation.
93  * @param err The as_error to be populated if an error occurs.
94  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
95  * @param key The key of the record.
96  * @param ldt The ldt bin to insert values to.
97  * @param val The value to update/insert into the llist.
98  *
99  * @return AEROSPIKE_OK if successful. Otherwise an error.
100  *
101  * @ingroup ldt_operations
102  */
104  aerospike * as, as_error * err, const as_policy_apply * policy,
105  const as_key * key, const as_ldt * ldt, const as_val * val);
106 
107 
108 
109 /**
110  * Add a list of values into the llist.
111  *
112  * ~~~~~~~~~~{.c}
113  * as_key key;
114  * as_key_init(&key, "myns", "myset", "mykey");
115  *
116  * as_ldt llist;
117  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
118  *
119  *
120  * as_arraylist vals;
121  * as_arraylist_inita(&vals, 2);
122  * as_string s;
123  * as_string_init(s,"a string",false);
124  * as_arraylist_append_string(&vals, s);
125  * as_arraylist_append_int64(&vals, 35);
126  *
127  * if ( aerospike_llist_add_all(&as, &err, NULL, &key, &llist, (as_list *)vals) != AEROSPIKE_OK ) {
128  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
129  * }
130  *
131  * ~~~~~~~~~~
132  *
133  * @param as The aerospike instance to use for this operation.
134  * @param err The as_error to be populated if an error occurs.
135  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
136  * @param key The key of the record.
137  * @param ldt The ldt bin to insert values to.
138  * @param vals The list of values to insert into the llist.
139  *
140  * @return AEROSPIKE_OK if successful. Otherwise an error.
141  *
142  * @ingroup ldt_operations
143  */
145  aerospike * as, as_error * err, const as_policy_apply * policy,
146  const as_key * key, const as_ldt * ldt, const as_list * vals);
147 
148 /**
149  * Add / update a list of values into the llist.
150  * If the value in input list already exists it will be overwritten.
151  *
152  * ~~~~~~~~~~{.c}
153  * as_key key;
154  * as_key_init(&key, "myns", "myset", "mykey");
155  *
156  * as_ldt llist;
157  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
158  *
159  *
160  * as_arraylist vals;
161  * as_arraylist_inita(&vals, 2);
162  * as_string s;
163  * as_string_init(s,"a string",false);
164  * as_arraylist_append_string(&vals, s);
165  * as_arraylist_append_int64(&vals, 35);
166  *
167  * if ( aerospike_llist_update_all(&as, &err, NULL, &key, &llist, (as_list *)vals) != AEROSPIKE_OK ) {
168  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
169  * }
170  *
171  * ~~~~~~~~~~
172  *
173  * @param as The aerospike instance to use for this operation.
174  * @param err The as_error to be populated if an error occurs.
175  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
176  * @param key The key of the record.
177  * @param ldt The ldt bin to insert values to.
178  * @param vals The list of values to update/insert into the llist.
179  *
180  * @return AEROSPIKE_OK if successful. Otherwise an error.
181  *
182  * @ingroup ldt_operations
183  */
185  aerospike * as, as_error * err, const as_policy_apply * policy,
186  const as_key * key, const as_ldt * ldt, const as_list * vals);
187 
188 /**
189  * Search for a value in the llist.
190  *
191  * ~~~~~~~~~~{.c}
192  * as_key key;
193  * as_key_init(&key, "myns", "myset", "mykey");
194  *
195  * as_ldt llist;
196  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
197  *
198  * as_integer search_val;
199  * as_integer_init(&search_val, 42);
200  *
201  * as_list *result_list = NULL;
202  *
203  * if ( aerospike_llist_find(&as, &err, NULL, &key, &llist, &search_val, &result_list ) != AEROSPIKE_OK ) {
204  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
205  * }
206  * else {
207  * // do logic because element exists
208  * }
209  * ~~~~~~~~~~
210  *
211  * @param as The aerospike instance to use for this operation.
212  * @param err The as_error to be populated if an error occurs.
213  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
214  * @param key The key of the record.
215  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
216  * @param search_val The search value
217  * @param elements The returned list of values
218  *
219  * @return AEROSPIKE_OK if successful. Otherwise an error.
220  *
221  * @ingroup ldt_operations
222  */
224  aerospike * as, as_error * err, const as_policy_apply * policy,
225  const as_key * key, const as_ldt * ldt, const as_val * search_val,
226  as_list ** elements );
227 
228 /**
229  * Select values from the beginning of list up to a maximum count.
230  * Supported by server versions >= 3.5.8.
231  *
232  * ~~~~~~~~~~{.c}
233  * as_key key;
234  * as_key_init(&key, "myns", "myset", "mykey");
235  *
236  * as_ldt llist;
237  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
238  *
239  * as_list *result_list = NULL;
240  *
241  * if ( aerospike_llist_find_first(&as, &err, NULL, &key, &llist, 5, &result_list ) != AEROSPIKE_OK ) {
242  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
243  * }
244  * else {
245  * // process the returned elements
246  * as_arraylist_destroy(result_list);
247  * }
248  * ~~~~~~~~~~
249  *
250  * @param as The aerospike instance to use for this operation.
251  * @param err The as_error to be populated if an error occurs.
252  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
253  * @param key The key of the record.
254  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
255  * @param count Maximum number of values to return.
256  * @param elements The returned list of values.
257  *
258  * @return AEROSPIKE_OK if successful. Otherwise an error.
259  *
260  * @ingroup ldt_operations
261  */
263  aerospike * as, as_error * err, const as_policy_apply * policy,
264  const as_key * key, const as_ldt * ldt, uint32_t count, as_list ** elements);
265 
266 /**
267  * Select values from the beginning of list up to a maximum count after applying lua filter.
268  * Supported by server versions >= 3.5.8.
269  *
270  * ~~~~~~~~~~{.c}
271  * as_key key;
272  * as_key_init(&key, "myns", "myset", "mykey");
273  *
274  * as_ldt llist;
275  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
276  *
277  * as_list *result_list = NULL;
278  *
279  * if ( aerospike_llist_find_first_filter(&as, &err, NULL, &key, &llist, 5, "search_filter", NULL, &result_list ) != AEROSPIKE_OK ) {
280  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
281  * }
282  * else {
283  * // process the returned elements
284  * as_arraylist_destroy(result_list);
285  * }
286  * ~~~~~~~~~~
287  *
288  * @param as The aerospike instance to use for this operation.
289  * @param err The as_error to be populated if an error occurs.
290  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
291  * @param key The key of the record.
292  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
293  * @param count Maximum number of values to return.
294  * @param filter The name of the User-Defined-Function to use as a search filter.
295  * @param filter_args The list of parameters passed in to the User-Defined-Function filter.
296  * @param elements The returned list of values.
297  *
298  * @return AEROSPIKE_OK if successful. Otherwise an error.
299  *
300  * @ingroup ldt_operations
301  */
303  aerospike * as, as_error * err, const as_policy_apply * policy,
304  const as_key * key, const as_ldt * ldt, uint32_t count,
305  const as_udf_function_name filter, const as_list *filter_args, as_list ** elements);
306 
307 /**
308  * Select values from the end of list up to a maximum count.
309  * Supported by server versions >= 3.5.8.
310  *
311  * ~~~~~~~~~~{.c}
312  * as_key key;
313  * as_key_init(&key, "myns", "myset", "mykey");
314  *
315  * as_ldt llist;
316  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
317  *
318  * as_list *result_list = NULL;
319  *
320  * if ( aerospike_llist_find_last(&as, &err, NULL, &key, &llist, 5, &result_list ) != AEROSPIKE_OK ) {
321  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
322  * }
323  * else {
324  * // process the returned elements
325  * as_arraylist_destroy(result_list);
326  * }
327  * ~~~~~~~~~~
328  *
329  * @param as The aerospike instance to use for this operation.
330  * @param err The as_error to be populated if an error occurs.
331  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
332  * @param key The key of the record.
333  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
334  * @param count Maximum number of values to return.
335  * @param elements The returned list of values.
336  *
337  * @return AEROSPIKE_OK if successful. Otherwise an error.
338  *
339  * @ingroup ldt_operations
340  */
342  aerospike * as, as_error * err, const as_policy_apply * policy,
343  const as_key * key, const as_ldt * ldt, uint32_t count, as_list ** elements);
344 
345 /**
346  * Select values from the end of list up to a maximum count after applying lua filter.
347  * Supported by server versions >= 3.5.8.
348  *
349  * ~~~~~~~~~~{.c}
350  * as_key key;
351  * as_key_init(&key, "myns", "myset", "mykey");
352  *
353  * as_ldt llist;
354  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
355  *
356  * as_list *result_list = NULL;
357  *
358  * if ( aerospike_llist_find_last_filter(&as, &err, NULL, &key, &llist, 5, "search_filter", NULL, &result_list ) != AEROSPIKE_OK ) {
359  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
360  * }
361  * else {
362  * // process the returned elements
363  * as_arraylist_destroy(result_list);
364  * }
365  * ~~~~~~~~~~
366  *
367  * @param as The aerospike instance to use for this operation.
368  * @param err The as_error to be populated if an error occurs.
369  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
370  * @param key The key of the record.
371  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
372  * @param count Maximum number of values to return.
373  * @param filter The name of the User-Defined-Function to use as a search filter.
374  * @param filter_args The list of parameters passed in to the User-Defined-Function filter.
375  * @param elements The returned list of values.
376  *
377  * @return AEROSPIKE_OK if successful. Otherwise an error.
378  *
379  * @ingroup ldt_operations
380  */
382  aerospike * as, as_error * err, const as_policy_apply * policy,
383  const as_key * key, const as_ldt * ldt, uint32_t count,
384  const as_udf_function_name filter, const as_list *filter_args, as_list ** elements);
385 
386 /**
387  * Select values from the begin key up to a maximum count.
388  * Supported by server versions >= 3.5.8.
389  *
390  * ~~~~~~~~~~{.c}
391  * as_key key;
392  * as_key_init(&key, "myns", "myset", "mykey");
393  *
394  * as_ldt llist;
395  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
396  *
397  * as_integer from_val;
398  * as_integer_init(&from_val, 42);
399  *
400  * as_list *result_list = NULL;
401  *
402  * if ( aerospike_llist_find_from(&as, &err, NULL, &key, &llist, &from_val, 5, &result_list ) != AEROSPIKE_OK ) {
403  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
404  * }
405  * else {
406  * // process the returned elements
407  * as_arraylist_destroy(result_list);
408  * }
409  * ~~~~~~~~~~
410  *
411  * @param as The aerospike instance to use for this operation.
412  * @param err The as_error to be populated if an error occurs.
413  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
414  * @param key The key of the record.
415  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
416  * @param from_val Value from which to start.
417  * @param count Maximum number of values to return.
418  * @param elements The returned list of values.
419  *
420  * @return AEROSPIKE_OK if successful. Otherwise an error.
421  *
422  * @ingroup ldt_operations
423  */
425  aerospike * as, as_error * err, const as_policy_apply * policy, const as_key * key,
426  const as_ldt * ldt, const as_val * from_val, uint32_t count, as_list ** elements);
427 
428 /**
429  * Select values from the begin key up to a maximum count after applying lua filter.
430  * Supported by server versions >= 3.5.8.
431  *
432  * ~~~~~~~~~~{.c}
433  * as_key key;
434  * as_key_init(&key, "myns", "myset", "mykey");
435  *
436  * as_ldt llist;
437  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
438  *
439  * as_integer from_val;
440  * as_integer_init(&from_val, 42);
441  *
442  * as_list *result_list = NULL;
443  *
444  * if ( aerospike_llist_find_from_filter(&as, &err, NULL, &key, &llist, &from_val, 5, "search_filter", NULL, &result_list ) != AEROSPIKE_OK ) {
445  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
446  * }
447  * else {
448  * // process the returned elements
449  * as_arraylist_destroy(result_list);
450  * }
451  * ~~~~~~~~~~
452  *
453  * @param as The aerospike instance to use for this operation.
454  * @param err The as_error to be populated if an error occurs.
455  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
456  * @param key The key of the record.
457  * @param ldt The llist bin to lookup from. If not an llist bin, will return error.
458  * @param from_val Value from which to start.
459  * @param count Maximum number of values to return.
460  * @param filter The name of the User-Defined-Function to use as a search filter.
461  * @param filter_args The list of parameters passed in to the User-Defined-Function filter.
462  * @param elements The returned list of values.
463  *
464  * @return AEROSPIKE_OK if successful. Otherwise an error.
465  *
466  * @ingroup ldt_operations
467  */
469  aerospike * as, as_error * err, const as_policy_apply * policy, const as_key * key,
470  const as_ldt * ldt, const as_val * from_val, uint32_t count,
471  const as_udf_function_name filter, const as_list *filter_args, as_list ** elements);
472 
473 /**
474  * Given an llist bin, return all values in the list.
475  *
476  * ~~~~~~~~~~{.c}
477  * as_key key;
478  * as_key_init(&key, "myns", "myset", "mykey");
479  *
480  * as_ldt llist;
481  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
482  *
483  * as_list *result_list = NULL;
484  *
485  * if ( aerospike_llist_filter(&as, &err, NULL, &key, &llist,
486  * &result_list) != AEROSPIKE_OK ) {
487  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
488  * }
489  * else {
490  * // process the returned elements
491  * as_arraylist_destroy(result_list);
492  * }
493  * ~~~~~~~~~~
494  *
495  * @param as The aerospike instance to use for this operation.
496  * @param err The as_error to be populated if an error occurs.
497  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
498  * @param key The key of the record.
499  * @param ldt The llist bin to search from. If not an llist bin, will return error.
500  * @param elements The pointer to a list of elements returned from search function. Pointer should
501  * be NULL passed in.
502  *
503  * @return AEROSPIKE_OK if successful. Otherwise an error.
504  *
505  * @ingroup ldt_operations
506  */
508  aerospike * as, as_error * err, const as_policy_apply * policy,
509  const as_key * key, const as_ldt * ldt, as_list ** elements );
510 
511 /**
512  * Given an llist bin, filter the collection of objects using the given
513  * filter function. If no filter function is specified, return all values.
514  *
515  * ~~~~~~~~~~{.c}
516  * as_key key;
517  * as_key_init(&key, "myns", "myset", "mykey");
518  *
519  * as_ldt llist;
520  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
521  *
522  * as_list *result_list = NULL;
523  *
524  * if ( aerospike_llist_filter(&as, &err, NULL, &key, &llist,
525  * "search_filter", NULL, &result_list) != AEROSPIKE_OK ) {
526  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
527  * }
528  * else {
529  * // process the returned elements
530  * as_arraylist_destroy(result_list);
531  * }
532  * ~~~~~~~~~~
533  *
534  * @param as The aerospike instance to use for this operation.
535  * @param err The as_error to be populated if an error occurs.
536  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
537  * @param key The key of the record.
538  * @param ldt The llist bin to search from. If not an llist bin, will return error.
539  * @param filter The name of the User-Defined-Function to use as a search filter.
540  * @param filter_args The list of parameters passed in to the User-Defined-Function filter.
541  * @param elements The pointer to a list of elements returned from search function. Pointer should
542  * be NULL passed in.
543  *
544  * @return AEROSPIKE_OK if successful. Otherwise an error.
545  *
546  * @ingroup ldt_operations
547  */
549  aerospike * as, as_error * err, const as_policy_apply * policy,
550  const as_key * key, const as_ldt * ldt,
551  const as_udf_function_name filter, const as_list *filter_args,
552  as_list ** elements );
553 
554 /**
555  * Given an llist bin, return the key values from MIN to MAX, and then
556  * filter the returned collection of objects using the given
557  * filter function. If no filter function is specified, return all values.
558  * Limit returned values size to given count. If count is zero, do not
559  * limit returned values. Count > 0 are supported by server versions >= 3.5.8.
560  *
561  * ~~~~~~~~~~{.c}
562  * as_key key;
563  * as_key_init(&key, "myns", "myset", "mykey");
564  *
565  * as_ldt llist;
566  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
567  *
568  * as_integer min_value;
569  * as_integer_init(&min_value, 18);
570  *
571  * as_integer max_value;
572  * as_integer_init(&max_value, 99);
573  *
574  * as_list *result_list = NULL;
575  *
576  * if ( aerospike_llist_range_limit(&as, &err, NULL, &key, &llist, &min_value, &max_value, 20,
577  * "search_filter", NULL, &result_list) != AEROSPIKE_OK ) {
578  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
579  * }
580  * else {
581  * // process the returned elements
582  * as_arraylist_destroy(result_list);
583  * }
584  * ~~~~~~~~~~
585  *
586  * @param as The aerospike instance to use for this operation.
587  * @param err The as_error to be populated if an error occurs.
588  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
589  * @param key The key of the record.
590  * @param ldt The llist bin to search from. If not an llist bin, will return error.
591  * @param min_value The minimum range value (or null to be LEAST value)
592  * @param max_value The maximum range value (or null to be the GREATEST value)
593  * @param count The maximum number of values to return, pass in zero to obtain all values within range.
594  * @param filter The name of the User-Defined-Function to use as a search filter (or null if no filter)
595  * @param filter_args The list of parameters passed in to the User-Defined-Function filter (or null)
596  * @param elements The pointer to a list of elements returned from search function. Pointer should
597  * be NULL passed in.
598  *
599  * @return AEROSPIKE_OK if successful. Otherwise an error.
600  *
601  * @ingroup ldt_operations
602  */
604  aerospike * as, as_error * err, const as_policy_apply * policy,
605  const as_key * key, const as_ldt * ldt,
606  const as_val * min_value, const as_val * max_value, uint32_t count,
607  const as_udf_function_name filter, const as_list *filter_args,
608  as_list ** elements );
609 
610 /**
611  * Given an llist bin, return the key values from MIN to MAX, and then
612  * filter the returned collection of objects using the given
613  * filter function. If no filter function is specified, return all values.
614  *
615  * ~~~~~~~~~~{.c}
616  * as_key key;
617  * as_key_init(&key, "myns", "myset", "mykey");
618  *
619  * as_ldt llist;
620  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
621  *
622  * as_integer min_value;
623  * as_integer_init(&min_value, 18);
624  *
625  * as_integer max_value;
626  * as_integer_init(&max_value, 99);
627  *
628  * as_list *result_list = NULL;
629  *
630  * if ( aerospike_llist_range(&as, &err, NULL, &key, &llist, &min_value, &max_value,
631  * "search_filter", NULL, &result_list) != AEROSPIKE_OK ) {
632  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
633  * }
634  * else {
635  * // process the returned elements
636  * as_arraylist_destroy(result_list);
637  * }
638  * ~~~~~~~~~~
639  *
640  * @param as The aerospike instance to use for this operation.
641  * @param err The as_error to be populated if an error occurs.
642  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
643  * @param key The key of the record.
644  * @param ldt The llist bin to search from. If not an llist bin, will return error.
645  * @param min_value The minimum range value (or null to be LEAST value)
646  * @param max_value The maximum range value (or null to be the GREATEST value)
647  * @param filter The name of the User-Defined-Function to use as a search filter (or null if no filter)
648  * @param filter_args The list of parameters passed in to the User-Defined-Function filter (or null)
649  * @param elements The pointer to a list of elements returned from search function. Pointer should
650  * be NULL passed in.
651  *
652  * @return AEROSPIKE_OK if successful. Otherwise an error.
653  *
654  * @ingroup ldt_operations
655  */
657  aerospike * as, as_error * err, const as_policy_apply * policy,
658  const as_key * key, const as_ldt * ldt,
659  const as_val * min_value, const as_val * max_value,
660  const as_udf_function_name filter, const as_list *filter_args,
661  as_list ** elements )
662 {
663  return aerospike_llist_range_limit(as, err, policy, key, ldt, min_value, max_value, 0, filter, filter_args, elements);
664 }
665 
666 /**
667  * Look up a llist and find how many elements it contains
668  *
669  * ~~~~~~~~~~{.c}
670  * as_key key;
671  * as_key_init(&key, "myns", "myset", "mykey");
672  *
673  * as_ldt llist;
674  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
675  * uint32_t llist_size = 0;
676  *
677  * if ( aerospike_llist_size(&as, &err, NULL, &key, &llist, &llist_size) != AEROSPIKE_OK ) {
678  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
679  * }
680  * ~~~~~~~~~~
681  *
682  * @param as The aerospike instance to use for this operation.
683  * @param err The as_error to be populated if an error occurs.
684  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
685  * @param key The key of the record.
686  * @param ldt The llist to operate on. If not an llist bin, will return error.
687  * @param n Return the number of elements in the llist.
688  *
689  * @return AEROSPIKE_OK if successful. Otherwise an error.
690  *
691  * @ingroup ldt_operations
692  */
694  aerospike * as, as_error * err, const as_policy_apply * policy,
695  const as_key * key, const as_ldt * ldt,
696  uint32_t *n
697  );
698 
699 /**
700  * Delete the given value from the llist
701  *
702  * ~~~~~~~~~~{.c}
703  * as_key key;
704  * as_key_init(&key, "myns", "myset", "mykey");
705  *
706  * as_ldt llist;
707  * as_ldt_init(&llist, "llist", AS_LDT_LLIST, NULL);
708  *
709  * as_integer ival;
710  * as_integer_init(&ival, 123);
711  *
712  * if ( aerospike_llist_remove(&as, &err, NULL, &key, &llist, &ival) != AEROSPIKE_OK ) {
713  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
714  * }
715  * ~~~~~~~~~~
716  *
717  * @param as The aerospike instance to use for this operation.
718  * @param err The as_error to be populated if an error occurs.
719  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
720  * @param key The key of the record.
721  * @param ldt The llist bin to delete from. If not an llist bin, will return error.
722  * @param element The value to delete from the set.
723  *
724  * @return AEROSPIKE_OK if successful. Otherwise an error.
725  *
726  * @ingroup ldt_operations
727  */
729  aerospike * as, as_error * err, const as_policy_apply * policy,
730  const as_key * key, const as_ldt * ldt, const as_val *element
731  );
732 
733 /**
734  * Destroy the llist bin
735  *
736  * ~~~~~~~~~~{.c}
737  * as_key key;
738  * as_key_init(&key, "myns", "myset", "mykey");
739  *
740  * as_ldt llist;
741  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
742  *
743  * if ( aerospike_llist_destroy(&as, &err, NULL, &key, &llist) != AEROSPIKE_OK ) {
744  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
745  * }
746  * ~~~~~~~~~~
747  *
748  * @param as The aerospike instance to use for this operation.
749  * @param err The as_error to be populated if an error occurs.
750  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
751  * @param key The key of the record.
752  * @param ldt The llist bin to destroy. If not an llist bin, will return error.
753  *
754  * @return AEROSPIKE_OK if successful. Otherwise an error.
755  *
756  * @ingroup ldt_operations
757  */
759  aerospike * as, as_error * err, const as_policy_apply * policy,
760  const as_key * key, const as_ldt * ldt
761  );
762 
763 /**
764  * SET the storage capacity for this LDT.
765  *
766  * ~~~~~~~~~~{.c}
767  * as_key key;
768  * as_key_init(&key, "myns", "myset", "mykey");
769  *
770  * as_ldt llist;
771  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
772  * uint32_t ldt_capacity = 5000;
773  *
774  * if ( aerospike_llist_set_capacity(&as, &err, NULL, &key, &llist, ldt_capacity) != AEROSPIKE_OK ) {
775  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
776  * }
777  * ~~~~~~~~~~
778  *
779  * @param as The aerospike instance to use for this operation.
780  * @param err The as_error to be populated if an error occurs.
781  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
782  * @param key The key of the record.
783  * @param ldt The LDT to operate on. If not an LLIST bin, will return error.
784  * @param ldt_capacity Set by function to 1 for true, 0 for false
785  *
786  * @return AEROSPIKE_OK if successful. Otherwise an error.
787  *
788  * @ingroup ldt_operations
789  */
791  aerospike * as, as_error * err, const as_policy_apply * policy,
792  const as_key * key, const as_ldt * ldt,
793  uint32_t ldt_capacity
794  );
795 
796 /**
797  * Check the storage capacity for this LDT.
798  *
799  * ~~~~~~~~~~{.c}
800  * as_key key;
801  * as_key_init(&key, "myns", "myset", "mykey");
802  *
803  * as_ldt llist;
804  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
805  * uint32_t ldt_capacity = 0;
806  *
807  * if ( aerospike_llist_get_capacity(&as, &err, NULL, &key, &llist, &ldt_capacity) != AEROSPIKE_OK ) {
808  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
809  * }
810  * ~~~~~~~~~~
811  *
812  * @param as The aerospike instance to use for this operation.
813  * @param err The as_error to be populated if an error occurs.
814  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
815  * @param key The key of the record.
816  * @param ldt The LDT to operate on. If not an LLIST bin, will return error.
817  * @param ldt_capacity Set by function to 1 for true, 0 for false
818  *
819  * @return AEROSPIKE_OK if successful. Otherwise an error.
820  *
821  * @ingroup ldt_operations
822  */
824  aerospike * as, as_error * err, const as_policy_apply * policy,
825  const as_key * key, const as_ldt * ldt,
826  uint32_t *ldt_capacity
827  );
828 
829 /**
830  * Check to see if an LLIST object exists in this record bin.
831  *
832  * ~~~~~~~~~~{.c}
833  * as_key key;
834  * as_key_init(&key, "myns", "myset", "mykey");
835  *
836  * as_ldt llist;
837  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
838  * uint32_t ldt_exists = 0;
839  *
840  * if ( aerospike_llist_size(&as, &err, NULL, &key, &llist, &ldt_exists) != AEROSPIKE_OK ) {
841  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
842  * }
843  * ~~~~~~~~~~
844  *
845  * @param as The aerospike instance to use for this operation.
846  * @param err The as_error to be populated if an error occurs.
847  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
848  * @param key The key of the record.
849  * @param ldt The LDT to operate on. If not an LLIST bin, will return error.
850  * @param ldt_exists Ptr to as_boolean: Set to TRUE if ldt exists, otherwise false.
851  *
852  * @return AEROSPIKE_OK if successful. Otherwise an error.
853  *
854  * @ingroup ldt_operations
855  */
857  aerospike * as, as_error * err, const as_policy_apply * policy,
858  const as_key * key, const as_ldt * ldt,
859  as_boolean *ldt_exists
860  );
861 
862 /**
863  * Set page size for LLIST bin.
864  * Supported by server versions >= 3.5.8.
865  *
866  * ~~~~~~~~~~{.c}
867  * as_key key;
868  * as_key_init(&key, "myns", "myset", "mykey");
869  *
870  * as_ldt llist;
871  * as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
872  *
873  * if ( aerospike_llist_set_page_size(&as, &err, NULL, &key, &llist, 8192) != AEROSPIKE_OK ) {
874  * fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
875  * }
876  * ~~~~~~~~~~
877  *
878  * @param as The aerospike instance to use for this operation.
879  * @param err The as_error to be populated if an error occurs.
880  * @param policy The policy to use for this operation. If NULL, then the default policy will be used.
881  * @param key The key of the record.
882  * @param ldt The LDT to operate on. If not an LLIST bin, will return error.
883  * @param page_size The new llist page size.
884  *
885  * @return AEROSPIKE_OK if successful. Otherwise an error.
886  *
887  * @ingroup ldt_operations
888  */
890  aerospike * as, as_error * err, const as_policy_apply * policy,
891  const as_key * key, const as_ldt * ldt, uint32_t page_size);
892 
893 #ifdef __cplusplus
894 } // end extern "C"
895 #endif
as_status aerospike_llist_find_from_filter(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *from_val, uint32_t count, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
as_status aerospike_llist_get_capacity(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *ldt_capacity)
as_status aerospike_llist_find_last_filter(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t count, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
as_status aerospike_llist_filter(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
as_status aerospike_llist_update_all(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_list *vals)
as_status aerospike_llist_update(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val)
as_status aerospike_llist_find_first_filter(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t count, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
as_status aerospike_llist_range_limit(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *min_value, const as_val *max_value, uint32_t count, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
as_status aerospike_llist_scan(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_list **elements)
as_status
Definition: as_status.h:30
as_status aerospike_llist_remove(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *element)
static as_status aerospike_llist_range(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *min_value, const as_val *max_value, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
Definition: as_val.h:57
char as_udf_function_name[AS_UDF_FUNCTION_MAX_SIZE]
Definition: as_udf.h:82
as_status aerospike_llist_set_page_size(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t page_size)
as_status aerospike_llist_find_first(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t count, as_list **elements)
as_status aerospike_llist_find(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *search_val, as_list **elements)
as_status aerospike_llist_ldt_exists(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_boolean *ldt_exists)
as_status aerospike_llist_size(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *n)
as_status aerospike_llist_find_from(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *from_val, uint32_t count, as_list **elements)
as_status aerospike_llist_find_last(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t count, as_list **elements)
as_status aerospike_llist_destroy(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt)
as_status aerospike_llist_add(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val)
Definition: as_ldt.h:52
as_status aerospike_llist_set_capacity(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t ldt_capacity)
Definition: as_key.h:199
as_status aerospike_llist_add_all(aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_list *vals)