Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
aerospike
as_partition.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_node.h
>
20
#include <citrusleaf/cf_digest.h>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/******************************************************************************
27
* MACROS
28
*****************************************************************************/
29
30
/**
31
* Maximum namespace size including null byte. Effective maximum length is 31.
32
*/
33
#define AS_MAX_NAMESPACE_SIZE 32
34
35
/******************************************************************************
36
* TYPES
37
*****************************************************************************/
38
39
/**
40
* @private
41
* Map of namespace data partitions to nodes.
42
*/
43
typedef
struct
as_partition_s {
44
/**
45
* @private
46
* Master node for this partition.
47
*/
48
as_node
*
master
;
49
50
/**
51
* @private
52
* Prole node for this partition.
53
* TODO - not ideal for replication factor > 2.
54
*/
55
as_node
*
prole
;
56
}
as_partition
;
57
58
/**
59
* @private
60
* Map of namespace to data partitions.
61
*/
62
typedef
struct
as_partition_table_s {
63
/**
64
* @private
65
* Namespace
66
*/
67
char
ns[
AS_MAX_NAMESPACE_SIZE
];
68
69
/**
70
* @private
71
* Fixed length of partition array.
72
*/
73
uint32_t
size
;
74
75
/**
76
* @private
77
* Array of partitions for a given namespace.
78
*/
79
as_partition
partitions[];
80
}
as_partition_table
;
81
82
/**
83
* @private
84
* Reference counted array of partition table pointers.
85
*/
86
typedef
struct
as_partition_tables_s {
87
/**
88
* @private
89
* Reference count of partition table array.
90
*/
91
uint32_t
ref_count
;
92
93
/**
94
* @private
95
* Length of partition table array.
96
*/
97
uint32_t
size
;
98
99
/**
100
* @private
101
* Partition table array.
102
*/
103
as_partition_table
* array[];
104
}
as_partition_tables
;
105
106
/******************************************************************************
107
* FUNCTIONS
108
******************************************************************************/
109
110
/**
111
* @private
112
* Create reference counted structure containing partition tables.
113
*/
114
as_partition_tables
*
115
as_partition_tables_create
(uint32_t capacity);
116
117
/**
118
* @private
119
* Destroy and release memory for partition table.
120
*/
121
void
122
as_partition_table_destroy
(
as_partition_table
* table);
123
124
/**
125
* @private
126
* Get partition table given namespace.
127
*/
128
as_partition_table
*
129
as_partition_tables_get
(
as_partition_tables
* tables,
const
char
*
ns
);
130
131
/**
132
* @private
133
* Is node referenced in any partition table.
134
*/
135
bool
136
as_partition_tables_find_node
(
as_partition_tables
* tables,
as_node
* node);
137
138
#ifdef __cplusplus
139
}
// end extern "C"
140
#endif