All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
as_record.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 
23 #pragma once
24 
25 #include <aerospike/as_bin.h>
26 #include <aerospike/as_bytes.h>
27 #include <aerospike/as_integer.h>
28 #include <aerospike/as_key.h>
29 #include <aerospike/as_list.h>
30 #include <aerospike/as_map.h>
31 #include <aerospike/as_rec.h>
32 #include <aerospike/as_string.h>
33 #include <aerospike/as_util.h>
34 #include <aerospike/as_val.h>
35 
36 #include <stdbool.h>
37 #include <stdint.h>
38 
39 /******************************************************************************
40  * TYPES
41  *****************************************************************************/
42 
43 /**
44  * Records in Aerospike are collections of named bins.
45  *
46  * The bins in a record are analogous to columns in relational databases.
47  * However, unlike columns, the bins themselves are not typed. Instead, bins
48  * contain values which are typed. So, it is possible to have multiple records
49  * with bins of the same name but different types for values.
50  *
51  * The bin's value can only be of the types defined in `as_bin_value`.
52  *
53  * ## Initialization
54  *
55  * There are several ways to initialize an `as_record`.
56  *
57  * You can create the `as_record` on the stack:
58  *
59  * ~~~~~~~~~~{.c}
60  * as_record rec;
61  * ~~~~~~~~~~
62  *
63  * Then initialize it using either the `as_record_init()` function or
64  * `as_record_inita()` macro.
65  *
66  * The `as_record_init()` function will initialize the variable, then
67  * allocate the specified number of bins using `malloc()`. The following
68  * initializes `rec` with 2 bins.
69  *
70  * ~~~~~~~~~~{.c}
71  * as_record_init(&rec, 2);
72  * ~~~~~~~~~~
73  *
74  * The `as_record_inita()` macro will initialize the variable, then allocate
75  * the specified number of bins using `alloca()`. The following initializes
76  * `rec` with 2 bins.
77  *
78  * ~~~~~~~~~~{.c}
79  * as_record_inita(&rec, 2);
80  * ~~~~~~~~~~
81  *
82  * The `as_record_new()` function will allocate an `as_record` on the heap
83  * using `malloc()` then allocate the specified number of bins using
84  * `malloc()`. The following creates a new `as_record` with 2 bins.
85  *
86  * ~~~~~~~~~~{.c}
87  * as_record * rec = as_record_new(2);
88  * ~~~~~~~~~~
89  *
90  * ## Destruction
91  *
92  * When you no longer require an as_record, you should call `as_record_destroy()`
93  * to release the record and associated resources.
94  *
95  * ~~~~~~~~~~{.c}
96  * as_record_destroy(rec);
97  * ~~~~~~~~~~
98  *
99  * If the record has been ref-counted, then the ref-count will be decremented,
100  * until it reaches 0 (zero), at which point, the record will be released.
101  *
102  * ## Setting Bin Values
103  *
104  * The following are functions for setting values in bins of a record. Utilize
105  * the appropriate setter for the data you want to store in a bin.
106  *
107  * Function | Description
108  * ---------------------------- | ----------------------------------------------
109  * `as_record_set_int64()` | Set the bin value to a 64-bit integer.
110  * `as_record_set_str()` | Set the bin value to a NULL-terminated string.
111  * `as_record_set_integer()` | Set the bin value to an `as_integer`.
112  * `as_record_set_string()` | Set the bin value to an `as_string`.
113  * `as_record_set_bytes()` | Set the bin value to an `as_bytes`.
114  * `as_record_set_list()` | Set the bin value to an `as_list`.
115  * `as_record_set_map()` | Set the bin value to an `as_map`.
116  * `as_record_set_nil()` | Set the bin value to an `as_nil`.
117  * `as_record_set()` | Set the bin value to an `as_bin_value`.
118  *
119  * ## Getting Bin Values
120  *
121  * The following are functions for getting values from bins of a record.
122  * Utilize the appropriate getter for the data you want to read from a bin.
123  *
124  *
125  * Function | Description
126  * ---------------------------- | ----------------------------------------------
127  * `as_record_get_int64()` | Get the bin as a 64-bit integer.
128  * `as_record_get_str()` | Get the bin as a NULL-terminated string.
129  * `as_record_get_integer()` | Get the bin as an `as_integer`.
130  * `as_record_get_string()` | Get the bin as an `as_string`.
131  * `as_record_get_bytes()` | Get the bin as an `as_bytes`.
132  * `as_record_get_list()` | Get the bin as an `as_list`.
133  * `as_record_get_map()` | Get the bin as an `as_map`.
134  * `as_record_get()` | Get the bin as an `as_bin_value`.
135  *
136  * If you are unsure of the type of data stored in the bin, then you should
137  * use `as_record_get()`. You can then check the type of the value using
138  * `as_val_type()`.
139  *
140  * ~~~~~~~~~~{.c}
141  * as_val * value = as_record_get(rec, "bin1");
142  * switch ( as_val_type(value) ) {
143  * case AS_NIL: break;
144  * case AS_INTEGER: break;
145  * case AS_STRING: break;
146  * case AS_BYTES: break;
147  * case AS_LIST: break;
148  * case AS_MAP: break;
149  * case AS_REC: break;
150  * case AS_UNDEF: break;
151  * }
152  * ~~~~~~~~~~
153  *
154  * ## Traversing Bins
155  *
156  * If you want to traverse the bins of a record, then you have two options:
157  *
158  * - as_record_foreach() — Calls a function for each bin traversed.
159  * - as_record_iterator — Uses an iterator pattern to traverse bins.
160  *
161  * @extends as_rec
162  * @ingroup client_objects
163  */
164 typedef struct as_record_s {
165 
166  /**
167  * @private
168  * as_record is "derived" from as_rec.
169  * So you can actually type cast as_record to as_rec.
170  */
172 
173  /**
174  * The key of the record.
175  * This is populated when a record is read from the database.
176  * This should not be set by the user.
177  */
179 
180  /**
181  * The generation of the record.
182  */
183  uint16_t gen;
184 
185  /**
186  * The time-to-live (expiration) of the record in seconds.
187  */
188  uint32_t ttl;
189 
190  /**
191  * The bins of the record.
192  */
194 
195 } as_record;
196 
197 /******************************************************************************
198  * MACROS
199  *****************************************************************************/
200 
201 /**
202  * Initialize a stack allocated `as_record` then allocate `__nbins` capacity
203  * for as_record.bins on the stack.
204  *
205  * ~~~~~~~~~~{.c}
206  * as_record record;
207  * as_record_inita(&record, 2);
208  * as_record_set_int64(&record, "bin1", 123);
209  * as_record_set_int64(&record, "bin2", 456);
210  * ~~~~~~~~~~
211  *
212  * When you are finished using the `as_record` instance, you should release the
213  * resources allocated to it by calling `as_record_destroy()`.
214  *
215  * @param __rec The `as_record *` to initialize.
216  * @param __nbins The number of `as_record.bins.entries` to allocate on the
217  * stack.
218  *
219  * @relates as_record
220  */
221 #define as_record_inita(__rec, __nbins) \
222  as_record_init(__rec, 0);\
223  (__rec)->bins._free = false;\
224  (__rec)->bins.capacity = __nbins;\
225  (__rec)->bins.size = 0;\
226  (__rec)->bins.entries = (as_bin *) alloca(sizeof(as_bin) * __nbins);
227 
228 /******************************************************************************
229  * FUNCTIONS
230  *****************************************************************************/
231 
232 /**
233  * Create a new as_record on the heap.
234  *
235  * ~~~~~~~~~~{.c}
236  * as_record * r = as_record_new(2);
237  * as_record_set_int64(r, "bin1", 123);
238  * as_record_set_str(r, "bin1", "abc");
239  * ~~~~~~~~~~
240  *
241  * When you are finished using the `as_record` instance, you should release the
242  * resources allocated to it by calling `as_record_destroy()`.
243  *
244  * @param nbins The number of bins to initialize. Set to 0, if unknown.
245  *
246  * @return a pointer to the new as_record if successful, otherwise NULL.
247  *
248  * @relates as_record
249  */
250 as_record * as_record_new(uint16_t nbins);
251 
252 /**
253  * Initializes an as_record created on the stack.
254  *
255  * ~~~~~~~~~~{.c}
256  * as_record r;
257  * as_record_init(&r, 2);
258  * as_record_set_int64(&r, "bin1", 123);
259  * as_record_set_str(&r, "bin1", "abc");
260  * ~~~~~~~~~~
261  *
262  * When you are finished using the `as_record` instance, you should release the
263  * resources allocated to it by calling `as_record_destroy()`.
264  *
265  * @param rec The record to initialize.
266  * @param nbins The number of bins to initialize. Set to 0, if unknown.
267  *
268  * @return a pointer to the initialized as_record if successful, otherwise NULL.
269  *
270  * @relates as_record
271  */
272 as_record * as_record_init(as_record * rec, uint16_t nbins);
273 
274 /**
275  * Destroy the as_record and associated resources.
276  *
277  * @param rec The record to destroy.
278  *
279  * @relates as_record
280  */
281 void as_record_destroy(as_record * rec);
282 
283 /**
284  * Get the number of bins in the record.
285  *
286  * @return the number of bins in the record.
287  *
288  * @relates as_record
289  */
290 uint16_t as_record_numbins(const as_record * rec);
291 
292 /**
293  * Set specified bin's value to an as_bin_value.
294  *
295  * @param rec The record containing the bin.
296  * @param name The name of the bin.
297  * @param value The value of the bin.
298  *
299  * @return true on success, false on failure.
300  *
301  * @relates as_record
302  */
303 bool as_record_set(as_record * rec, const as_bin_name name, as_bin_value * value);
304 
305 /**
306  * Set specified bin's value to an int64_t.
307  *
308  * ~~~~~~~~~~{.c}
309  * as_record_set_int64(rec, "bin", 123);
310  * ~~~~~~~~~~
311  *
312  * @param rec The record containing the bin.
313  * @param name The name of the bin.
314  * @param value The value of the bin.
315  *
316  * @return true on success, false on failure.
317  *
318  * @relates as_record
319  */
320 bool as_record_set_int64(as_record * rec, const as_bin_name name, int64_t value);
321 
322 /**
323  * Set specified bin's value to an NULL terminated string.
324  *
325  * ~~~~~~~~~~{.c}
326  * as_record_set_strp(rec, "bin", strdup("abc"), true);
327  * ~~~~~~~~~~
328  *
329  * @param rec The record containing the bin.
330  * @param name The name of the bin.
331  * @param value The value of the bin.
332  * @param free If true, then the value will be freed when the record is destroyed.
333  *
334  * @return true on success, false on failure.
335  *
336  * @relates as_record
337  */
338 bool as_record_set_strp(as_record * rec, const as_bin_name name, const char * value, bool free);
339 
340 /**
341  * Set specified bin's value to an NULL terminated string.
342  *
343  * ~~~~~~~~~~{.c}
344  * as_record_set_str(rec, "bin", "abc");
345  * ~~~~~~~~~~
346  *
347  * @param rec The record containing the bin.
348  * @param name The name of the bin.
349  * @param value The value of the bin. Must last for the lifetime of the record.
350  *
351  * @return true on success, false on failure.
352  *
353  * @relates as_record
354  */
355 inline bool as_record_set_str(as_record * rec, const as_bin_name name, const char * value)
356 {
357  return as_record_set_strp(rec, name, value, false);
358 }
359 
360 /**
361  * Set specified bin's value to an NULL terminated string.
362  *
363  * ~~~~~~~~~~{.c}
364  * uint8_t * bytes = (uint8_t *) malloc(3);
365  * bytes[0] = 1;
366  * bytes[1] = 2;
367  * bytes[3] = 3;
368  *
369  * as_record_set_raw(rec, "bin", bytes, 3, true);
370  * ~~~~~~~~~~
371  *
372  * @param rec The record containing the bin.
373  * @param name The name of the bin.
374  * @param value The value of the bin.
375  * @param size The size of the value.
376  * @param free If true, then the value will be freed when the record is destroyed.
377  *
378  * @return true on success, false on failure.
379  *
380  * @relates as_record
381  */
382 bool as_record_set_rawp(as_record * rec, const as_bin_name name, const uint8_t * value, uint32_t size, bool free);
383 
384 /**
385  * Set specified bin's value to an NULL terminated string.
386  *
387  * ~~~~~~~~~~{.c}
388  * uint8_t bytes[3] = {1,2,3};
389  * as_record_set_raw(rec, "bin", bytes, 3);
390  * ~~~~~~~~~~
391  *
392  * @param rec The record containing the bin.
393  * @param name The name of the bin.
394  * @param value The value of the bin.
395  * @param size The size of the value. Must last for the lifetime of the record.
396  *
397  * @return true on success, false on failure.
398  *
399  * @relates as_record
400  */
401 inline bool as_record_set_raw(as_record * rec, const as_bin_name name, const uint8_t * value, uint32_t size)
402 {
403  return as_record_set_rawp(rec, name, value, size, false);
404 }
405 
406 /**
407  * Set specified bin's value to an as_integer.
408  *
409  * ~~~~~~~~~~{.c}
410  * as_record_set_integer(rec, "bin", as_integer_new(123));
411  * ~~~~~~~~~~
412  *
413  * @param rec The record containing the bin.
414  * @param name The name of the bin.
415  * @param value The value of the bin.
416  *
417  * @return true on success, false on failure.
418  *
419  * @relates as_record
420  */
421 bool as_record_set_integer(as_record * rec, const as_bin_name name, as_integer * value);
422 
423 /**
424  * Set specified bin's value to an as_string.
425  *
426  * ~~~~~~~~~~{.c}
427  * as_record_set_string(rec, "bin", as_string_new("abc", false));
428  * ~~~~~~~~~~
429  *
430  * @param rec The record containing the bin.
431  * @param name The name of the bin.
432  * @param value The value of the bin.
433  *
434  * @return true on success, false on failure.
435  *
436  * @relates as_record
437  */
438 bool as_record_set_string(as_record * rec, const as_bin_name name, as_string * value);
439 
440 /**
441  * Set specified bin's value to an as_bytes.
442  *
443  * ~~~~~~~~~~{.c}
444  * as_record_set_integer(rec, "bin", bytes);
445  * ~~~~~~~~~~
446  *
447  * @param rec The record containing the bin.
448  * @param name The name of the bin.
449  * @param value The value of the bin.
450  *
451  * @return true on success, false on failure.
452  *
453  * @relates as_record
454  */
455 bool as_record_set_bytes(as_record * rec, const as_bin_name name, as_bytes * value);
456 
457 /**
458  * Set specified bin's value to an as_list.
459  *
460  * ~~~~~~~~~~{.c}
461  * as_arraylist list;
462  * as_arraylist_init(&list);
463  * as_arraylist_add_int64(&list, 1);
464  * as_arraylist_add_int64(&list, 2);
465  * as_arraylist_add_int64(&list, 3);
466  *
467  * as_record_set_list(rec, "bin", &list);
468  * ~~~~~~~~~~
469  *
470  * @param rec The record containing the bin.
471  * @param name The name of the bin.
472  * @param value The value of the bin.
473  *
474  * @return true on success, false on failure.
475  *
476  * @relates as_record
477  */
478 bool as_record_set_list(as_record * rec, const as_bin_name name, as_list * value);
479 
480 /**
481  * Set specified bin's value to an as_map.
482  *
483  * ~~~~~~~~~~{.c}
484  * as_map map;
485  * as_stringmap_init(&map);
486  * as_stringmap_set_int64(&map, "a", 1);
487  * as_stringmap_set_int64(&map, "b", 2);
488  * as_stringmap_set_int64(&map, "c", 3);
489  *
490  * as_record_set_map(rec, "bin", &map);
491  * ~~~~~~~~~~
492  *
493  * @param rec The record containing the bin.
494  * @param name The name of the bin.
495  * @param value The value of the bin.
496  *
497  * @return true on success, false on failure.
498  *
499  * @relates as_record
500  */
501 bool as_record_set_map(as_record * rec, const as_bin_name name, as_map * value);
502 
503 /**
504  * Set specified bin's value to as_nil.
505  *
506  * ~~~~~~~~~~{.c}
507  * as_record_set_nil(rec, "bin");
508  * ~~~~~~~~~~
509  *
510  * @param rec The record containing the bin.
511  * @param name The name of the bin.
512  *
513  * @return true on success, false on failure.
514  *
515  * @relates as_record
516  */
517 bool as_record_set_nil(as_record * rec, const as_bin_name name);
518 
519 /**
520  * Get specified bin's value.
521  *
522  * ~~~~~~~~~~{.c}
523  * as_val * value = as_record_get(rec, "bin");
524  * ~~~~~~~~~~
525  *
526  * @param rec The record containing the bin.
527  * @param name The name of the bin.
528  *
529  * @return the value if it exists, otherwise NULL.
530  *
531  * @relates as_record
532  */
533 as_bin_value * as_record_get(const as_record * rec, const as_bin_name name);
534 
535 /**
536  * Get specified bin's value as an int64_t.
537  *
538  * ~~~~~~~~~~{.c}
539  * int64_t value = as_record_get_int64(rec, "bin", INT64_MAX);
540  * ~~~~~~~~~~
541  *
542  * @param rec The record containing the bin.
543  * @param name The name of the bin.
544  * @param fallback The default value to use, if the bin doesn't exist or is not an integer.
545  *
546  * @return the value if it exists, otherwise 0.
547  *
548  * @relates as_record
549  */
550 int64_t as_record_get_int64(const as_record * rec, const as_bin_name name, int64_t fallback);
551 
552 /**
553  * Get specified bin's value as an NULL terminated string.
554  *
555  * ~~~~~~~~~~{.c}
556  * char * value = as_record_get_str(rec, "bin");
557  * ~~~~~~~~~~
558  *
559  * @param rec The record containing the bin.
560  * @param name The name of the bin.
561  *
562  * @return the value if it exists, otherwise NULL.
563  *
564  * @relates as_record
565  */
566 char * as_record_get_str(const as_record * rec, const as_bin_name name);
567 
568 /**
569  * Get specified bin's value as an as_integer.
570  *
571  * ~~~~~~~~~~{.c}
572  * as_integer * value = as_record_get_integer(rec, "bin");
573  * ~~~~~~~~~~
574  *
575  * @param rec The record containing the bin.
576  * @param name The name of the bin.
577  *
578  * @return the value if it exists, otherwise NULL.
579  *
580  * @relates as_record
581  */
582 as_integer * as_record_get_integer(const as_record * rec, const as_bin_name name);
583 
584 /**
585  * Get specified bin's value as an as_string.
586  *
587  * ~~~~~~~~~~{.c}
588  * as_string * value = as_record_get_string(rec, "bin");
589  * ~~~~~~~~~~
590  *
591  * @param rec The record containing the bin.
592  * @param name The name of the bin.
593  *
594  * @return the value if it exists, otherwise NULL.
595  *
596  * @relates as_record
597  */
598 as_string * as_record_get_string(const as_record * rec, const as_bin_name name);
599 
600 /**
601  * Get specified bin's value as an as_bytes.
602  *
603  * ~~~~~~~~~~{.c}
604  * as_bytes * value = as_record_get_bytes(rec, "bin");
605  * ~~~~~~~~~~
606  *
607  * @param rec The record containing the bin.
608  * @param name The name of the bin.
609  *
610  * @return the value if it exists, otherwise NULL.
611  *
612  * @relates as_record
613  */
614 as_bytes * as_record_get_bytes(const as_record * rec, const as_bin_name name);
615 
616 /**
617  * Get specified bin's value as an as_list.
618  *
619  * ~~~~~~~~~~{.c}
620  * as_list * value = as_record_get_list(rec, "bin");
621  * ~~~~~~~~~~
622  *
623  * @param rec The record containing the bin.
624  * @param name The name of the bin.
625  *
626  * @return the value if it exists, otherwise NULL.
627  *
628  * @relates as_record
629  */
630 as_list * as_record_get_list(const as_record * rec, const as_bin_name name);
631 
632 /**
633  * Get specified bin's value as an as_map.
634  *
635  * ~~~~~~~~~~{.c}
636  * as_map * value = as_record_get_map(rec, "bin");
637  * ~~~~~~~~~~
638  *
639  * @param rec The record containing the bin.
640  * @param name The name of the bin.
641  *
642  * @return the value if it exists, otherwise NULL.
643  *
644  * @relates as_record
645  */
646 as_map * as_record_get_map(const as_record * rec, const as_bin_name name);
647 
648 /******************************************************************************
649  * ITERATION FUNCTIONS
650  ******************************************************************************/
651 
652 /**
653  * Iterate over each bin in the record and invoke the callback function.
654  *
655  * ~~~~~~~~~~{.c}
656  * bool print_bin(const char * name, const as_val * value, void * udata) {
657  * char * sval = as_val_tostring(value);
658  * printf("bin: name=%s, value=%s\n", name, sval);
659  * free(sval);
660  * return true;
661  * }
662  *
663  * as_record_foreach(rec, print_bin, NULL);
664  * ~~~~~~~~~~
665  *
666  * If the callback returns true, then iteration will continue to the next bin.
667  * Otherwise, the iteration will halt and `as_record_foreach()` will return
668  * false.
669  *
670  * @param rec The record containing the bins to iterate over.
671  * @param callback The callback to invoke for each bin.
672  * @param udata User-data provided for the callback.
673  *
674  * @return true if iteration completes fully. false if iteration was aborted.
675  *
676  * @relates as_record
677  */
678 bool as_record_foreach(const as_record * rec, as_rec_foreach_callback callback, void * udata);
679 
680 /******************************************************************************
681  * CONVERSION FUNCTIONS
682  ******************************************************************************/
683 
684 /**
685  * Convert to an as_val.
686  *
687  * @relates as_record
688  */
689 inline as_val * as_record_toval(const as_record * rec)
690 {
691  return (as_val *) rec;
692 }
693 
694 /**
695  * Convert from an as_val.
696  *
697  * @relates as_record
698  */
699 inline as_record * as_record_fromval(const as_val * v)
700 {
701  return (as_record *) as_util_fromval(v, AS_REC, as_rec);
702 }
703 
as_record * as_record_fromval(const as_val *v)
Definition: as_record.h:699
as_record * as_record_new(uint16_t nbins)
AS_REC
Definition: as_val.h:215
as_bin_value * as_record_get(const as_record *rec, const as_bin_name name)
Definition: as_rec.h:65
char * as_record_get_str(const as_record *rec, const as_bin_name name)
Definition: as_map.h:62
bool as_record_set_list(as_record *rec, const as_bin_name name, as_list *value)
as_list * as_record_get_list(const as_record *rec, const as_bin_name name)
bool(* as_rec_foreach_callback)(const char *name, const as_val *value, void *udata)
Definition: as_rec.h:53
#define as_util_fromval(object, type_id, type)
Definition: as_util.h:41
as_bins bins
Definition: as_record.h:193
as_val * as_record_toval(const as_record *rec)
Definition: as_record.h:689
bool as_record_set_bytes(as_record *rec, const as_bin_name name, as_bytes *value)
as_string * as_record_get_string(const as_record *rec, const as_bin_name name)
bool as_record_set_int64(as_record *rec, const as_bin_name name, int64_t value)
bool as_record_foreach(const as_record *rec, as_rec_foreach_callback callback, void *udata)
uint16_t gen
Definition: as_record.h:183
bool as_record_set(as_record *rec, const as_bin_name name, as_bin_value *value)
bool as_record_set_string(as_record *rec, const as_bin_name name, as_string *value)
bool as_record_set_raw(as_record *rec, const as_bin_name name, const uint8_t *value, uint32_t size)
Definition: as_record.h:401
Definition: as_val.h:56
as_map * as_record_get_map(const as_record *rec, const as_bin_name name)
uint32_t ttl
Definition: as_record.h:188
bool as_record_set_strp(as_record *rec, const as_bin_name name, const char *value, bool free)
bool as_record_set_integer(as_record *rec, const as_bin_name name, as_integer *value)
as_record * as_record_init(as_record *rec, uint16_t nbins)
int64_t as_record_get_int64(const as_record *rec, const as_bin_name name, int64_t fallback)
uint16_t as_record_numbins(const as_record *rec)
as_rec _
Definition: as_record.h:171
void as_record_destroy(as_record *rec)
char as_bin_name[AS_BIN_NAME_MAX_SIZE]
Definition: as_bin.h:53
bool as_record_set_str(as_record *rec, const as_bin_name name, const char *value)
Definition: as_record.h:355
as_integer * as_record_get_integer(const as_record *rec, const as_bin_name name)
bool as_record_set_rawp(as_record *rec, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
Definition: as_key.h:199
as_bytes * as_record_get_bytes(const as_record *rec, const as_bin_name name)
bool as_record_set_map(as_record *rec, const as_bin_name name, as_map *value)
bool as_record_set_nil(as_record *rec, const as_bin_name name)
as_key key
Definition: as_record.h:178