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

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_obj_class.h
1
7#ifndef __DAOS_OBJ_CLASS_H__
8#define __DAOS_OBJ_CLASS_H__
9
10#if defined(__cplusplus)
11extern "C" {
12#endif
13
14#include <sys/types.h>
15#include <inttypes.h>
16
17#include <daos_types.h>
18
19#define MAX_OBJ_CLASS_NAME_LEN 24
20
21#define MAX_NUM_GROUPS ((1 << 16UL) - 1)
22#define OC_REDUN_SHIFT 24
23#define OBJ_CLASS_DEF(redun, grp_nr) ((redun << OC_REDUN_SHIFT) | grp_nr)
24
29enum daos_obj_redun {
30 OC_UNKNOWN = 0,
31
35 OR_RP_1 = 1,
36
41 OR_RP_2 = 8,
42 OR_RP_3,
43 OR_RP_4,
44 OR_RP_5,
45 OR_RP_6,
46 OR_RP_8,
47 OR_RP_12,
48 OR_RP_16,
49 OR_RP_24,
50 OR_RP_32,
51 OR_RP_48,
52 OR_RP_64,
53 OR_RP_128,
54
70 OR_RS_2P1 = 32,
71 OR_RS_2P2,
72 OR_RS_4P1,
73 OR_RS_4P2,
74 OR_RS_8P1,
75 OR_RS_8P2,
76 OR_RS_16P1,
77 OR_RS_16P2,
78 OR_RS_4P3,
79 OR_RS_8P3,
80 OR_RS_16P3,
81
82 /*
83 * Predefined object classes that can be used directly by the API user.
84 * It describes schema of data distribution & protection.
85 */
90 OC_BACK_COMPAT = 50,
92 OC_TINY,
98 OC_SMALL,
104 OC_LARGE,
110 OC_MAX,
111
119 OC_RP_TINY = 60,
125 OC_RP_SMALL,
131 OC_RP_LARGE,
137 OC_RP_MAX,
138
149 OC_RP_SF_TINY = 70,
155 OC_RP_SF_SMALL,
161 OC_RP_SF_LARGE,
167 OC_RP_SF_MAX,
168
173 OC_RP_XSF = 80,
174
182 OC_EC_TINY = 100,
188 OC_EC_SMALL,
194 OC_EC_LARGE,
200 OC_EC_MAX,
210 OC_S1 = OBJ_CLASS_DEF(OR_RP_1, 1ULL),
211 OC_S2 = OBJ_CLASS_DEF(OR_RP_1, 2ULL),
212 OC_S4 = OBJ_CLASS_DEF(OR_RP_1, 4ULL),
213 OC_S6 = OBJ_CLASS_DEF(OR_RP_1, 6ULL),
214 OC_S8 = OBJ_CLASS_DEF(OR_RP_1, 8ULL),
215 OC_S12 = OBJ_CLASS_DEF(OR_RP_1, 12ULL),
216 OC_S16 = OBJ_CLASS_DEF(OR_RP_1, 16ULL),
217 OC_S32 = OBJ_CLASS_DEF(OR_RP_1, 32ULL),
218 OC_SX = OBJ_CLASS_DEF(OR_RP_1, MAX_NUM_GROUPS),
219
231 OC_RP_2G1 = OBJ_CLASS_DEF(OR_RP_2, 1ULL),
232 OC_RP_2G2 = OBJ_CLASS_DEF(OR_RP_2, 2ULL),
233 OC_RP_2G4 = OBJ_CLASS_DEF(OR_RP_2, 4ULL),
234 OC_RP_2G6 = OBJ_CLASS_DEF(OR_RP_2, 6ULL),
235 OC_RP_2G8 = OBJ_CLASS_DEF(OR_RP_2, 8ULL),
236 OC_RP_2G12 = OBJ_CLASS_DEF(OR_RP_2, 12ULL),
237 OC_RP_2G16 = OBJ_CLASS_DEF(OR_RP_2, 16ULL),
238 OC_RP_2G32 = OBJ_CLASS_DEF(OR_RP_2, 32ULL),
239 OC_RP_2GX = OBJ_CLASS_DEF(OR_RP_2, MAX_NUM_GROUPS),
240
242 OC_RP_3G1 = OBJ_CLASS_DEF(OR_RP_3, 1ULL),
243 OC_RP_3G2 = OBJ_CLASS_DEF(OR_RP_3, 2ULL),
244 OC_RP_3G4 = OBJ_CLASS_DEF(OR_RP_3, 4ULL),
245 OC_RP_3G6 = OBJ_CLASS_DEF(OR_RP_3, 6ULL),
246 OC_RP_3G8 = OBJ_CLASS_DEF(OR_RP_3, 8ULL),
247 OC_RP_3G12 = OBJ_CLASS_DEF(OR_RP_3, 12ULL),
248 OC_RP_3G16 = OBJ_CLASS_DEF(OR_RP_3, 16ULL),
249 OC_RP_3G32 = OBJ_CLASS_DEF(OR_RP_3, 32ULL),
250 OC_RP_3GX = OBJ_CLASS_DEF(OR_RP_3, MAX_NUM_GROUPS),
251
253 OC_RP_4G1 = OBJ_CLASS_DEF(OR_RP_4, 1ULL),
254 OC_RP_4G2 = OBJ_CLASS_DEF(OR_RP_4, 2ULL),
255 OC_RP_4G4 = OBJ_CLASS_DEF(OR_RP_4, 4ULL),
256 OC_RP_4G6 = OBJ_CLASS_DEF(OR_RP_4, 6ULL),
257 OC_RP_4G8 = OBJ_CLASS_DEF(OR_RP_4, 8ULL),
258 OC_RP_4G12 = OBJ_CLASS_DEF(OR_RP_4, 12ULL),
259 OC_RP_4G16 = OBJ_CLASS_DEF(OR_RP_4, 16ULL),
260 OC_RP_4G32 = OBJ_CLASS_DEF(OR_RP_4, 32ULL),
261 OC_RP_4GX = OBJ_CLASS_DEF(OR_RP_4, MAX_NUM_GROUPS),
262
264 OC_RP_5G1 = OBJ_CLASS_DEF(OR_RP_5, 1ULL),
265 OC_RP_5G2 = OBJ_CLASS_DEF(OR_RP_5, 2ULL),
266 OC_RP_5G4 = OBJ_CLASS_DEF(OR_RP_5, 4ULL),
267 OC_RP_5G6 = OBJ_CLASS_DEF(OR_RP_5, 6ULL),
268 OC_RP_5G8 = OBJ_CLASS_DEF(OR_RP_5, 8ULL),
269 OC_RP_5G12 = OBJ_CLASS_DEF(OR_RP_5, 12ULL),
270 OC_RP_5G16 = OBJ_CLASS_DEF(OR_RP_5, 16ULL),
271 OC_RP_5G32 = OBJ_CLASS_DEF(OR_RP_5, 32ULL),
272 OC_RP_5GX = OBJ_CLASS_DEF(OR_RP_5, MAX_NUM_GROUPS),
273
275 OC_RP_6G1 = OBJ_CLASS_DEF(OR_RP_6, 1ULL),
276 OC_RP_6G2 = OBJ_CLASS_DEF(OR_RP_6, 2ULL),
277 OC_RP_6G4 = OBJ_CLASS_DEF(OR_RP_6, 4ULL),
278 OC_RP_6G6 = OBJ_CLASS_DEF(OR_RP_6, 6ULL),
279 OC_RP_6G8 = OBJ_CLASS_DEF(OR_RP_6, 8ULL),
280 OC_RP_6G12 = OBJ_CLASS_DEF(OR_RP_6, 12ULL),
281 OC_RP_6G16 = OBJ_CLASS_DEF(OR_RP_6, 16ULL),
282 OC_RP_6G32 = OBJ_CLASS_DEF(OR_RP_6, 32ULL),
283 OC_RP_6GX = OBJ_CLASS_DEF(OR_RP_6, MAX_NUM_GROUPS),
284
285 /* OC_XSF will map to one of these */
286 OC_RP_12G1 = OBJ_CLASS_DEF(OR_RP_12, 1ULL),
287 OC_RP_16G1 = OBJ_CLASS_DEF(OR_RP_16, 1ULL),
288 OC_RP_24G1 = OBJ_CLASS_DEF(OR_RP_24, 1ULL),
289 OC_RP_32G1 = OBJ_CLASS_DEF(OR_RP_32, 1ULL),
290 OC_RP_48G1 = OBJ_CLASS_DEF(OR_RP_48, 1ULL),
291 OC_RP_64G1 = OBJ_CLASS_DEF(OR_RP_64, 1ULL),
292 OC_RP_128G1 = OBJ_CLASS_DEF(OR_RP_128, 1ULL),
293
307 OC_EC_2P1G1 = OBJ_CLASS_DEF(OR_RS_2P1, 1ULL),
308 OC_EC_2P1G2 = OBJ_CLASS_DEF(OR_RS_2P1, 2ULL),
309 OC_EC_2P1G4 = OBJ_CLASS_DEF(OR_RS_2P1, 4ULL),
310 OC_EC_2P1G6 = OBJ_CLASS_DEF(OR_RS_2P1, 6ULL),
311 OC_EC_2P1G8 = OBJ_CLASS_DEF(OR_RS_2P1, 8ULL),
312 OC_EC_2P1G12 = OBJ_CLASS_DEF(OR_RS_2P1, 12ULL),
313 OC_EC_2P1G16 = OBJ_CLASS_DEF(OR_RS_2P1, 16ULL),
314 OC_EC_2P1G32 = OBJ_CLASS_DEF(OR_RS_2P1, 32ULL),
315 OC_EC_2P1GX = OBJ_CLASS_DEF(OR_RS_2P1, MAX_NUM_GROUPS),
316
318 OC_EC_2P2G1 = OBJ_CLASS_DEF(OR_RS_2P2, 1ULL),
319 OC_EC_2P2G2 = OBJ_CLASS_DEF(OR_RS_2P2, 2ULL),
320 OC_EC_2P2G4 = OBJ_CLASS_DEF(OR_RS_2P2, 4ULL),
321 OC_EC_2P2G6 = OBJ_CLASS_DEF(OR_RS_2P2, 6ULL),
322 OC_EC_2P2G8 = OBJ_CLASS_DEF(OR_RS_2P2, 8ULL),
323 OC_EC_2P2G12 = OBJ_CLASS_DEF(OR_RS_2P2, 12ULL),
324 OC_EC_2P2G16 = OBJ_CLASS_DEF(OR_RS_2P2, 16ULL),
325 OC_EC_2P2G32 = OBJ_CLASS_DEF(OR_RS_2P2, 32ULL),
326 OC_EC_2P2GX = OBJ_CLASS_DEF(OR_RS_2P2, MAX_NUM_GROUPS),
327
329 OC_EC_4P1G1 = OBJ_CLASS_DEF(OR_RS_4P1, 1ULL),
330 OC_EC_4P1G2 = OBJ_CLASS_DEF(OR_RS_4P1, 2ULL),
331 OC_EC_4P1G4 = OBJ_CLASS_DEF(OR_RS_4P1, 4ULL),
332 OC_EC_4P1G6 = OBJ_CLASS_DEF(OR_RS_4P1, 6ULL),
333 OC_EC_4P1G8 = OBJ_CLASS_DEF(OR_RS_4P1, 8ULL),
334 OC_EC_4P1G12 = OBJ_CLASS_DEF(OR_RS_4P1, 12ULL),
335 OC_EC_4P1G16 = OBJ_CLASS_DEF(OR_RS_4P1, 16ULL),
336 OC_EC_4P1G32 = OBJ_CLASS_DEF(OR_RS_4P1, 32ULL),
337 OC_EC_4P1GX = OBJ_CLASS_DEF(OR_RS_4P1, MAX_NUM_GROUPS),
338
340 OC_EC_4P2G1 = OBJ_CLASS_DEF(OR_RS_4P2, 1ULL),
341 OC_EC_4P2G2 = OBJ_CLASS_DEF(OR_RS_4P2, 2ULL),
342 OC_EC_4P2G4 = OBJ_CLASS_DEF(OR_RS_4P2, 4ULL),
343 OC_EC_4P2G6 = OBJ_CLASS_DEF(OR_RS_4P2, 6ULL),
344 OC_EC_4P2G8 = OBJ_CLASS_DEF(OR_RS_4P2, 8ULL),
345 OC_EC_4P2G12 = OBJ_CLASS_DEF(OR_RS_4P2, 12ULL),
346 OC_EC_4P2G16 = OBJ_CLASS_DEF(OR_RS_4P2, 16ULL),
347 OC_EC_4P2G32 = OBJ_CLASS_DEF(OR_RS_4P2, 32ULL),
348 OC_EC_4P2GX = OBJ_CLASS_DEF(OR_RS_4P2, MAX_NUM_GROUPS),
349
351 OC_EC_4P3G1 = OBJ_CLASS_DEF(OR_RS_4P3, 1ULL),
352 OC_EC_4P3G2 = OBJ_CLASS_DEF(OR_RS_4P3, 2ULL),
353 OC_EC_4P3G4 = OBJ_CLASS_DEF(OR_RS_4P3, 4ULL),
354 OC_EC_4P3G6 = OBJ_CLASS_DEF(OR_RS_4P3, 6ULL),
355 OC_EC_4P3G8 = OBJ_CLASS_DEF(OR_RS_4P3, 8ULL),
356 OC_EC_4P3G12 = OBJ_CLASS_DEF(OR_RS_4P3, 12ULL),
357 OC_EC_4P3G16 = OBJ_CLASS_DEF(OR_RS_4P3, 16ULL),
358 OC_EC_4P3G32 = OBJ_CLASS_DEF(OR_RS_4P3, 32ULL),
359 OC_EC_4P3GX = OBJ_CLASS_DEF(OR_RS_4P3, MAX_NUM_GROUPS),
360
362 OC_EC_8P1G1 = OBJ_CLASS_DEF(OR_RS_8P1, 1ULL),
363 OC_EC_8P1G2 = OBJ_CLASS_DEF(OR_RS_8P1, 2ULL),
364 OC_EC_8P1G4 = OBJ_CLASS_DEF(OR_RS_8P1, 4ULL),
365 OC_EC_8P1G6 = OBJ_CLASS_DEF(OR_RS_8P1, 6ULL),
366 OC_EC_8P1G8 = OBJ_CLASS_DEF(OR_RS_8P1, 8ULL),
367 OC_EC_8P1G12 = OBJ_CLASS_DEF(OR_RS_8P1, 12ULL),
368 OC_EC_8P1G16 = OBJ_CLASS_DEF(OR_RS_8P1, 16ULL),
369 OC_EC_8P1G32 = OBJ_CLASS_DEF(OR_RS_8P1, 32ULL),
370 OC_EC_8P1GX = OBJ_CLASS_DEF(OR_RS_8P1, MAX_NUM_GROUPS),
371
373 OC_EC_8P2G1 = OBJ_CLASS_DEF(OR_RS_8P2, 1ULL),
374 OC_EC_8P2G2 = OBJ_CLASS_DEF(OR_RS_8P2, 2ULL),
375 OC_EC_8P2G4 = OBJ_CLASS_DEF(OR_RS_8P2, 4ULL),
376 OC_EC_8P2G6 = OBJ_CLASS_DEF(OR_RS_8P2, 6ULL),
377 OC_EC_8P2G8 = OBJ_CLASS_DEF(OR_RS_8P2, 8ULL),
378 OC_EC_8P2G12 = OBJ_CLASS_DEF(OR_RS_8P2, 12ULL),
379 OC_EC_8P2G16 = OBJ_CLASS_DEF(OR_RS_8P2, 16ULL),
380 OC_EC_8P2G32 = OBJ_CLASS_DEF(OR_RS_8P2, 32ULL),
381 OC_EC_8P2GX = OBJ_CLASS_DEF(OR_RS_8P2, MAX_NUM_GROUPS),
382
384 OC_EC_8P3G1 = OBJ_CLASS_DEF(OR_RS_8P3, 1ULL),
385 OC_EC_8P3G2 = OBJ_CLASS_DEF(OR_RS_8P3, 2ULL),
386 OC_EC_8P3G4 = OBJ_CLASS_DEF(OR_RS_8P3, 4ULL),
387 OC_EC_8P3G6 = OBJ_CLASS_DEF(OR_RS_8P3, 6ULL),
388 OC_EC_8P3G8 = OBJ_CLASS_DEF(OR_RS_8P3, 8ULL),
389 OC_EC_8P3G12 = OBJ_CLASS_DEF(OR_RS_8P3, 12ULL),
390 OC_EC_8P3G16 = OBJ_CLASS_DEF(OR_RS_8P3, 16ULL),
391 OC_EC_8P3G32 = OBJ_CLASS_DEF(OR_RS_8P3, 32ULL),
392 OC_EC_8P3GX = OBJ_CLASS_DEF(OR_RS_8P3, MAX_NUM_GROUPS),
393
395 OC_EC_16P1G1 = OBJ_CLASS_DEF(OR_RS_16P1, 1ULL),
396 OC_EC_16P1G2 = OBJ_CLASS_DEF(OR_RS_16P1, 2ULL),
397 OC_EC_16P1G4 = OBJ_CLASS_DEF(OR_RS_16P1, 4ULL),
398 OC_EC_16P1G6 = OBJ_CLASS_DEF(OR_RS_16P1, 6ULL),
399 OC_EC_16P1G8 = OBJ_CLASS_DEF(OR_RS_16P1, 8ULL),
400 OC_EC_16P1G12 = OBJ_CLASS_DEF(OR_RS_16P1, 12ULL),
401 OC_EC_16P1G16 = OBJ_CLASS_DEF(OR_RS_16P1, 16ULL),
402 OC_EC_16P1G32 = OBJ_CLASS_DEF(OR_RS_16P1, 32ULL),
403 OC_EC_16P1GX = OBJ_CLASS_DEF(OR_RS_16P1, MAX_NUM_GROUPS),
404
406 OC_EC_16P2G1 = OBJ_CLASS_DEF(OR_RS_16P2, 1ULL),
407 OC_EC_16P2G2 = OBJ_CLASS_DEF(OR_RS_16P2, 2ULL),
408 OC_EC_16P2G4 = OBJ_CLASS_DEF(OR_RS_16P2, 4ULL),
409 OC_EC_16P2G6 = OBJ_CLASS_DEF(OR_RS_16P2, 6ULL),
410 OC_EC_16P2G8 = OBJ_CLASS_DEF(OR_RS_16P2, 8ULL),
411 OC_EC_16P2G12 = OBJ_CLASS_DEF(OR_RS_16P2, 12ULL),
412 OC_EC_16P2G16 = OBJ_CLASS_DEF(OR_RS_16P2, 16ULL),
413 OC_EC_16P2G32 = OBJ_CLASS_DEF(OR_RS_16P2, 32ULL),
414 OC_EC_16P2GX = OBJ_CLASS_DEF(OR_RS_16P2, MAX_NUM_GROUPS),
415
417 OC_EC_16P3G1 = OBJ_CLASS_DEF(OR_RS_16P3, 1ULL),
418 OC_EC_16P3G2 = OBJ_CLASS_DEF(OR_RS_16P3, 2ULL),
419 OC_EC_16P3G4 = OBJ_CLASS_DEF(OR_RS_16P3, 4ULL),
420 OC_EC_16P3G6 = OBJ_CLASS_DEF(OR_RS_16P3, 6ULL),
421 OC_EC_16P3G8 = OBJ_CLASS_DEF(OR_RS_16P3, 8ULL),
422 OC_EC_16P3G12 = OBJ_CLASS_DEF(OR_RS_16P3, 12ULL),
423 OC_EC_16P3G16 = OBJ_CLASS_DEF(OR_RS_16P3, 16ULL),
424 OC_EC_16P3G32 = OBJ_CLASS_DEF(OR_RS_16P3, 32ULL),
425 OC_EC_16P3GX = OBJ_CLASS_DEF(OR_RS_16P3, MAX_NUM_GROUPS),
426
428 OC_RESERVED = 1 << 30,
429
430};
431
432enum daos_obj_schema {
433 DAOS_OS_SINGLE,
434 DAOS_OS_STRIPED,
435 DAOS_OS_DYN_STRIPED,
436 DAOS_OS_DYN_CHUNKED,
437};
438
439enum daos_obj_resil {
440 DAOS_RES_EC,
441 DAOS_RES_REPL,
442};
443
445 struct daos_oclass_attr {
447 enum daos_obj_schema ca_schema;
449 enum daos_obj_resil ca_resil;
451 unsigned int ca_resil_degree;
453 unsigned int ca_grp_nr;
455 union {
457 struct daos_rp_attr {
459 unsigned int r_proto;
461 unsigned int r_num;
462 } rp;
463
465 struct daos_ec_attr {
467 unsigned short e_k;
469 unsigned short e_p;
471 unsigned int e_len;
472 } ec;
473 } u;
475};
476
478typedef uint32_t daos_oclass_id_t;
480typedef uint16_t daos_oclass_hints_t;
481
483 struct daos_oclass_list {
485 uint32_t cl_nr;
487 uint32_t cl_nr_out;
489 daos_oclass_id_t *cl_cids;
491 struct daos_oclass_attr *cl_cattrs;
492};
493
501int
502daos_oclass_name2id(const char *name);
503
512ssize_t
513daos_oclass_names_list(size_t size, char *str);
514
523int
524daos_oclass_nr(int opts);
525
535int
536daos_oclass_id2name(daos_oclass_id_t oc_id, char *name);
537
557int
558daos_obj_register_class(daos_handle_t coh, daos_oclass_id_t cid,
559 struct daos_oclass_attr *attr, daos_event_t *ev);
560
578int
579daos_obj_query_class(daos_handle_t coh, daos_oclass_id_t cid,
580 struct daos_oclass_attr *attr, daos_event_t *ev);
581
601int
602daos_obj_list_class(daos_handle_t coh, struct daos_oclass_list *list,
603 daos_anchor_t *anchor, daos_event_t *ev);
604
605#if defined(__cplusplus)
606}
607#endif
608
609#endif /* __DAOS_OBJ_CLASS_H__ */
daos_anchor_t
Definition daos_types.h:60
daos_handle_t
Definition daos_types.h:75
daos_oclass_attr
Definition daos_obj_class.h:445
daos_oclass_attr::ca_schema
enum daos_obj_schema ca_schema
Definition daos_obj_class.h:447
daos_oclass_attr::ca_grp_nr
unsigned int ca_grp_nr
Definition daos_obj_class.h:453
daos_oclass_attr::r_num
unsigned int r_num
Definition daos_obj_class.h:461
daos_oclass_attr::e_p
unsigned short e_p
Definition daos_obj_class.h:469
daos_oclass_attr::u
union daos_oclass_attr::@233275204371102027132360240112153245101357101142 u
daos_oclass_attr::ca_resil
enum daos_obj_resil ca_resil
Definition daos_obj_class.h:449
daos_oclass_attr::e_k
unsigned short e_k
Definition daos_obj_class.h:467
daos_oclass_attr::ca_resil_degree
unsigned int ca_resil_degree
Definition daos_obj_class.h:451
daos_oclass_attr::e_len
unsigned int e_len
Definition daos_obj_class.h:471
daos_oclass_attr::r_proto
unsigned int r_proto
Definition daos_obj_class.h:459
daos_oclass_list
Definition daos_obj_class.h:483
daos_oclass_list::cl_nr
uint32_t cl_nr
Definition daos_obj_class.h:485
daos_oclass_list::cl_cattrs
struct daos_oclass_attr * cl_cattrs
Definition daos_obj_class.h:491
daos_oclass_list::cl_nr_out
uint32_t cl_nr_out
Definition daos_obj_class.h:487
daos_oclass_list::cl_cids
daos_oclass_id_t * cl_cids
Definition daos_obj_class.h:489