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