All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
as_map_operations.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2017 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 
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /******************************************************************************
26  * TYPES
27  *****************************************************************************/
28 
29 /**
30  * Map storage order.
31  *
32  * @relates as_operations
33  * @ingroup as_operations_object
34  */
35 typedef enum as_map_order_e {
36  /**
37  * Map is not ordered. This is the default.
38  */
40 
41  /**
42  * Order map by key.
43  */
45 
46  /**
47  * Order map by key, then value.
48  */
50 } as_map_order;
51 
52 /**
53  * Map write mode.
54  *
55  * @relates as_operations
56  * @ingroup as_operations_object
57  */
58 typedef enum as_map_write_mode_e {
59  /**
60  * If the key already exists, the item will be overwritten.
61  * If the key does not exist, a new item will be created.
62  */
64 
65  /**
66  * If the key already exists, the item will be overwritten.
67  * If the key does not exist, the write will fail.
68  */
70 
71  /**
72  * If the key already exists, the write will fail.
73  * If the key does not exist, a new item will be created.
74  */
77 
78 /**
79  * Map policy directives when creating a map and writing map items.
80  *
81  * @relates as_operations
82  * @ingroup as_operations_object
83  */
84 typedef struct as_map_policy_s {
85  uint64_t attributes;
89 
90 /**
91  * Map return type. Type of data to return when selecting or removing items from the map.
92  *
93  * @relates as_operations
94  * @ingroup as_operations_object
95  */
96 typedef enum as_map_return_type_e {
97  /**
98  * Do not return a result.
99  */
101 
102  /**
103  * Return key index order.
104  */
106 
107  /**
108  * Return reverse key order.
109  */
111 
112  /**
113  * Return value order.
114  */
116 
117  /**
118  * Return reserve value order.
119  */
121 
122  /**
123  * Return count of items selected.
124  */
126 
127  /**
128  * Return key for single key read and key list for range read.
129  */
131 
132  /**
133  * Return value for single key read and value list for range read.
134  */
136 
137  /**
138  * Return key/value items.
139  */
142 
143 /******************************************************************************
144  * FUNCTIONS
145  *****************************************************************************/
146 
147 /**
148  * Initialize map attributes to default unordered map with standard overwrite semantics.
149  *
150  * @relates as_operations
151  * @ingroup as_operations_object
152  */
153 void
155 
156 /**
157  * Set map attributes to specified map order and write mode semantics.
158  *
159  * @relates as_operations
160  * @ingroup as_operations_object
161  */
162 void
164 
165 /**
166  * Create set map policy operation.
167  * Server sets map policy attributes. Server does not return a value.
168  *
169  * @relates as_operations
170  * @ingroup as_operations_object
171  */
172 bool
174 
175 /**
176  * Create map put operation.
177  * Server writes key/value item to map bin and returns map size.
178  *
179  * The required map policy dictates the type of map to create when it does not exist.
180  * The map policy also specifies the mode used when writing items to the map.
181  * See `as_map_policy` and `as_map_write_mode`.
182  *
183  * @relates as_operations
184  * @ingroup as_operations_object
185  */
186 bool
187 as_operations_add_map_put(as_operations* ops, const as_bin_name name, as_map_policy* policy, as_val* key, as_val* value);
188 
189 /**
190  * Create map put items operation.
191  * Server writes each map item to map bin and returns map size.
192  *
193  * The required map policy dictates the type of map to create when it does not exist.
194  * The map policy also specifies the mode used when writing items to the map.
195  * See `as_map_policy` and `as_map_write_mode`.
196  *
197  * @relates as_operations
198  * @ingroup as_operations_object
199  */
200 bool
202 
203 /**
204  * Create map increment operation.
205  * Server increments values by incr for all items identified by key and returns final result.
206  * Valid only for numbers.
207  *
208  * The required map policy dictates the type of map to create when it does not exist.
209  * The map policy also specifies the mode used when writing items to the map.
210  * See `as_map_policy` and `as_map_write_mode`.
211  *
212  * @relates as_operations
213  * @ingroup as_operations_object
214  */
215 bool
217 
218 /**
219  * Create map decrement operation.
220  * Server decrement values by decr for all items identified by key and returns final result.
221  * Valid only for numbers.
222  *
223  * The required map policy dictates the type of map to create when it does not exist.
224  * The map policy also specifies the mode used when writing items to the map.
225  * See `as_map_policy` and `as_map_write_mode`.
226  *
227  * @relates as_operations
228  * @ingroup as_operations_object
229  */
230 bool
232 
233 /**
234  * Create map clear operation.
235  * Server removes all items in map. Server returns null.
236  *
237  * @relates as_operations
238  * @ingroup as_operations_object
239  */
240 bool
242 
243 /**
244  * Create map remove operation.
245  * Server removes map item identified by key and returns removed data specified by return_type.
246  *
247  * @relates as_operations
248  * @ingroup as_operations_object
249  */
250 bool
252 
253 /**
254  * Create map remove operation.
255  * Server removes map items identified by keys and returns removed data specified by return_type.
256  *
257  * @relates as_operations
258  * @ingroup as_operations_object
259  */
260 bool
262 
263 /**
264  * Create map remove operation.
265  * Server removes map items identified by key range (begin inclusive, end exclusive).
266  * If begin is null, the range is less than end.
267  * If end is null, the range is greater than equal to begin.
268  *
269  * Server returns removed data specified by return_type.
270  *
271  * @relates as_operations
272  * @ingroup as_operations_object
273  */
274 bool
276 
277 /**
278  * Create map remove operation.
279  * Server removes map items identified by value and returns removed data specified by return_type.
280  *
281  * @relates as_operations
282  * @ingroup as_operations_object
283  */
284 bool
286 
287 /**
288  * Create map remove operation.
289  * Server removes map items identified by values and returns removed data specified by return_type.
290  *
291  * @relates as_operations
292  * @ingroup as_operations_object
293  */
294 bool
296 
297 /**
298  * Create map remove operation.
299  * Server removes map items identified by value range (begin inclusive, end exclusive).
300  * If begin is null, the range is less than end.
301  * If end is null, the range is greater than equal to begin.
302  *
303  * Server returns removed data specified by return_type.
304  *
305  * @relates as_operations
306  * @ingroup as_operations_object
307  */
308 bool
310 
311 /**
312  * Create map remove operation.
313  * Server removes map item identified by index and returns removed data specified by return_type.
314  *
315  * @relates as_operations
316  * @ingroup as_operations_object
317  */
318 bool
319 as_operations_add_map_remove_by_index(as_operations* ops, const as_bin_name name, int64_t index, as_map_return_type return_type);
320 
321 /**
322  * Create map remove operation.
323  * Server removes map items starting at specified index to the end of map and returns removed
324  * data specified by return_type.
325  *
326  * @relates as_operations
327  * @ingroup as_operations_object
328  */
329 bool
331 
332 /**
333  * Create map remove operation.
334  * Server removes `count` map items starting at specified index and returns removed data specified by return_type.
335  *
336  * @relates as_operations
337  * @ingroup as_operations_object
338  */
339 bool
340 as_operations_add_map_remove_by_index_range(as_operations* ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type);
341 
342 /**
343  * Create map remove operation.
344  * Server removes map item identified by rank and returns removed data specified by return_type.
345  *
346  * @relates as_operations
347  * @ingroup as_operations_object
348  */
349 bool
350 as_operations_add_map_remove_by_rank(as_operations* ops, const as_bin_name name, int64_t rank, as_map_return_type return_type);
351 
352 /**
353  * Create map remove operation.
354  * Server removes map items starting at specified rank to the last ranked item and returns removed
355  * data specified by return_type.
356  *
357  * @relates as_operations
358  * @ingroup as_operations_object
359  */
360 bool
362 
363 /**
364  * Create map remove operation.
365  * Server removes `count` map items starting at specified rank and returns removed data specified by return_type.
366  *
367  * @relates as_operations
368  * @ingroup as_operations_object
369  */
370 bool
371 as_operations_add_map_remove_by_rank_range(as_operations* ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type);
372 
373 
374 /**
375  * Create map size operation.
376  * Server returns size of map.
377  *
378  * @relates as_operations
379  * @ingroup as_operations_object
380  */
381 bool
383 
384 /**
385  * Create map get by key operation.
386  * Server selects map item identified by key and returns selected data specified by return_type.
387  *
388  * @relates as_operations
389  * @ingroup as_operations_object
390  */
391 bool
393 
394 /**
395  * Create map get by key range operation.
396  * Server selects map items identified by key range (begin inclusive, end exclusive).
397  * If begin is null, the range is less than end.
398  * If end is null, the range is greater than equal to begin.
399  *
400  * Server returns selected data specified by return_type.
401  *
402  * @relates as_operations
403  * @ingroup as_operations_object
404  */
405 bool
407 
408 /**
409  * Create map get by value operation.
410  * Server selects map items identified by value and returns selected data specified by return_type.
411  *
412  * @relates as_operations
413  * @ingroup as_operations_object
414  */
415 bool
417 
418 /**
419  * Create map get by value range operation.
420  * Server selects map items identified by value range (begin inclusive, end exclusive).
421  * If begin is null, the range is less than end.
422  * If end is null, the range is greater than equal to begin.
423  *
424  * Server returns selected data specified by return_type.
425  *
426  * @relates as_operations
427  * @ingroup as_operations_object
428  */
429 bool
431 
432 /**
433  * Create map get by index operation.
434  * Server selects map item identified by index and returns selected data specified by return_type.
435  *
436  * @relates as_operations
437  * @ingroup as_operations_object
438  */
439 bool
440 as_operations_add_map_get_by_index(as_operations* ops, const as_bin_name name, int64_t index, as_map_return_type return_type);
441 
442 /**
443  * Create map get by index range operation.
444  * Server selects map items starting at specified index to the end of map and returns selected
445  * data specified by return_type.
446  *
447  * @relates as_operations
448  * @ingroup as_operations_object
449  */
450 bool
452 
453 /**
454  * Create map get by index range operation.
455  * Server selects `count` map items starting at specified index and returns selected data specified by return_type.
456  *
457  * @relates as_operations
458  * @ingroup as_operations_object
459  */
460 bool
461 as_operations_add_map_get_by_index_range(as_operations* ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type);
462 
463 /**
464  * Create map get by rank operation.
465  * Server selects map item identified by rank and returns selected data specified by return_type.
466  *
467  * @relates as_operations
468  * @ingroup as_operations_object
469  */
470 bool
471 as_operations_add_map_get_by_rank(as_operations* ops, const as_bin_name name, int64_t rank, as_map_return_type return_type);
472 
473 /**
474  * Create map get by rank range operation.
475  * Server selects map items starting at specified rank to the last ranked item and returns selected
476  * data specified by return_type.
477  *
478  * @relates as_operations
479  * @ingroup as_operations_object
480  */
481 bool
483 
484 /**
485  * Create map get by rank range operation.
486  * Server selects `count` map items starting at specified rank and returns selected data specified by return_type.
487  *
488  * @relates as_operations
489  * @ingroup as_operations_object
490  */
491 bool
492 as_operations_add_map_get_by_rank_range(as_operations* ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type);
493 
494 #ifdef __cplusplus
495 } // end extern "C"
496 #endif
bool as_operations_add_map_remove_by_value_range(as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
void as_map_policy_set(as_map_policy *policy, as_map_order order, as_map_write_mode mode)
bool as_operations_add_map_get_by_rank_range_to_end(as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
Definition: as_map.h:61
bool as_operations_add_map_remove_by_key(as_operations *ops, const as_bin_name name, as_val *key, as_map_return_type return_type)
bool as_operations_add_map_get_by_rank(as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
bool as_operations_add_map_remove_by_key_range(as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
void as_map_policy_init(as_map_policy *policy)
bool as_operations_add_map_get_by_key(as_operations *ops, const as_bin_name name, as_val *key, as_map_return_type return_type)
Definition: as_val.h:57
bool as_operations_add_map_decrement(as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)
bool as_operations_add_map_remove_by_rank_range_to_end(as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
bool as_operations_add_map_remove_by_value_list(as_operations *ops, const as_bin_name name, as_list *items, as_map_return_type return_type)
bool as_operations_add_map_remove_by_key_list(as_operations *ops, const as_bin_name name, as_list *keys, as_map_return_type return_type)
bool as_operations_add_map_get_by_index(as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
bool as_operations_add_map_remove_by_rank_range(as_operations *ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type)
bool as_operations_add_map_get_by_index_range_to_end(as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
bool as_operations_add_map_put_items(as_operations *ops, const as_bin_name name, as_map_policy *policy, as_map *items)
bool as_operations_add_map_remove_by_index_range_to_end(as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
bool as_operations_add_map_size(as_operations *ops, const as_bin_name name)
bool as_operations_add_map_clear(as_operations *ops, const as_bin_name name)
bool as_operations_add_map_get_by_index_range(as_operations *ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type)
bool as_operations_add_map_remove_by_index_range(as_operations *ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type)
bool as_operations_add_map_get_by_value(as_operations *ops, const as_bin_name name, as_val *value, as_map_return_type return_type)
char as_bin_name[AS_BIN_NAME_MAX_SIZE]
Definition: as_bin.h:52
bool as_operations_add_map_remove_by_rank(as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
bool as_operations_add_map_remove_by_value(as_operations *ops, const as_bin_name name, as_val *value, as_map_return_type return_type)
bool as_operations_add_map_set_policy(as_operations *ops, const as_bin_name name, as_map_policy *policy)
bool as_operations_add_map_get_by_key_range(as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
bool as_operations_add_map_remove_by_index(as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
bool as_operations_add_map_increment(as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)
bool as_operations_add_map_get_by_value_range(as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
bool as_operations_add_map_get_by_rank_range(as_operations *ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type)
bool as_operations_add_map_put(as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)