Loading...
Searching...
No Matches
as_rec.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2018 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
18#pragma once
19
21#include <aerospike/as_bytes.h>
23#include <aerospike/as_list.h>
24#include <aerospike/as_map.h>
25#include <aerospike/as_std.h>
26#include <aerospike/as_string.h>
27#include <aerospike/as_util.h>
28#include <aerospike/as_val.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/******************************************************************************
35 * TYPES
36 *****************************************************************************/
37
38struct as_rec_hooks_s;
39
40/**
41 * Callback function for `as_rec_bin_names()`. Used for porting bin names
42 * to Lua.
43 *
44 * @param bin_names A string containing the (null-terminated) bin names.
45 * @param nbins The number of bins in the record.
46 * @param max_name_size The maximum length of a bin name.
47 * @param udata User-provided data.
48 */
49typedef void (* as_rec_bin_names_callback) (char * bin_names, uint32_t nbins, uint16_t max_name_size, void * udata);
50
51/**
52 * Callback function for `as_rec_foreach()`. Called for each bin in the
53 * record.
54 *
55 * @param name The name of the current bin.
56 * @param value The value of the current bin.
57 * @param udata The user-data provided to the `as_rec_foreach()`.
58 *
59 * @return true to continue iterating through the list.
60 * false to stop iterating.
61 */
62typedef bool (* as_rec_foreach_callback) (const char * name, const as_val * value, void * udata);
63
64/**
65 * as_rec is an interface for record types. A record is how data in Aerospike
66 * is represented, and is composed of bins and metadata.
67 *
68 * Implementations:
69 * - as_record
70 *
71 * @extends as_val
72 * @ingroup aerospike_t
73 */
74typedef struct as_rec_s {
75
76 /**
77 * @private
78 * as_rec is a subtype of as_val.
79 * You can cast as_rec to as_val.
80 */
81 as_val _;
82
83 /**
84 * Data provided by the implementation of `as_rec`.
85 */
86 void * data;
87
88 /**
89 * Hooks provided by the implementation of `as_rec`.
90 */
91 const struct as_rec_hooks_s * hooks;
92
93} as_rec;
94
95/**
96 * Record Hooks.
97 *
98 * An implementation of `as_rec` should provide implementations for each
99 * of the hooks.
100 */
101typedef struct as_rec_hooks_s {
102
103 /**
104 * Destroy the record.
105 */
106 bool (* destroy)(as_rec * rec);
107
108 /**
109 * Get the hashcode of the record.
110 */
111 uint32_t (* hashcode)(const as_rec * rec);
112
113 /**
114 * Get the value of the bin in the record.
115 */
116 as_val * (* get)(const as_rec * rec, const char * name);
117
118 /**
119 * Set the value of the bin in the record.
120 */
121 int (* set)(const as_rec * rec, const char * name, const as_val * value);
122
123 /**
124 * Remove the bin from the record.
125 */
126 int (* remove)(const as_rec * rec, const char * bin);
127
128 /**
129 * Get the ttl value of the record.
130 */
131 uint32_t (* ttl)(const as_rec * rec);
132
133 /**
134 * Get the last update time of the record.
135 */
136 uint64_t (* last_update_time)(const as_rec * rec);
137
138 /**
139 * Get the generation value of the record.
140 */
141 uint16_t (* gen)(const as_rec * rec);
142
143 /**
144 * Get the stored size (bytes) of the record.
145 */
146 uint32_t (* size)(const as_rec * rec);
147
148 /**
149 * Get the memory storage size of the record. Deprecated!
150 */
151 uint32_t (* memory_size)(const as_rec * rec);
152
153 /**
154 * Get the device storage size of the record. Deprecated!
155 */
156 uint32_t (* device_size)(const as_rec * rec);
157
158 /**
159 * Get the record's key.
160 */
161 as_val * (* key)(const as_rec * rec);
162
163 /**
164 * Get the record's set name.
165 */
166 const char * (* setname)(const as_rec * rec);
167
168 /**
169 * Get the number of bins of the record.
170 */
171 uint16_t (* numbins)(const as_rec * rec);
172
173 /**
174 * Get a list of the record's bin names.
175 */
176 int (* bin_names)(const as_rec * rec, as_rec_bin_names_callback callback, void * udata);
177
178 /**
179 * Get the digest of the record.
180 */
181 as_bytes * (* digest)(const as_rec * rec);
182
183 /**
184 * Set the time to live (ttl) of the record.
185 */
186 int (* set_ttl)(const as_rec * rec, uint32_t ttl);
187
188 /**
189 * Discard the record's key.
190 */
191 int (* drop_key)(const as_rec * rec);
192
193 /**
194 * Iterate over each bin in the record.
195 */
196 bool (* foreach)(const as_rec * rec, as_rec_foreach_callback callback, void * udata);
197
199
200/******************************************************************************
201 * INSTANCE FUNCTIONS
202 *****************************************************************************/
203
204/**
205 * @private
206 * Utilized by subtypes of as_rec to initialize the parent.
207 *
208 * @param rec The record to initialize
209 * @param free If TRUE, then as_rec_destory() will free the record.
210 * @param data Data for the map.
211 * @param hooks Implementation for the map interface.
212 *
213 * @return The initialized as_map on success. Otherwise NULL.
214 *
215 * @relatesalso as_rec
216 */
217AS_EXTERN as_rec * as_rec_cons(as_rec * rec, bool free, void * data, const as_rec_hooks * hooks);
218
219/**
220 * Initialize a stack allocated record.
221 *
222 * @param rec Stack allocated record to initialize.
223 * @param data Data for the record.
224 * @param hooks Implementation for the record interface.
225 *
226 * @return On success, the initialized record. Otherwise NULL.
227 *
228 * @relatesalso as_rec
229 */
230AS_EXTERN as_rec * as_rec_init(as_rec * rec, void * data, const as_rec_hooks * hooks);
231
232/**
233 * Create and initialize a new heap allocated record.
234 *
235 * @param data Data for the record.
236 * @param hooks Implementation for the record interface.
237 *
238 * @return On success, a new record. Otherwise NULL.
239 *
240 * @relatesalso as_rec
241 */
242AS_EXTERN as_rec * as_rec_new(void * data, const as_rec_hooks * hooks);
243
244/**
245 * Destroy the record.
246 *
247 * @relatesalso as_rec
248 */
249static inline void as_rec_destroy(as_rec * rec)
250{
251 as_val_destroy((as_val *) rec);
252}
253
254/******************************************************************************
255 * INLINE FUNCTIONS
256 ******************************************************************************/
257
258/**
259 * Get the data source for the record.
260 *
261 * @relatesalso as_rec
262 */
263static inline void * as_rec_source(const as_rec * rec)
264{
265 return rec ? rec->data : NULL;
266}
267
268/**
269 * Set bin value to nil. This will instruct the server to remove the bin when the
270 * record is written using aerospike_key_put().
271 *
272 * @param rec The record to remove the bin from.
273 * @param name The name of the bin to remove.
274 *
275 * @return 0 on success, otherwise an error occurred.
276 *
277 * @relatesalso as_rec
278 */
279static inline int as_rec_remove(const as_rec * rec, const char * name)
280{
281 return as_util_hook(remove, 1, rec, name);
282}
283
284/**
285 * Get the ttl for the record.
286 *
287 * @relatesalso as_rec
288 */
289static inline uint32_t as_rec_ttl(const as_rec * rec)
290{
291 return as_util_hook(ttl, 0, rec);
292}
293
294/**
295 * Get the last update time for the record.
296 *
297 * @relatesalso as_rec
298 */
299static inline uint64_t as_rec_last_update_time(const as_rec * rec)
300{
301 return as_util_hook(last_update_time, 0, rec);
302}
303
304/**
305 * Get the generation of the record
306 *
307 * @relatesalso as_rec
308 */
309static inline uint16_t as_rec_gen(const as_rec * rec)
310{
311 return as_util_hook(gen, 0, rec);
312}
313
314/**
315 * Get the stored size (bytes) of the record
316 *
317 * @relatesalso as_rec
318 */
319static inline uint32_t as_rec_size(const as_rec * rec)
320{
321 return as_util_hook(size, 0, rec);
322}
323
324/**
325 * Get the memory storage size of the record - deprecated!
326 *
327 * @relatesalso as_rec
328 */
329static inline uint32_t as_rec_memory_size(const as_rec * rec)
330{
331 return as_util_hook(memory_size, 0, rec);
332}
333
334/**
335 * Get the device storage size of the record - deprecated!
336 *
337 * @relatesalso as_rec
338 */
339static inline uint32_t as_rec_device_size(const as_rec * rec)
340{
341 return as_util_hook(device_size, 0, rec);
342}
343
344/**
345 * Get the record's key.
346 *
347 * @relatesalso as_rec
348 */
349static inline as_val * as_rec_key(const as_rec * rec)
350{
351 return as_util_hook(key, 0, rec);
352}
353
354/**
355 * Get the record's set name.
356 *
357 * @relatesalso as_rec
358 */
359static inline const char * as_rec_setname(const as_rec * rec)
360{
361 return as_util_hook(setname, 0, rec);
362}
363
364/**
365 * Get the number of bins in the record.
366 *
367 * @relatesalso as_rec
368 */
369static inline uint16_t as_rec_numbins(const as_rec * rec)
370{
371 return as_util_hook(numbins, 0, rec);
372}
373
374/**
375 * Get a list of the bin names in the record.
376 *
377 * @relatesalso as_rec
378 */
379static inline int as_rec_bin_names(const as_rec * rec, as_rec_bin_names_callback callback, void * udata)
380{
381 return as_util_hook(bin_names, 0, rec, callback, udata);
382}
383
384/**
385 * Get the digest of the record.
386 *
387 * @relatesalso as_rec
388 */
389static inline as_bytes * as_rec_digest(const as_rec * rec)
390{
391 return as_util_hook(digest, 0, rec);
392}
393
394/**
395 * Set the time to live (ttl).
396 *
397 * @relatesalso as_rec
398 */
399static inline int as_rec_set_ttl(const as_rec * rec, uint32_t ttl)
400{
401 return as_util_hook(set_ttl, 0, rec, ttl);
402}
403
404/**
405 * Drop the record's key.
406 *
407 * @relatesalso as_rec
408 */
409static inline int as_rec_drop_key(const as_rec * rec)
410{
411 return as_util_hook(drop_key, 0, rec);
412}
413
414/******************************************************************************
415 * BIN GETTER FUNCTIONS
416 ******************************************************************************/
417
418/**
419 * Get a bin's value.
420 *
421 * @param rec The as_rec to read the bin value from.
422 * @param name The name of the bin.
423 *
424 * @return On success, the value of the bin. Otherwise NULL.
425 *
426 * @relatesalso as_rec
427 */
428static inline as_val * as_rec_get(const as_rec * rec, const char * name)
429{
430 return as_util_hook(get, NULL, rec, name);
431}
432
433/**
434 * Get a bin's value as an int64_t.
435 *
436 * @param rec The as_rec to read the bin value from.
437 * @param name The name of the bin.
438 *
439 * @return On success, the value of the bin. Otherwise 0.
440 *
441 * @relatesalso as_rec
442 */
443static inline int64_t as_rec_get_int64(const as_rec * rec, const char * name)
444{
445 as_val * v = as_util_hook(get, NULL, rec, name);
447 return i ? as_integer_toint(i) : 0;
448}
449
450/**
451 * Get a bin's value as a double.
452 *
453 * @param rec The as_rec to read the bin value from.
454 * @param name The name of the bin.
455 *
456 * @return On success, the value of the bin. Otherwise 0.
457 *
458 * @relatesalso as_rec
459 */
460static inline double as_rec_get_double(const as_rec * rec, const char * name)
461{
462 as_val * v = as_util_hook(get, NULL, rec, name);
463 as_double * ptr = as_double_fromval(v);
464 return ptr ? ptr->value : 0.0;
465}
466
467/**
468 * Get a bin's value as a NULL terminated string.
469 *
470 * @param rec The as_rec to read the bin value from.
471 * @param name The name of the bin.
472 *
473 * @return On success, the value of the bin. Otherwise NULL.
474 *
475 * @relatesalso as_rec
476 */
477static inline char * as_rec_get_str(const as_rec * rec, const char * name)
478{
479 as_val * v = as_util_hook(get, NULL, rec, name);
481 return s ? as_string_tostring(s) : 0;
482}
483
484/**
485 * Get a bin's value as a NULL terminated GeoJSON string.
486 *
487 * @param rec The as_rec to read the bin value from.
488 * @param name The name of the bin.
489 *
490 * @return On success, the value of the bin. Otherwise NULL.
491 *
492 * @relatesalso as_rec
493 */
494static inline char * as_rec_get_geojson_str(const as_rec * rec, const char * name)
495{
496 as_val * v = as_util_hook(get, NULL, rec, name);
498 return as_geojson_get(s);
499}
500
501/**
502 * Get a bin's value as an as_integer.
503 *
504 * @param rec The as_rec to read the bin value from.
505 * @param name The name of the bin.
506 *
507 * @return On success, the value of the bin. Otherwise NULL.
508 *
509 * @relatesalso as_rec
510 */
511static inline as_integer * as_rec_get_integer(const as_rec * rec, const char * name)
512{
513 as_val * v = as_util_hook(get, NULL, rec, name);
514 return as_integer_fromval(v);
515}
516
517/**
518 * Get a bin's value as an as_double.
519 *
520 * @param rec The as_rec to read the bin value from.
521 * @param name The name of the bin.
522 *
523 * @return On success, the value of the bin. Otherwise NULL.
524 *
525 * @relatesalso as_rec
526 */
527static inline as_double * as_rec_get_as_double(const as_rec * rec, const char * name)
528{
529 as_val * v = as_util_hook(get, NULL, rec, name);
530 return as_double_fromval(v);
531}
532
533/**
534 * Get a bin's value as an as_string.
535 *
536 * @param rec The as_rec to read the bin value from.
537 * @param name The name of the bin.
538 *
539 * @return On success, the value of the bin. Otherwise NULL.
540 *
541 * @relatesalso as_rec
542 */
543static inline as_string * as_rec_get_string(const as_rec * rec, const char * name)
544{
545 as_val * v = as_util_hook(get, NULL, rec, name);
546 return as_string_fromval(v);
547}
548
549/**
550 * Get a bin's value as an as_geojson.
551 *
552 * @param rec The as_rec to read the bin value from.
553 * @param name The name of the bin.
554 *
555 * @return On success, the value of the bin. Otherwise NULL.
556 *
557 * @relatesalso as_rec
558 */
559static inline as_geojson * as_rec_get_geojson(const as_rec * rec, const char * name)
560{
561 as_val * v = as_util_hook(get, NULL, rec, name);
562 return as_geojson_fromval(v);
563}
564
565/**
566 * Get a bin's value as an as_bytes.
567 *
568 * @param rec The as_rec to read the bin value from.
569 * @param name The name of the bin.
570 *
571 * @return On success, the value of the bin. Otherwise NULL.
572 *
573 * @relatesalso as_rec
574 */
575static inline as_bytes * as_rec_get_bytes(const as_rec * rec, const char * name)
576{
577 as_val * v = as_util_hook(get, NULL, rec, name);
578 return as_bytes_fromval(v);
579}
580
581/**
582 * Get a bin's value as an as_list.
583 *
584 * @param rec The as_rec to read the bin value from.
585 * @param name The name of the bin.
586 *
587 * @return On success, the value of the bin. Otherwise NULL.
588 *
589 * @relatesalso as_rec
590 */
591static inline as_list * as_rec_get_list(const as_rec * rec, const char * name)
592{
593 as_val * v = as_util_hook(get, NULL, rec, name);
594 return as_list_fromval(v);
595}
596
597/**
598 * Get a bin's value as an as_map.
599 *
600 * @param rec The as_rec to read the bin value from.
601 * @param name The name of the bin.
602 *
603 * @return On success, the value of the bin. Otherwise NULL.
604 *
605 * @relatesalso as_rec
606 */
607static inline as_map * as_rec_get_map(const as_rec * rec, const char * name)
608{
609 as_val * v = as_util_hook(get, NULL, rec, name);
610 return as_map_fromval(v);
611}
612
613/******************************************************************************
614 * BIN SETTER FUNCTIONS
615 ******************************************************************************/
616
617/**
618 * Set the bin's value to an as_val.
619 *
620 * @param rec The as_rec to write the bin value to - CONSUMES REFERENCE
621 * @param name The name of the bin.
622 * @param value The value of the bin.
623 *
624 * @return On success, 0. Otherwise an error occurred.
625 *
626 * @relatesalso as_rec
627 */
628static inline int as_rec_set(const as_rec * rec, const char * name, const as_val * value)
629{
630 return as_util_hook(set, 1, rec, name, value);
631}
632
633/**
634 * Set the bin's value to an int64_t.
635 *
636 * @param rec The as_rec storing the bin.
637 * @param name The name of the bin.
638 * @param value The value of the bin.
639 *
640 * @return On success, 0. Otherwise an error occurred.
641 *
642 * @relatesalso as_rec
643 */
644static inline int as_rec_set_int64(const as_rec * rec, const char * name, int64_t value)
645{
646 return as_util_hook(set, 1, rec, name, (as_val *) as_integer_new(value));
647}
648
649/**
650 * Set the bin's value to a double.
651 *
652 * @param rec The as_rec storing the bin.
653 * @param name The name of the bin.
654 * @param value The value of the bin.
655 *
656 * @return On success, 0. Otherwise an error occurred.
657 *
658 * @relatesalso as_rec
659 */
660static inline int as_rec_set_double(const as_rec * rec, const char * name, double value)
661{
662 return as_util_hook(set, 1, rec, name, (as_val *) as_double_new(value));
663}
664
665/**
666 * Set the bin's value to a NULL terminated string.
667 *
668 * @param rec The as_rec storing the bin.
669 * @param name The name of the bin.
670 * @param value The value of the bin.
671 *
672 * @return On success, 0. Otherwise an error occurred.
673 *
674 * @relatesalso as_rec
675 */
676static inline int as_rec_set_str(const as_rec * rec, const char * name, const char * value)
677{
678 return as_util_hook(set, 1, rec, name, (as_val *) as_string_new_strdup(value));
679}
680
681/**
682 * Set the bin's value to an as_integer.
683 *
684 * @param rec The as_rec storing the bin.
685 * @param name The name of the bin.
686 * @param value The value of the bin.
687 *
688 * @return On success, 0. Otherwise an error occurred.
689 *
690 * @relatesalso as_rec
691 */
692static inline int as_rec_set_integer(const as_rec * rec, const char * name, const as_integer * value)
693{
694 return as_util_hook(set, 1, rec, name, (as_val *) value);
695}
696
697/**
698 * Set the bin's value to an as_double.
699 *
700 * @param rec The as_rec storing the bin.
701 * @param name The name of the bin.
702 * @param value The value of the bin.
703 *
704 * @return On success, 0. Otherwise an error occurred.
705 *
706 * @relatesalso as_rec
707 */
708static inline int as_rec_set_as_double(const as_rec * rec, const char * name, const as_double * value)
709{
710 return as_util_hook(set, 1, rec, name, (as_val *) value);
711}
712
713/**
714 * Set the bin's value to an as_string.
715 *
716 * @param rec The as_rec storing the bin.
717 * @param name The name of the bin.
718 * @param value The value of the bin.
719 *
720 * @return On success, 0. Otherwise an error occurred.
721 *
722 * @relatesalso as_rec
723 */
724static inline int as_rec_set_string(const as_rec * rec, const char * name, const as_string * value)
725{
726 return as_util_hook(set, 1, rec, name, (as_val *) value);
727}
728
729/**
730 * Set the bin's value to an as_geojson.
731 *
732 * @param rec The as_rec storing the bin.
733 * @param name The name of the bin.
734 * @param value The value of the bin.
735 *
736 * @return On success, 0. Otherwise an error occurred.
737 *
738 * @relatesalso as_rec
739 */
740static inline int as_rec_set_geojson(const as_rec * rec, const char * name, const as_geojson * value)
741{
742 return as_util_hook(set, 1, rec, name, (as_val *) value);
743}
744
745/**
746 * Set the bin's value to an as_bytes.
747 *
748 * @param rec The as_rec storing the bin.
749 * @param name The name of the bin.
750 * @param value The value of the bin.
751 *
752 * @return On success, 0. Otherwise an error occurred.
753 *
754 * @relatesalso as_rec
755 */
756static inline int as_rec_set_bytes(const as_rec * rec, const char * name, const as_bytes * value)
757{
758 return as_util_hook(set, 1, rec, name, (as_val *) value);
759}
760
761/**
762 * Set the bin's value to an as_list.
763 *
764 * @param rec The as_rec storing the bin.
765 * @param name The name of the bin.
766 * @param value The value of the bin.
767 *
768 * @return On success, 0. Otherwise an error occurred.
769 *
770 * @relatesalso as_rec
771 */
772static inline int as_rec_set_list(const as_rec * rec, const char * name, const as_list * value)
773{
774 return as_util_hook(set, 1, rec, name, (as_val *) value);
775}
776
777/**
778 * Set the bin's value to an as_map.
779 *
780 * @param rec The as_rec storing the bin.
781 * @param name The name of the bin.
782 * @param value The value of the bin.
783 *
784 * @return On success, 0. Otherwise an error occurred.
785 *
786 * @relatesalso as_rec
787 */
788static inline int as_rec_set_map(const as_rec * rec, const char * name, const as_map * value)
789{
790 return as_util_hook(set, 1, rec, name, (as_val *) value);
791}
792
793/******************************************************************************
794 * ITERATION FUNCTIONS
795 ******************************************************************************/
796
797/**
798 * Call the callback function for each bin in the record.
799 *
800 * @param rec The as_rec containing the bins to iterate over.
801 * @param callback The function to call for each entry.
802 * @param udata User-data to be passed to the callback.
803 *
804 * @return true if iteration completes fully. false if iteration was aborted.
805 *
806 * @relatesalso as_rec
807 */
808static inline bool as_rec_foreach(const as_rec * rec, as_rec_foreach_callback callback, void * udata)
809{
810 return as_util_hook(foreach, false, rec, callback, udata);
811}
812
813/******************************************************************************
814 * CONVERSION FUNCTIONS
815 ******************************************************************************/
816
817/**
818 * Convert to an as_val.
819 *
820 * @relatesalso as_rec
821 */
822static inline as_val * as_rec_toval(const as_rec * rec)
823{
824 return (as_val *) rec;
825}
826
827/**
828 * Convert from an as_val.
829 *
830 * @relatesalso as_rec
831 */
832static inline as_rec * as_rec_fromval(const as_val * v)
833{
834 return as_util_fromval(v, AS_REC, as_rec);
835}
836
837/******************************************************************************
838 * as_val FUNCTIONS
839 ******************************************************************************/
840
841/**
842 * @private
843 * Internal helper function for destroying an as_val.
844 */
846
847/**
848 * @private
849 * Internal helper function for getting the hashcode of an as_val.
850 */
852
853/**
854 * @private
855 * Internal helper function for getting the string representation of an as_val.
856 */
858
859#ifdef __cplusplus
860} // end extern "C"
861#endif
static as_bytes * as_bytes_fromval(const as_val *v)
Definition as_bytes.h:977
AS_EXTERN as_double * as_double_new(double value)
static as_double * as_double_fromval(const as_val *value)
Definition as_double.h:225
static as_geojson * as_geojson_fromval(const as_val *v)
Definition as_geojson.h:268
static char * as_geojson_get(const as_geojson *string)
Definition as_geojson.h:244
static as_integer * as_integer_fromval(const as_val *v)
Definition as_integer.h:226
AS_EXTERN as_integer * as_integer_new(int64_t value)
static int64_t as_integer_toint(const as_integer *integer)
Definition as_integer.h:204
static as_list * as_list_fromval(as_val *v)
Definition as_list.h:1464
static as_map * as_map_fromval(const as_val *val)
Definition as_map.h:424
uint8_t data[0]
Definition as_proto.h:3
bool(* as_rec_foreach_callback)(const char *name, const as_val *value, void *udata)
Definition as_rec.h:62
AS_EXTERN void as_rec_val_destroy(as_val *)
AS_EXTERN uint32_t as_rec_val_hashcode(const as_val *v)
AS_EXTERN char * as_rec_val_tostring(const as_val *v)
void(* as_rec_bin_names_callback)(char *bin_names, uint32_t nbins, uint16_t max_name_size, void *udata)
Definition as_rec.h:49
#define AS_EXTERN
Definition as_std.h:25
static char * as_string_tostring(const as_string *string)
Definition as_string.h:255
static as_string * as_string_fromval(const as_val *v)
Definition as_string.h:291
AS_EXTERN as_string * as_string_new_strdup(const char *value)
#define as_util_hook(hook, default, object,...)
Definition as_util.h:34
#define as_util_fromval(object, type_id, type)
Definition as_util.h:43
@ AS_REC
Definition as_val.h:43
#define as_val_destroy(__v)
Definition as_val.h:114
double value
Definition as_double.h:110
AS_EXTERN as_rec * as_rec_init(as_rec *rec, void *data, const as_rec_hooks *hooks)
static as_val * as_rec_toval(const as_rec *rec)
Definition as_rec.h:822
static int as_rec_bin_names(const as_rec *rec, as_rec_bin_names_callback callback, void *udata)
Definition as_rec.h:379
static as_val * as_rec_key(const as_rec *rec)
Definition as_rec.h:349
static char * as_rec_get_geojson_str(const as_rec *rec, const char *name)
Definition as_rec.h:494
static as_integer * as_rec_get_integer(const as_rec *rec, const char *name)
Definition as_rec.h:511
void * data
Definition as_rec.h:86
static int as_rec_set_str(const as_rec *rec, const char *name, const char *value)
Definition as_rec.h:676
static int as_rec_set_geojson(const as_rec *rec, const char *name, const as_geojson *value)
Definition as_rec.h:740
static uint64_t as_rec_last_update_time(const as_rec *rec)
Definition as_rec.h:299
static char * as_rec_get_str(const as_rec *rec, const char *name)
Definition as_rec.h:477
static void * as_rec_source(const as_rec *rec)
Definition as_rec.h:263
static as_map * as_rec_get_map(const as_rec *rec, const char *name)
Definition as_rec.h:607
static double as_rec_get_double(const as_rec *rec, const char *name)
Definition as_rec.h:460
static as_bytes * as_rec_get_bytes(const as_rec *rec, const char *name)
Definition as_rec.h:575
static int as_rec_set_string(const as_rec *rec, const char *name, const as_string *value)
Definition as_rec.h:724
static int as_rec_set_ttl(const as_rec *rec, uint32_t ttl)
Definition as_rec.h:399
static uint32_t as_rec_size(const as_rec *rec)
Definition as_rec.h:319
static as_val * as_rec_get(const as_rec *rec, const char *name)
Definition as_rec.h:428
const struct as_rec_hooks_s * hooks
Definition as_rec.h:91
static uint16_t as_rec_gen(const as_rec *rec)
Definition as_rec.h:309
static int as_rec_set_list(const as_rec *rec, const char *name, const as_list *value)
Definition as_rec.h:772
static int as_rec_set_bytes(const as_rec *rec, const char *name, const as_bytes *value)
Definition as_rec.h:756
static as_bytes * as_rec_digest(const as_rec *rec)
Definition as_rec.h:389
static void as_rec_destroy(as_rec *rec)
Definition as_rec.h:249
static uint32_t as_rec_device_size(const as_rec *rec)
Definition as_rec.h:339
static int as_rec_set_as_double(const as_rec *rec, const char *name, const as_double *value)
Definition as_rec.h:708
static as_string * as_rec_get_string(const as_rec *rec, const char *name)
Definition as_rec.h:543
AS_EXTERN as_rec * as_rec_cons(as_rec *rec, bool free, void *data, const as_rec_hooks *hooks)
static uint32_t as_rec_memory_size(const as_rec *rec)
Definition as_rec.h:329
static int64_t as_rec_get_int64(const as_rec *rec, const char *name)
Definition as_rec.h:443
static int as_rec_drop_key(const as_rec *rec)
Definition as_rec.h:409
static as_geojson * as_rec_get_geojson(const as_rec *rec, const char *name)
Definition as_rec.h:559
static int as_rec_set(const as_rec *rec, const char *name, const as_val *value)
Definition as_rec.h:628
static const char * as_rec_setname(const as_rec *rec)
Definition as_rec.h:359
static int as_rec_set_integer(const as_rec *rec, const char *name, const as_integer *value)
Definition as_rec.h:692
static as_rec * as_rec_fromval(const as_val *v)
Definition as_rec.h:832
static int as_rec_set_int64(const as_rec *rec, const char *name, int64_t value)
Definition as_rec.h:644
static int as_rec_remove(const as_rec *rec, const char *name)
Definition as_rec.h:279
static uint16_t as_rec_numbins(const as_rec *rec)
Definition as_rec.h:369
static as_double * as_rec_get_as_double(const as_rec *rec, const char *name)
Definition as_rec.h:527
static int as_rec_set_double(const as_rec *rec, const char *name, double value)
Definition as_rec.h:660
AS_EXTERN as_rec * as_rec_new(void *data, const as_rec_hooks *hooks)
static int as_rec_set_map(const as_rec *rec, const char *name, const as_map *value)
Definition as_rec.h:788
static as_list * as_rec_get_list(const as_rec *rec, const char *name)
Definition as_rec.h:591
static bool as_rec_foreach(const as_rec *rec, as_rec_foreach_callback callback, void *udata)
Definition as_rec.h:808
static uint32_t as_rec_ttl(const as_rec *rec)
Definition as_rec.h:289