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