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-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 
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  * Set bin value to nil. This will instruct the server to remove the bin when the
267  * record is written using aerospike_key_put().
268  *
269  * @param rec The record to remove the bin from.
270  * @param name The name of the bin to remove.
271  *
272  * @return 0 on success, otherwise an error occurred.
273  *
274  * @relatesalso as_rec
275  */
276 static inline int as_rec_remove(const as_rec * rec, const char * name)
277 {
278  return as_util_hook(remove, 1, rec, name);
279 }
280 
281 /**
282  * Get the ttl for the record.
283  *
284  * @relatesalso as_rec
285  */
286 static inline uint32_t as_rec_ttl(const as_rec * rec)
287 {
288  return as_util_hook(ttl, 0, rec);
289 }
290 
291 /**
292  * Get the last update time for the record.
293  *
294  * @relatesalso as_rec
295  */
296 static inline uint64_t as_rec_last_update_time(const as_rec * rec)
297 {
298  return as_util_hook(last_update_time, 0, rec);
299 }
300 
301 /**
302  * Get the generation of the record
303  *
304  * @relatesalso as_rec
305  */
306 static inline uint16_t as_rec_gen(const as_rec * rec)
307 {
308  return as_util_hook(gen, 0, rec);
309 }
310 
311 /**
312  * Get the record's key.
313  *
314  * @relatesalso as_rec
315  */
316 static inline as_val * as_rec_key(const as_rec * rec)
317 {
318  return as_util_hook(key, 0, rec);
319 }
320 
321 /**
322  * Get the record's set name.
323  *
324  * @relatesalso as_rec
325  */
326 static inline const char * as_rec_setname(const as_rec * rec)
327 {
328  return as_util_hook(setname, 0, rec);
329 }
330 
331 /**
332  * Get the number of bins in the record.
333  *
334  * @relatesalso as_rec
335  */
336 static inline uint16_t as_rec_numbins(const as_rec * rec)
337 {
338  return as_util_hook(numbins, 0, rec);
339 }
340 
341 /**
342  * Get a list of the bin names in the record.
343  *
344  * @relatesalso as_rec
345  */
346 static inline int as_rec_bin_names(const as_rec * rec, as_rec_bin_names_callback callback, void * udata)
347 {
348  return as_util_hook(bin_names, 0, rec, callback, udata);
349 }
350 
351 /**
352  * Get the digest of the record.
353  *
354  * @relatesalso as_rec
355  */
356 static inline as_bytes * as_rec_digest(const as_rec * rec)
357 {
358  return as_util_hook(digest, 0, rec);
359 }
360 
361 /**
362  * Set flags on a bin.
363  *
364  * @relatesalso as_rec
365  */
366 static inline int as_rec_set_flags(const as_rec * rec, const char * name, uint8_t flags)
367 {
368  return as_util_hook(set_flags, 0, rec, name, flags);
369 }
370 
371 /**
372  * Set the record type.
373  *
374  * @relatesalso as_rec
375  */
376 static inline int as_rec_set_type(const as_rec * rec, int8_t rec_type)
377 {
378  return as_util_hook(set_type, 0, rec, rec_type);
379 }
380 
381 /**
382  * Set the time to live (ttl).
383  *
384  * @relatesalso as_rec
385  */
386 static inline int as_rec_set_ttl(const as_rec * rec, uint32_t ttl)
387 {
388  return as_util_hook(set_ttl, 0, rec, ttl);
389 }
390 
391 /**
392  * Drop the record's key.
393  *
394  * @relatesalso as_rec
395  */
396 static inline int as_rec_drop_key(const as_rec * rec)
397 {
398  return as_util_hook(drop_key, 0, rec);
399 }
400 
401 /******************************************************************************
402  * BIN GETTER FUNCTIONS
403  ******************************************************************************/
404 
405 /**
406  * Get a bin's value.
407  *
408  * @param rec The as_rec to read the bin value from.
409  * @param name The name of the bin.
410  *
411  * @return On success, the value of the bin. Otherwise NULL.
412  *
413  * @relatesalso as_rec
414  */
415 static inline as_val * as_rec_get(const as_rec * rec, const char * name)
416 {
417  return as_util_hook(get, NULL, rec, name);
418 }
419 
420 /**
421  * Get a bin's value as an int64_t.
422  *
423  * @param rec The as_rec to read the bin value from.
424  * @param name The name of the bin.
425  *
426  * @return On success, the value of the bin. Otherwise 0.
427  *
428  * @relatesalso as_rec
429  */
430 static inline int64_t as_rec_get_int64(const as_rec * rec, const char * name)
431 {
432  as_val * v = as_util_hook(get, NULL, rec, name);
434  return i ? as_integer_toint(i) : 0;
435 }
436 
437 /**
438  * Get a bin's value as a double.
439  *
440  * @param rec The as_rec to read the bin value from.
441  * @param name The name of the bin.
442  *
443  * @return On success, the value of the bin. Otherwise 0.
444  *
445  * @relatesalso as_rec
446  */
447 static inline double as_rec_get_double(const as_rec * rec, const char * name)
448 {
449  as_val * v = as_util_hook(get, NULL, rec, name);
450  as_double * ptr = as_double_fromval(v);
451  return ptr ? ptr->value : 0.0;
452 }
453 
454 /**
455  * Get a bin's value as a NULL terminated string.
456  *
457  * @param rec The as_rec to read the bin value from.
458  * @param name The name of the bin.
459  *
460  * @return On success, the value of the bin. Otherwise NULL.
461  *
462  * @relatesalso as_rec
463  */
464 static inline char * as_rec_get_str(const as_rec * rec, const char * name)
465 {
466  as_val * v = as_util_hook(get, NULL, rec, name);
467  as_string * s = as_string_fromval(v);
468  return s ? as_string_tostring(s) : 0;
469 }
470 
471 /**
472  * Get a bin's value as a NULL terminated GeoJSON string.
473  *
474  * @param rec The as_rec to read the bin value from.
475  * @param name The name of the bin.
476  *
477  * @return On success, the value of the bin. Otherwise NULL.
478  *
479  * @relatesalso as_rec
480  */
481 static inline char * as_rec_get_geojson_str(const as_rec * rec, const char * name)
482 {
483  as_val * v = as_util_hook(get, NULL, rec, name);
485  return as_geojson_get(s);
486 }
487 
488 /**
489  * Get a bin's value as an as_integer.
490  *
491  * @param rec The as_rec to read the bin value from.
492  * @param name The name of the bin.
493  *
494  * @return On success, the value of the bin. Otherwise NULL.
495  *
496  * @relatesalso as_rec
497  */
498 static inline as_integer * as_rec_get_integer(const as_rec * rec, const char * name)
499 {
500  as_val * v = as_util_hook(get, NULL, rec, name);
501  return as_integer_fromval(v);
502 }
503 
504 /**
505  * Get a bin's value as an as_double.
506  *
507  * @param rec The as_rec to read the bin value from.
508  * @param name The name of the bin.
509  *
510  * @return On success, the value of the bin. Otherwise NULL.
511  *
512  * @relatesalso as_rec
513  */
514 static inline as_double * as_rec_get_as_double(const as_rec * rec, const char * name)
515 {
516  as_val * v = as_util_hook(get, NULL, rec, name);
517  return as_double_fromval(v);
518 }
519 
520 /**
521  * Get a bin's value as an as_string.
522  *
523  * @param rec The as_rec to read the bin value from.
524  * @param name The name of the bin.
525  *
526  * @return On success, the value of the bin. Otherwise NULL.
527  *
528  * @relatesalso as_rec
529  */
530 static inline as_string * as_rec_get_string(const as_rec * rec, const char * name)
531 {
532  as_val * v = as_util_hook(get, NULL, rec, name);
533  return as_string_fromval(v);
534 }
535 
536 /**
537  * Get a bin's value as an as_geojson.
538  *
539  * @param rec The as_rec to read the bin value from.
540  * @param name The name of the bin.
541  *
542  * @return On success, the value of the bin. Otherwise NULL.
543  *
544  * @relatesalso as_rec
545  */
546 static inline as_geojson * as_rec_get_geojson(const as_rec * rec, const char * name)
547 {
548  as_val * v = as_util_hook(get, NULL, rec, name);
549  return as_geojson_fromval(v);
550 }
551 
552 /**
553  * Get a bin's value as an as_bytes.
554  *
555  * @param rec The as_rec to read the bin value from.
556  * @param name The name of the bin.
557  *
558  * @return On success, the value of the bin. Otherwise NULL.
559  *
560  * @relatesalso as_rec
561  */
562 static inline as_bytes * as_rec_get_bytes(const as_rec * rec, const char * name)
563 {
564  as_val * v = as_util_hook(get, NULL, rec, name);
565  return as_bytes_fromval(v);
566 }
567 
568 /**
569  * Get a bin's value as an as_list.
570  *
571  * @param rec The as_rec to read the bin value from.
572  * @param name The name of the bin.
573  *
574  * @return On success, the value of the bin. Otherwise NULL.
575  *
576  * @relatesalso as_rec
577  */
578 static inline as_list * as_rec_get_list(const as_rec * rec, const char * name)
579 {
580  as_val * v = as_util_hook(get, NULL, rec, name);
581  return as_list_fromval(v);
582 }
583 
584 /**
585  * Get a bin's value as an as_map.
586  *
587  * @param rec The as_rec to read the bin value from.
588  * @param name The name of the bin.
589  *
590  * @return On success, the value of the bin. Otherwise NULL.
591  *
592  * @relatesalso as_rec
593  */
594 static inline as_map * as_rec_get_map(const as_rec * rec, const char * name)
595 {
596  as_val * v = as_util_hook(get, NULL, rec, name);
597  return as_map_fromval(v);
598 }
599 
600 /******************************************************************************
601  * BIN SETTER FUNCTIONS
602  ******************************************************************************/
603 
604 /**
605  * Set the bin's value to an as_val.
606  *
607  * @param rec The as_rec to write the bin value to - CONSUMES REFERENCE
608  * @param name The name of the bin.
609  * @param value The value of the bin.
610  *
611  * @return On success, 0. Otherwise an error occurred.
612  *
613  * @relatesalso as_rec
614  */
615 static inline int as_rec_set(const as_rec * rec, const char * name, const as_val * value)
616 {
617  return as_util_hook(set, 1, rec, name, value);
618 }
619 
620 /**
621  * Set the bin's value to an int64_t.
622  *
623  * @param rec The as_rec storing the bin.
624  * @param name The name of the bin.
625  * @param value The value of the bin.
626  *
627  * @return On success, 0. Otherwise an error occurred.
628  *
629  * @relatesalso as_rec
630  */
631 static inline int as_rec_set_int64(const as_rec * rec, const char * name, int64_t value)
632 {
633  return as_util_hook(set, 1, rec, name, (as_val *) as_integer_new(value));
634 }
635 
636 /**
637  * Set the bin's value to a double.
638  *
639  * @param rec The as_rec storing the bin.
640  * @param name The name of the bin.
641  * @param value The value of the bin.
642  *
643  * @return On success, 0. Otherwise an error occurred.
644  *
645  * @relatesalso as_rec
646  */
647 static inline int as_rec_set_double(const as_rec * rec, const char * name, double value)
648 {
649  return as_util_hook(set, 1, rec, name, (as_val *) as_double_new(value));
650 }
651 
652 /**
653  * Set the bin's value to a NULL terminated string.
654  *
655  * @param rec The as_rec storing the bin.
656  * @param name The name of the bin.
657  * @param value The value of the bin.
658  *
659  * @return On success, 0. Otherwise an error occurred.
660  *
661  * @relatesalso as_rec
662  */
663 static inline int as_rec_set_str(const as_rec * rec, const char * name, const char * value)
664 {
665  return as_util_hook(set, 1, rec, name, (as_val *) as_string_new_strdup(value));
666 }
667 
668 /**
669  * Set the bin's value to an as_integer.
670  *
671  * @param rec The as_rec storing the bin.
672  * @param name The name of the bin.
673  * @param value The value of the bin.
674  *
675  * @return On success, 0. Otherwise an error occurred.
676  *
677  * @relatesalso as_rec
678  */
679 static inline int as_rec_set_integer(const as_rec * rec, const char * name, const as_integer * value)
680 {
681  return as_util_hook(set, 1, rec, name, (as_val *) value);
682 }
683 
684 /**
685  * Set the bin's value to an as_double.
686  *
687  * @param rec The as_rec storing the bin.
688  * @param name The name of the bin.
689  * @param value The value of the bin.
690  *
691  * @return On success, 0. Otherwise an error occurred.
692  *
693  * @relatesalso as_rec
694  */
695 static inline int as_rec_set_as_double(const as_rec * rec, const char * name, const as_double * value)
696 {
697  return as_util_hook(set, 1, rec, name, (as_val *) value);
698 }
699 
700 /**
701  * Set the bin's value to an as_string.
702  *
703  * @param rec The as_rec storing the bin.
704  * @param name The name of the bin.
705  * @param value The value of the bin.
706  *
707  * @return On success, 0. Otherwise an error occurred.
708  *
709  * @relatesalso as_rec
710  */
711 static inline int as_rec_set_string(const as_rec * rec, const char * name, const as_string * value)
712 {
713  return as_util_hook(set, 1, rec, name, (as_val *) value);
714 }
715 
716 /**
717  * Set the bin's value to an as_geojson.
718  *
719  * @param rec The as_rec storing the bin.
720  * @param name The name of the bin.
721  * @param value The value of the bin.
722  *
723  * @return On success, 0. Otherwise an error occurred.
724  *
725  * @relatesalso as_rec
726  */
727 static inline int as_rec_set_geojson(const as_rec * rec, const char * name, const as_geojson * value)
728 {
729  return as_util_hook(set, 1, rec, name, (as_val *) value);
730 }
731 
732 /**
733  * Set the bin's value to an as_bytes.
734  *
735  * @param rec The as_rec storing the bin.
736  * @param name The name of the bin.
737  * @param value The value of the bin.
738  *
739  * @return On success, 0. Otherwise an error occurred.
740  *
741  * @relatesalso as_rec
742  */
743 static inline int as_rec_set_bytes(const as_rec * rec, const char * name, const as_bytes * value)
744 {
745  return as_util_hook(set, 1, rec, name, (as_val *) value);
746 }
747 
748 /**
749  * Set the bin's value to an as_list.
750  *
751  * @param rec The as_rec storing the bin.
752  * @param name The name of the bin.
753  * @param value The value of the bin.
754  *
755  * @return On success, 0. Otherwise an error occurred.
756  *
757  * @relatesalso as_rec
758  */
759 static inline int as_rec_set_list(const as_rec * rec, const char * name, const as_list * value)
760 {
761  return as_util_hook(set, 1, rec, name, (as_val *) value);
762 }
763 
764 /**
765  * Set the bin's value to an as_map.
766  *
767  * @param rec The as_rec storing the bin.
768  * @param name The name of the bin.
769  * @param value The value of the bin.
770  *
771  * @return On success, 0. Otherwise an error occurred.
772  *
773  * @relatesalso as_rec
774  */
775 static inline int as_rec_set_map(const as_rec * rec, const char * name, const as_map * value)
776 {
777  return as_util_hook(set, 1, rec, name, (as_val *) value);
778 }
779 
780 /******************************************************************************
781  * ITERATION FUNCTIONS
782  ******************************************************************************/
783 
784 /**
785  * Call the callback function for each bin in the record.
786  *
787  * @param rec The as_rec containing the bins to iterate over.
788  * @param callback The function to call for each entry.
789  * @param udata User-data to be passed to the callback.
790  *
791  * @return true if iteration completes fully. false if iteration was aborted.
792  *
793  * @relatesalso as_rec
794  */
795 static inline bool as_rec_foreach(const as_rec * rec, as_rec_foreach_callback callback, void * udata)
796 {
797  return as_util_hook(foreach, false, rec, callback, udata);
798 }
799 
800 /******************************************************************************
801  * CONVERSION FUNCTIONS
802  ******************************************************************************/
803 
804 /**
805  * Convert to an as_val.
806  *
807  * @relatesalso as_rec
808  */
809 static inline as_val * as_rec_toval(const as_rec * rec)
810 {
811  return (as_val *) rec;
812 }
813 
814 /**
815  * Convert from an as_val.
816  *
817  * @relatesalso as_rec
818  */
819 static inline as_rec * as_rec_fromval(const as_val * v)
820 {
821  return as_util_fromval(v, AS_REC, as_rec);
822 }
823 
824 /******************************************************************************
825  * as_val FUNCTIONS
826  ******************************************************************************/
827 
828 /**
829  * @private
830  * Internal helper function for destroying an as_val.
831  */
832 void as_rec_val_destroy(as_val *);
833 
834 /**
835  * @private
836  * Internal helper function for getting the hashcode of an as_val.
837  */
838 uint32_t as_rec_val_hashcode(const as_val *v);
839 
840 /**
841  * @private
842  * Internal helper function for getting the string representation of an as_val.
843  */
844 char * as_rec_val_tostring(const as_val *v);
845 
846 #ifdef __cplusplus
847 } // end extern "C"
848 #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:447
static uint32_t as_rec_ttl(const as_rec *rec)
Definition: as_rec.h:286
AS_REC
Definition: as_val.h:213
uint8_t type
Definition: as_proto.h:49
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:316
static as_map * as_rec_get_map(const as_rec *rec, const char *name)
Definition: as_rec.h:594
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:647
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:578
static int as_rec_set_as_double(const as_rec *rec, const char *name, const as_double *value)
Definition: as_rec.h:695
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:615
static as_bytes * as_rec_get_bytes(const as_rec *rec, const char *name)
Definition: as_rec.h:562
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:795
static int as_rec_drop_key(const as_rec *rec)
Definition: as_rec.h:396
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:430
#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:415
static char * as_rec_get_str(const as_rec *rec, const char *name)
Definition: as_rec.h:464
static int as_rec_remove(const as_rec *rec, const char *name)
Definition: as_rec.h:276
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:336
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:530
static const char * as_rec_setname(const as_rec *rec)
Definition: as_rec.h:326
static as_rec * as_rec_fromval(const as_val *v)
Definition: as_rec.h:819
static int as_rec_set_list(const as_rec *rec, const char *name, const as_list *value)
Definition: as_rec.h:759
static as_double * as_rec_get_as_double(const as_rec *rec, const char *name)
Definition: as_rec.h:514
static int as_rec_set_int64(const as_rec *rec, const char *name, int64_t value)
Definition: as_rec.h:631
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:546
static int as_rec_bin_names(const as_rec *rec, as_rec_bin_names_callback callback, void *udata)
Definition: as_rec.h:346
static int as_rec_set_bytes(const as_rec *rec, const char *name, const as_bytes *value)
Definition: as_rec.h:743
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:1461
static int as_rec_set_flags(const as_rec *rec, const char *name, uint8_t flags)
Definition: as_rec.h:366
uint8_t data[]
Definition: as_proto.h:51
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:386
static as_bytes * as_rec_digest(const as_rec *rec)
Definition: as_rec.h:356
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:376
#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:663
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:727
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:711
static uint16_t as_rec_gen(const as_rec *rec)
Definition: as_rec.h:306
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:679
static uint64_t as_rec_last_update_time(const as_rec *rec)
Definition: as_rec.h:296
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:775
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:498
static as_val * as_rec_toval(const as_rec *rec)
Definition: as_rec.h:809
static char * as_rec_get_geojson_str(const as_rec *rec, const char *name)
Definition: as_rec.h:481