forked from daos-stack/daos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daos_prop.h
319 lines (292 loc) · 7.57 KB
/
daos_prop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/**
* (C) Copyright 2015-2020 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE
* The Government's rights to use, modify, reproduce, release, perform, display,
* or disclose this software are subject to the terms of the Apache License as
* provided in Contract No. B609815.
* Any reproduction of computer software, computer software documentation, or
* portions thereof marked with this legend must also reproduce the markings.
*/
/**
* DAOS pool/container intialization properties
*/
#ifndef __DAOS_PROP_H__
#define __DAOS_PROP_H__
#if defined(__cplusplus)
extern "C" {
#endif
#include <daos_types.h>
/**
* DAOS pool property types
* valid in range (DAOS_PROP_PO_MIN, DAOS_PROP_PO_MAX)
*/
enum daos_pool_props {
DAOS_PROP_PO_MIN = 0,
/**
* Label - a string that a user can associated with a pool.
* default = ""
*/
DAOS_PROP_PO_LABEL,
/**
* ACL: access control list for pool
* An ordered list of access control entries detailing user and group
* access privileges.
* Expected to be in the order: Owner, User(s), Group(s), Everyone
*/
DAOS_PROP_PO_ACL,
/**
* Reserve space ratio: amount of space to be reserved on each target
* for rebuild purpose. default = 0%.
*/
DAOS_PROP_PO_SPACE_RB,
/**
* Automatic/manual self-healing. default = auto
* auto/manual exclusion
* auto/manual rebuild
*/
DAOS_PROP_PO_SELF_HEAL,
/**
* Space reclaim strategy = time|batched|snapshot. default = snapshot
* time interval
* batched commits
* snapshot creation
*/
DAOS_PROP_PO_RECLAIM,
/**
* The user who acts as the owner of the pool.
* Format: user@[domain]
*/
DAOS_PROP_PO_OWNER,
/**
* The group that acts as the owner of the pool.
* Format: group@[domain]
*/
DAOS_PROP_PO_OWNER_GROUP,
DAOS_PROP_PO_MAX,
};
/**
* Number of pool property types
*/
#define DAOS_PROP_PO_NUM (DAOS_PROP_PO_MAX - DAOS_PROP_PO_MIN - 1)
/** DAOS space reclaim strategy */
enum {
DAOS_RECLAIM_DISABLED = 0,
DAOS_RECLAIM_LAZY,
DAOS_RECLAIM_SNAPSHOT,
DAOS_RECLAIM_BATCH,
DAOS_RECLAIM_TIME,
};
/** self headling strategy bits */
#define DAOS_SELF_HEAL_AUTO_EXCLUDE (1U << 0)
#define DAOS_SELF_HEAL_AUTO_REBUILD (1U << 1)
/**
* DAOS container property types
* valid in rage (DAOS_PROP_CO_MIN, DAOS_PROP_CO_MAX).
*/
enum daos_cont_props {
DAOS_PROP_CO_MIN = 0x1000,
/**
* Label - a string that a user can associated with a container.
* default = ""
*/
DAOS_PROP_CO_LABEL,
/**
* Layout type: unknown, POSIX, MPI-IO, HDF5, Apache Arrow, ...
* default value = DAOS_PROP_CO_LAYOUT_UNKOWN
*/
DAOS_PROP_CO_LAYOUT_TYPE,
/**
* Layout version: specific to middleware for interop.
* default = 1
*/
DAOS_PROP_CO_LAYOUT_VER,
/**
* Checksum on/off + checksum type (CRC16, CRC32, SHA-1 & SHA-2).
* default = DAOS_PROP_CO_CSUM_OFF
*/
DAOS_PROP_CO_CSUM,
/**
* Checksum chunk size
* default = 32K
*/
DAOS_PROP_CO_CSUM_CHUNK_SIZE,
/**
* Checksum verification on server. Value = ON/OFF
* default = DAOS_PROP_CO_CSUM_SV_OFF
*/
DAOS_PROP_CO_CSUM_SERVER_VERIFY,
/**
* Redundancy factor:
* RF(n): Container I/O restricted after n faults.
* default = RF1 (DAOS_PROP_CO_REDUN_RF1)
*/
DAOS_PROP_CO_REDUN_FAC,
/**
* Redundancy level: default fault domain level for placement.
* default = rack (DAOS_PROP_CO_REDUN_RACK)
*/
DAOS_PROP_CO_REDUN_LVL,
/**
* Maximum number of snapshots to retain.
*/
DAOS_PROP_CO_SNAPSHOT_MAX,
/**
* ACL: access control list for container
* An ordered list of access control entries detailing user and group
* access privileges.
* Expected to be in the order: Owner, User(s), Group(s), Everyone
*/
DAOS_PROP_CO_ACL,
/** Compression on/off + compression type */
DAOS_PROP_CO_COMPRESS,
/** Encryption on/off + encryption type */
DAOS_PROP_CO_ENCRYPT,
/**
* The user who acts as the owner of the container.
* Format: user@[domain]
*/
DAOS_PROP_CO_OWNER,
/**
* The group that acts as the owner of the container.
* Format: group@[domain]
*/
DAOS_PROP_CO_OWNER_GROUP,
DAOS_PROP_CO_MAX,
};
typedef uint16_t daos_cont_layout_t;
/** container layout type */
enum {
DAOS_PROP_CO_LAYOUT_UNKOWN,
DAOS_PROP_CO_LAYOUT_POSIX,
DAOS_PROP_CO_LAYOUT_HDF5,
};
/** container checksum type */
enum {
DAOS_PROP_CO_CSUM_OFF,
DAOS_PROP_CO_CSUM_CRC16,
DAOS_PROP_CO_CSUM_CRC32,
DAOS_PROP_CO_CSUM_CRC64,
DAOS_PROP_CO_CSUM_SHA1
};
/** container checksum server verify */
enum {
DAOS_PROP_CO_CSUM_SV_OFF,
DAOS_PROP_CO_CSUM_SV_ON
};
/** container compress type */
enum {
DAOS_PROP_CO_COMPRESS_OFF,
};
/** container encryption type */
enum {
DAOS_PROP_CO_ENCRYPT_OFF,
};
/** container redundancy factor */
enum {
DAOS_PROP_CO_REDUN_RF0,
DAOS_PROP_CO_REDUN_RF1,
DAOS_PROP_CO_REDUN_RF2,
DAOS_PROP_CO_REDUN_RF3,
DAOS_PROP_CO_REDUN_RF4,
};
enum {
DAOS_PROP_CO_REDUN_RACK,
DAOS_PROP_CO_REDUN_NODE,
};
struct daos_prop_entry {
/** property type, see enum daos_pool_props/daos_cont_props */
uint32_t dpe_type;
/** reserved for future usage (for 64 bits alignment now) */
uint32_t dpe_reserv;
/**
* value can be either a uint64_t, or a string, or any other type
* data such as the struct daos_acl pointer.
*/
union {
uint64_t dpe_val;
d_string_t dpe_str;
void *dpe_val_ptr;
};
};
/** Allowed max number of property entries in daos_prop_t */
#define DAOS_PROP_ENTRIES_MAX_NR (128)
/** max length for pool/container label */
#define DAOS_PROP_LABEL_MAX_LEN (256)
/** daos properties, for pool or container */
typedef struct {
/** number of entries */
uint32_t dpp_nr;
/** reserved for future usage (for 64 bits alignment now) */
uint32_t dpp_reserv;
/** property entries array */
struct daos_prop_entry *dpp_entries;
} daos_prop_t;
/**
* Allocate DAOS properties.
*
* \param[in] entries_nr number of entries
*
* \return allocated daos_prop_t pointer, NULL if failed.
*/
daos_prop_t *
daos_prop_alloc(uint32_t entries_nr);
/**
* Free the DAOS properties.
*
* \param[in] prop properties to be freed.
*/
void
daos_prop_free(daos_prop_t *prop);
/**
* Merge a set of new DAOS properties into a set of existing DAOS properties.
*
* \param[in] old_prop Existing set of properties
* \param[in] new_prop New properties - may override old entries
*
* \return Newly allocated merged property
*/
daos_prop_t *
daos_prop_merge(daos_prop_t *old_prop, daos_prop_t *new_prop);
/**
* Duplicate a generic pointer value from one DAOS prop entry to another.
* Convenience function.
*
* \param[in][out] entry_dst Destination entry
* \param[in] entry_src Entry to be copied
* \param[in] len Length of the memory to be copied
*
* \return 0 Success
* -DER_NOMEM Out of memory
*/
int
daos_prop_entry_dup_ptr(struct daos_prop_entry *entry_dst,
struct daos_prop_entry *entry_src, size_t len);
/**
* Compare a pair of daos_prop_entry that contain ACLs.
*
* \param entry1 DAOS prop entry for ACL
* \param entry2 DAOS prop entry for ACL
*
* \return 0 Entries match
* -DER_MISMATCH Entries do NOT match
*/
int
daos_prop_entry_cmp_acl(struct daos_prop_entry *entry1,
struct daos_prop_entry *entry2);
#if defined(__cplusplus)
}
#endif
#endif /* __DAOS_PROP_H__ */