Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
aerospike
as_ldt.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
#pragma once
18
19
#include <
aerospike/as_bin.h
>
20
#include <
aerospike/as_map.h
>
21
#include <
aerospike/as_udf.h
>
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
/******************************************************************************
28
* CONSTANTS
29
*****************************************************************************/
30
/**
31
* Enumeration of Large Data Types
32
*/
33
typedef
enum
as_ldt_type_e {
34
35
AS_LDT_LLIST
,
36
AS_LDT_LMAP
,
37
AS_LDT_LSET
,
38
AS_LDT_LSTACK
39
40
}
as_ldt_type
;
41
42
43
/******************************************************************************
44
* TYPES
45
*****************************************************************************/
46
47
/**
48
* Represents a bin containing an LDT value.
49
*
50
* @ingroup client_objects
51
*/
52
typedef
struct
as_ldt_s {
53
54
/**
55
* @private
56
* If true, then as_ldt_destroy() will free this instance.
57
*/
58
bool
_free
;
59
60
/**
61
* Bin name.
62
*/
63
as_bin_name
name
;
64
65
/**
66
* LDT Type.
67
*/
68
as_ldt_type
type
;
69
70
/**
71
* LDT UDF Module
72
*/
73
as_udf_module_name
module
;
74
75
}
as_ldt
;
76
77
/******************************************************************************
78
* FUNCTIONS
79
*****************************************************************************/
80
81
/**
82
* Creates and initializes a heap allocated as_ldt.
83
*
84
* ~~~~~~~~~~{.c}
85
* as_ldt * ldt = as_ldt_new("mystack", AS_LDT_LSTACK, NULL);
86
* ~~~~~~~~~~
87
*
88
* Use as_ldt_destroy() to release resources allocated to as_ldt via
89
* this function.
90
*
91
* @param name The name of the bin to contain the ldt.
92
* @param type The type of ldt data to store in the bin.
93
* @param module The name of ldt customization module to use for this initialization.
94
*
95
* @return The initialized as_key on success. Otherwise NULL.
96
*
97
* @relates as_ldt
98
* @ingroup as_ldt_object
99
*/
100
as_ldt
*
as_ldt_new
(
const
as_bin_name
name,
const
as_ldt_type
type
,
const
as_udf_module_name
module);
101
102
103
/**
104
* Initialize a stack allocated as_ldt.
105
*
106
* ~~~~~~~~~~{.c}
107
* as_ldt ldt;
108
* as_ldt_init(&ldt, "mystack", AS_LDT_LSTACK, NULL);
109
* ~~~~~~~~~~
110
*
111
* Use as_ldt_destroy() to release resources allocated to as_ldt via
112
* this function.
113
*
114
* @param ldt The ldt to initialize.
115
* @param name The name of the bin to contain the ldt.
116
* @param type The type of ldt data to store in the bin.
117
* @param module The name of ldt customization module to use for this initialization.
118
*
119
* @return The initialized as_ldt on success. Otherwise NULL.
120
*
121
* @relates as_ldt
122
* @ingroup as_ldt_object
123
*/
124
as_ldt
*
as_ldt_init
(
as_ldt
* ldt,
const
as_bin_name
name,
const
as_ldt_type
type
,
const
as_udf_module_name
module);
125
126
/**
127
* Destroy the as_ldt, releasing resources.
128
*
129
* ~~~~~~~~~~{.c}
130
* as_ldt_destroy(ldt);
131
* ~~~~~~~~~~
132
*
133
* @param ldt The as_ldt to destroy.
134
*
135
* @relates as_ldt
136
* @ingroup as_ldt_object
137
*/
138
void
as_ldt_destroy
(
as_ldt
* ldt);
139
140
#ifdef __cplusplus
141
}
// end extern "C"
142
#endif