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