DAOS API: src/include/daos_obj_class.h Source File

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_obj_class.h
1
6#ifndef __DAOS_OBJ_CLASS_H__
7#define __DAOS_OBJ_CLASS_H__
8
9#if defined(__cplusplus)
10extern "C" {
11#endif
12
17enum daos_obj_redun {
21 OR_RP_1 = 1,
22
27 OR_RP_2 = 8,
28 OR_RP_3,
29 OR_RP_4,
30 OR_RP_5,
31 OR_RP_6,
32 OR_RP_8,
33 OR_RP_12,
34 OR_RP_16,
35 OR_RP_24,
36 OR_RP_32,
37 OR_RP_48,
38 OR_RP_64,
39 OR_RP_128,
40
53 OR_RS_2P1 = 32,
54 OR_RS_2P2,
55 OR_RS_4P1,
56 OR_RS_4P2,
57 OR_RS_8P1,
58 OR_RS_8P2,
59 OR_RS_16P1,
60 OR_RS_16P2,
61};
62
63#define MAX_OBJ_CLASS_NAME_LEN 24
64
65#define MAX_NUM_GROUPS ((1 << 16UL) - 1)
66#define OC_REDUN_SHIFT 24
67#define OBJ_CLASS_DEF(redun, grp_nr) ((redun << OC_REDUN_SHIFT) | grp_nr)
72enum {
73 OC_UNKNOWN = 0,
78 OC_BACK_COMPAT = 50,
80 OC_TINY,
86 OC_SMALL,
92 OC_LARGE,
98 OC_MAX,
99
107 OC_RP_TINY = 60,
113 OC_RP_SMALL,
119 OC_RP_LARGE,
125 OC_RP_MAX,
126
137 OC_RP_SF_TINY = 70,
143 OC_RP_SF_SMALL,
149 OC_RP_SF_LARGE,
155 OC_RP_SF_MAX,
156
161 OC_RP_XSF = 80,
162
170 OC_EC_TINY = 100,
176 OC_EC_SMALL,
182 OC_EC_LARGE,
188 OC_EC_MAX,
198 OC_S1 = OBJ_CLASS_DEF(OR_RP_1, 1ULL),
199 OC_S2 = OBJ_CLASS_DEF(OR_RP_1, 2ULL),
200 OC_S4 = OBJ_CLASS_DEF(OR_RP_1, 4ULL),
201 OC_S6 = OBJ_CLASS_DEF(OR_RP_1, 6ULL),
202 OC_S8 = OBJ_CLASS_DEF(OR_RP_1, 8ULL),
203 OC_S12 = OBJ_CLASS_DEF(OR_RP_1, 12ULL),
204 OC_S16 = OBJ_CLASS_DEF(OR_RP_1, 16ULL),
205 OC_S32 = OBJ_CLASS_DEF(OR_RP_1, 32ULL),
206 OC_SX = OBJ_CLASS_DEF(OR_RP_1, MAX_NUM_GROUPS),
207
219 OC_RP_2G1 = OBJ_CLASS_DEF(OR_RP_2, 1ULL),
220 OC_RP_2G2 = OBJ_CLASS_DEF(OR_RP_2, 2ULL),
221 OC_RP_2G4 = OBJ_CLASS_DEF(OR_RP_2, 4ULL),
222 OC_RP_2G6 = OBJ_CLASS_DEF(OR_RP_2, 6ULL),
223 OC_RP_2G8 = OBJ_CLASS_DEF(OR_RP_2, 8ULL),
224 OC_RP_2G12 = OBJ_CLASS_DEF(OR_RP_2, 12ULL),
225 OC_RP_2G16 = OBJ_CLASS_DEF(OR_RP_2, 16ULL),
226 OC_RP_2G32 = OBJ_CLASS_DEF(OR_RP_2, 32ULL),
227 OC_RP_2GX = OBJ_CLASS_DEF(OR_RP_2, MAX_NUM_GROUPS),
228
230 OC_RP_3G1 = OBJ_CLASS_DEF(OR_RP_3, 1ULL),
231 OC_RP_3G2 = OBJ_CLASS_DEF(OR_RP_3, 2ULL),
232 OC_RP_3G4 = OBJ_CLASS_DEF(OR_RP_3, 4ULL),
233 OC_RP_3G6 = OBJ_CLASS_DEF(OR_RP_3, 6ULL),
234 OC_RP_3G8 = OBJ_CLASS_DEF(OR_RP_3, 8ULL),
235 OC_RP_3G12 = OBJ_CLASS_DEF(OR_RP_3, 12ULL),
236 OC_RP_3G16 = OBJ_CLASS_DEF(OR_RP_3, 16ULL),
237 OC_RP_3G32 = OBJ_CLASS_DEF(OR_RP_3, 32ULL),
238 OC_RP_3GX = OBJ_CLASS_DEF(OR_RP_3, MAX_NUM_GROUPS),
239
241 OC_RP_4G1 = OBJ_CLASS_DEF(OR_RP_4, 1ULL),
242 OC_RP_4G2 = OBJ_CLASS_DEF(OR_RP_4, 2ULL),
243 OC_RP_4G4 = OBJ_CLASS_DEF(OR_RP_4, 4ULL),
244 OC_RP_4G6 = OBJ_CLASS_DEF(OR_RP_4, 6ULL),
245 OC_RP_4G8 = OBJ_CLASS_DEF(OR_RP_4, 8ULL),
246 OC_RP_4G12 = OBJ_CLASS_DEF(OR_RP_4, 12ULL),
247 OC_RP_4G16 = OBJ_CLASS_DEF(OR_RP_4, 16ULL),
248 OC_RP_4G32 = OBJ_CLASS_DEF(OR_RP_4, 32ULL),
249 OC_RP_4GX = OBJ_CLASS_DEF(OR_RP_4, MAX_NUM_GROUPS),
250
252 OC_RP_5G1 = OBJ_CLASS_DEF(OR_RP_5, 1ULL),
253 OC_RP_5G2 = OBJ_CLASS_DEF(OR_RP_5, 2ULL),
254 OC_RP_5G4 = OBJ_CLASS_DEF(OR_RP_5, 4ULL),
255 OC_RP_5G6 = OBJ_CLASS_DEF(OR_RP_5, 6ULL),
256 OC_RP_5G8 = OBJ_CLASS_DEF(OR_RP_5, 8ULL),
257 OC_RP_5G12 = OBJ_CLASS_DEF(OR_RP_5, 12ULL),
258 OC_RP_5G16 = OBJ_CLASS_DEF(OR_RP_5, 16ULL),
259 OC_RP_5G32 = OBJ_CLASS_DEF(OR_RP_5, 32ULL),
260 OC_RP_5GX = OBJ_CLASS_DEF(OR_RP_5, MAX_NUM_GROUPS),
261
263 OC_RP_6G1 = OBJ_CLASS_DEF(OR_RP_6, 1ULL),
264 OC_RP_6G2 = OBJ_CLASS_DEF(OR_RP_6, 2ULL),
265 OC_RP_6G4 = OBJ_CLASS_DEF(OR_RP_6, 4ULL),
266 OC_RP_6G6 = OBJ_CLASS_DEF(OR_RP_6, 6ULL),
267 OC_RP_6G8 = OBJ_CLASS_DEF(OR_RP_6, 8ULL),
268 OC_RP_6G12 = OBJ_CLASS_DEF(OR_RP_6, 12ULL),
269 OC_RP_6G16 = OBJ_CLASS_DEF(OR_RP_6, 16ULL),
270 OC_RP_6G32 = OBJ_CLASS_DEF(OR_RP_6, 32ULL),
271 OC_RP_6GX = OBJ_CLASS_DEF(OR_RP_6, MAX_NUM_GROUPS),
272
273 /* OC_XSF will map to one of these */
274 OC_RP_12G1 = OBJ_CLASS_DEF(OR_RP_12, 1ULL),
275 OC_RP_16G1 = OBJ_CLASS_DEF(OR_RP_16, 1ULL),
276 OC_RP_24G1 = OBJ_CLASS_DEF(OR_RP_24, 1ULL),
277 OC_RP_32G1 = OBJ_CLASS_DEF(OR_RP_32, 1ULL),
278 OC_RP_48G1 = OBJ_CLASS_DEF(OR_RP_48, 1ULL),
279 OC_RP_64G1 = OBJ_CLASS_DEF(OR_RP_64, 1ULL),
280 OC_RP_128G1 = OBJ_CLASS_DEF(OR_RP_128, 1ULL),
281
295 OC_EC_2P1G1 = OBJ_CLASS_DEF(OR_RS_2P1, 1ULL),
296 OC_EC_2P1G2 = OBJ_CLASS_DEF(OR_RS_2P1, 2ULL),
297 OC_EC_2P1G4 = OBJ_CLASS_DEF(OR_RS_2P1, 4ULL),
298 OC_EC_2P1G6 = OBJ_CLASS_DEF(OR_RS_2P1, 6ULL),
299 OC_EC_2P1G8 = OBJ_CLASS_DEF(OR_RS_2P1, 8ULL),
300 OC_EC_2P1G12 = OBJ_CLASS_DEF(OR_RS_2P1, 12ULL),
301 OC_EC_2P1G16 = OBJ_CLASS_DEF(OR_RS_2P1, 16ULL),
302 OC_EC_2P1G32 = OBJ_CLASS_DEF(OR_RS_2P1, 32ULL),
303 OC_EC_2P1GX = OBJ_CLASS_DEF(OR_RS_2P1, MAX_NUM_GROUPS),
304
306 OC_EC_2P2G1 = OBJ_CLASS_DEF(OR_RS_2P2, 1ULL),
307 OC_EC_2P2G2 = OBJ_CLASS_DEF(OR_RS_2P2, 2ULL),
308 OC_EC_2P2G4 = OBJ_CLASS_DEF(OR_RS_2P2, 4ULL),
309 OC_EC_2P2G6 = OBJ_CLASS_DEF(OR_RS_2P2, 6ULL),
310 OC_EC_2P2G8 = OBJ_CLASS_DEF(OR_RS_2P2, 8ULL),
311 OC_EC_2P2G12 = OBJ_CLASS_DEF(OR_RS_2P2, 12ULL),
312 OC_EC_2P2G16 = OBJ_CLASS_DEF(OR_RS_2P2, 16ULL),
313 OC_EC_2P2G32 = OBJ_CLASS_DEF(OR_RS_2P2, 32ULL),
314 OC_EC_2P2GX = OBJ_CLASS_DEF(OR_RS_2P2, MAX_NUM_GROUPS),
315
317 OC_EC_4P1G1 = OBJ_CLASS_DEF(OR_RS_4P1, 1ULL),
318 OC_EC_4P1G2 = OBJ_CLASS_DEF(OR_RS_4P1, 2ULL),
319 OC_EC_4P1G4 = OBJ_CLASS_DEF(OR_RS_4P1, 4ULL),
320 OC_EC_4P1G6 = OBJ_CLASS_DEF(OR_RS_4P1, 6ULL),
321 OC_EC_4P1G8 = OBJ_CLASS_DEF(OR_RS_4P1, 8ULL),
322 OC_EC_4P1G12 = OBJ_CLASS_DEF(OR_RS_4P1, 12ULL),
323 OC_EC_4P1G16 = OBJ_CLASS_DEF(OR_RS_4P1, 16ULL),
324 OC_EC_4P1G32 = OBJ_CLASS_DEF(OR_RS_4P1, 32ULL),
325 OC_EC_4P1GX = OBJ_CLASS_DEF(OR_RS_4P1, MAX_NUM_GROUPS),
326
328 OC_EC_4P2G1 = OBJ_CLASS_DEF(OR_RS_4P2, 1ULL),
329 OC_EC_4P2G2 = OBJ_CLASS_DEF(OR_RS_4P2, 2ULL),
330 OC_EC_4P2G4 = OBJ_CLASS_DEF(OR_RS_4P2, 4ULL),
331 OC_EC_4P2G6 = OBJ_CLASS_DEF(OR_RS_4P2, 6ULL),
332 OC_EC_4P2G8 = OBJ_CLASS_DEF(OR_RS_4P2, 8ULL),
333 OC_EC_4P2G12 = OBJ_CLASS_DEF(OR_RS_4P2, 12ULL),
334 OC_EC_4P2G16 = OBJ_CLASS_DEF(OR_RS_4P2, 16ULL),
335 OC_EC_4P2G32 = OBJ_CLASS_DEF(OR_RS_4P2, 32ULL),
336 OC_EC_4P2GX = OBJ_CLASS_DEF(OR_RS_4P2, MAX_NUM_GROUPS),
337
339 OC_EC_8P1G1 = OBJ_CLASS_DEF(OR_RS_8P1, 1ULL),
340 OC_EC_8P1G2 = OBJ_CLASS_DEF(OR_RS_8P1, 2ULL),
341 OC_EC_8P1G4 = OBJ_CLASS_DEF(OR_RS_8P1, 4ULL),
342 OC_EC_8P1G6 = OBJ_CLASS_DEF(OR_RS_8P1, 6ULL),
343 OC_EC_8P1G8 = OBJ_CLASS_DEF(OR_RS_8P1, 8ULL),
344 OC_EC_8P1G12 = OBJ_CLASS_DEF(OR_RS_8P1, 12ULL),
345 OC_EC_8P1G16 = OBJ_CLASS_DEF(OR_RS_8P1, 16ULL),
346 OC_EC_8P1G32 = OBJ_CLASS_DEF(OR_RS_8P1, 32ULL),
347 OC_EC_8P1GX = OBJ_CLASS_DEF(OR_RS_8P1, MAX_NUM_GROUPS),
348
350 OC_EC_8P2G1 = OBJ_CLASS_DEF(OR_RS_8P2, 1ULL),
351 OC_EC_8P2G2 = OBJ_CLASS_DEF(OR_RS_8P2, 2ULL),
352 OC_EC_8P2G4 = OBJ_CLASS_DEF(OR_RS_8P2, 4ULL),
353 OC_EC_8P2G6 = OBJ_CLASS_DEF(OR_RS_8P2, 6ULL),
354 OC_EC_8P2G8 = OBJ_CLASS_DEF(OR_RS_8P2, 8ULL),
355 OC_EC_8P2G12 = OBJ_CLASS_DEF(OR_RS_8P2, 12ULL),
356 OC_EC_8P2G16 = OBJ_CLASS_DEF(OR_RS_8P2, 16ULL),
357 OC_EC_8P2G32 = OBJ_CLASS_DEF(OR_RS_8P2, 32ULL),
358 OC_EC_8P2GX = OBJ_CLASS_DEF(OR_RS_8P2, MAX_NUM_GROUPS),
359
361 OC_EC_16P1G1 = OBJ_CLASS_DEF(OR_RS_16P1, 1ULL),
362 OC_EC_16P1G2 = OBJ_CLASS_DEF(OR_RS_16P1, 2ULL),
363 OC_EC_16P1G4 = OBJ_CLASS_DEF(OR_RS_16P1, 4ULL),
364 OC_EC_16P1G6 = OBJ_CLASS_DEF(OR_RS_16P1, 6ULL),
365 OC_EC_16P1G8 = OBJ_CLASS_DEF(OR_RS_16P1, 8ULL),
366 OC_EC_16P1G12 = OBJ_CLASS_DEF(OR_RS_16P1, 12ULL),
367 OC_EC_16P1G16 = OBJ_CLASS_DEF(OR_RS_16P1, 16ULL),
368 OC_EC_16P1G32 = OBJ_CLASS_DEF(OR_RS_16P1, 32ULL),
369 OC_EC_16P1GX = OBJ_CLASS_DEF(OR_RS_16P1, MAX_NUM_GROUPS),
370
372 OC_EC_16P2G1 = OBJ_CLASS_DEF(OR_RS_16P2, 1ULL),
373 OC_EC_16P2G2 = OBJ_CLASS_DEF(OR_RS_16P2, 2ULL),
374 OC_EC_16P2G4 = OBJ_CLASS_DEF(OR_RS_16P2, 4ULL),
375 OC_EC_16P2G6 = OBJ_CLASS_DEF(OR_RS_16P2, 6ULL),
376 OC_EC_16P2G8 = OBJ_CLASS_DEF(OR_RS_16P2, 8ULL),
377 OC_EC_16P2G12 = OBJ_CLASS_DEF(OR_RS_16P2, 12ULL),
378 OC_EC_16P2G16 = OBJ_CLASS_DEF(OR_RS_16P2, 16ULL),
379 OC_EC_16P2G32 = OBJ_CLASS_DEF(OR_RS_16P2, 32ULL),
380 OC_EC_16P2GX = OBJ_CLASS_DEF(OR_RS_16P2, MAX_NUM_GROUPS),
381
383 OC_RESERVED = 1 << 30,
384
385};
386
387enum daos_obj_schema {
388 DAOS_OS_SINGLE,
389 DAOS_OS_STRIPED,
390 DAOS_OS_DYN_STRIPED,
391 DAOS_OS_DYN_CHUNKED,
392};
393
394enum daos_obj_resil {
395 DAOS_RES_EC,
396 DAOS_RES_REPL,
397};
398
400 struct daos_oclass_attr {
402 enum daos_obj_schema ca_schema;
404 enum daos_obj_resil ca_resil;
406 unsigned int ca_resil_degree;
408 unsigned int ca_grp_nr;
410 union {
412 struct daos_rp_attr {
414 unsigned int r_proto;
416 unsigned int r_num;
417 } rp;
418
420 struct daos_ec_attr {
422 unsigned short e_k;
424 unsigned short e_p;
426 unsigned int e_len;
427 } ec;
428 } u;
430};
431
433typedef uint32_t daos_oclass_id_t;
435typedef uint16_t daos_oclass_hints_t;
436
438 struct daos_oclass_list {
440 uint32_t cl_nr;
442 uint32_t cl_nr_out;
444 daos_oclass_id_t *cl_cids;
446 struct daos_oclass_attr *cl_cattrs;
447};
448
456int
457daos_oclass_name2id(const char *name);
458
467ssize_t
468daos_oclass_names_list(size_t size, char *str);
469
478int
479daos_oclass_nr(int opts);
480
490int
491daos_oclass_id2name(daos_oclass_id_t oc_id, char *name);
492
512int
513daos_obj_register_class(daos_handle_t coh, daos_oclass_id_t cid,
514 struct daos_oclass_attr *attr, daos_event_t *ev);
515
533int
534daos_obj_query_class(daos_handle_t coh, daos_oclass_id_t cid,
535 struct daos_oclass_attr *attr, daos_event_t *ev);
536
556int
557daos_obj_list_class(daos_handle_t coh, struct daos_oclass_list *list,
558 daos_anchor_t *anchor, daos_event_t *ev);
559
560#if defined(__cplusplus)
561}
562#endif
563
564#endif /* __DAOS_OBJ_CLASS_H__ */
daos_anchor_t
Definition daos_types.h:58
daos_handle_t
Definition daos_types.h:73
daos_oclass_attr
Definition daos_obj_class.h:400
daos_oclass_attr::ca_schema
enum daos_obj_schema ca_schema
Definition daos_obj_class.h:402
daos_oclass_attr::ca_grp_nr
unsigned int ca_grp_nr
Definition daos_obj_class.h:408
daos_oclass_attr::r_num
unsigned int r_num
Definition daos_obj_class.h:416
daos_oclass_attr::e_p
unsigned short e_p
Definition daos_obj_class.h:424
daos_oclass_attr::ca_resil
enum daos_obj_resil ca_resil
Definition daos_obj_class.h:404
daos_oclass_attr::e_k
unsigned short e_k
Definition daos_obj_class.h:422
daos_oclass_attr::ca_resil_degree
unsigned int ca_resil_degree
Definition daos_obj_class.h:406
daos_oclass_attr::e_len
unsigned int e_len
Definition daos_obj_class.h:426
daos_oclass_attr::r_proto
unsigned int r_proto
Definition daos_obj_class.h:414
daos_oclass_attr::u
union daos_oclass_attr::@127151067061005121366121137052015375052313270033 u
daos_oclass_list
Definition daos_obj_class.h:438
daos_oclass_list::cl_nr
uint32_t cl_nr
Definition daos_obj_class.h:440
daos_oclass_list::cl_cattrs
struct daos_oclass_attr * cl_cattrs
Definition daos_obj_class.h:446
daos_oclass_list::cl_nr_out
uint32_t cl_nr_out
Definition daos_obj_class.h:442
daos_oclass_list::cl_cids
daos_oclass_id_t * cl_cids
Definition daos_obj_class.h:444