All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
target/Linux-x86_64/include/aerospike/as_ldt.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  *****************************************************************************/
22 
23 #pragma once
24 
25 #include <aerospike/as_bin.h>
26 #include <aerospike/as_map.h>
27 #include <aerospike/as_udf.h>
28 
29 /******************************************************************************
30  * CONSTANTS
31  *****************************************************************************/
32 /**
33  * Enumeration of Large Data Types
34  */
35 typedef enum as_ldt_type_e {
36 
41 
42 } as_ldt_type;
43 
44 
45 /******************************************************************************
46  * TYPES
47  *****************************************************************************/
48 
49 /**
50  * Represents a bin containing an LDT value.
51  *
52  * @ingroup client_objects
53  */
54 typedef struct as_ldt_s {
55 
56  /**
57  * @private
58  * If true, then as_ldt_destroy() will free this instance.
59  */
60  bool _free;
61 
62  /**
63  * Bin name.
64  */
66 
67  /**
68  * LDT Type.
69  */
71 
72  /**
73  * LDT UDF Module
74  */
75  as_udf_module_name module;
76 
77 } as_ldt;
78 
79 /******************************************************************************
80  * FUNCTIONS
81  *****************************************************************************/
82 
83 /**
84  * Creates and initializes a heap allocated as_ldt.
85  *
86  * ~~~~~~~~~~{.c}
87  * as_ldt * ldt = as_ldt_new("mystack", AS_LDT_LSTACK, NULL);
88  * ~~~~~~~~~~
89  *
90  * Use as_ldt_destroy() to release resources allocated to as_ldt via
91  * this function.
92  *
93  * @param name The name of the bin to contain the ldt.
94  * @param type The type of ldt data to store in the bin.
95  * @param module The name of ldt customization module to use for this initialization.
96  *
97  * @return The initialized as_key on success. Otherwise NULL.
98  *
99  * @relates as_ldt
100  * @ingroup as_ldt_object
101  */
102 as_ldt * as_ldt_new(const as_bin_name name, const as_ldt_type type, const as_udf_module_name module);
103 
104 
105 /**
106  * Initialize a stack allocated as_ldt.
107  *
108  * ~~~~~~~~~~{.c}
109  * as_ldt ldt;
110  * as_ldt_init(&ldt, "mystack", AS_LDT_LSTACK, NULL);
111  * ~~~~~~~~~~
112  *
113  * Use as_ldt_destroy() to release resources allocated to as_ldt via
114  * this function.
115  *
116  * @param ldt The ldt to initialize.
117  * @param name The name of the bin to contain the ldt.
118  * @param type The type of ldt data to store in the bin.
119  * @param module The name of ldt customization module to use for this initialization.
120  *
121  * @return The initialized as_ldt on success. Otherwise NULL.
122  *
123  * @relates as_ldt
124  * @ingroup as_ldt_object
125  */
126 as_ldt * as_ldt_init(as_ldt * ldt, const as_bin_name name, const as_ldt_type type, const as_udf_module_name module);
127 
128 /**
129  * Destroy the as_ldt, releasing resources.
130  *
131  * ~~~~~~~~~~{.c}
132  * as_ldt_destroy(ldt);
133  * ~~~~~~~~~~
134  *
135  * @param ldt The as_ldt to destroy.
136  *
137  * @relates as_ldt
138  * @ingroup as_ldt_object
139  */
140 void as_ldt_destroy(as_ldt * ldt);