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