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
13#include <sys/types.h>
14#include <inttypes.h>
15
16#include <daos_types.h>
17
18#define MAX_OBJ_CLASS_NAME_LEN 24
19
20#define MAX_NUM_GROUPS ((1 << 16UL) - 1)
21#define OC_REDUN_SHIFT 24
22#define OBJ_CLASS_DEF(redun, grp_nr) ((redun << OC_REDUN_SHIFT) | grp_nr)
23
28enum daos_obj_redun {
29 OC_UNKNOWN = 0,
30
34 OR_RP_1 = 1,
35
40 OR_RP_2 = 8,
41 OR_RP_3,
42 OR_RP_4,
43 OR_RP_5,
44 OR_RP_6,
45 OR_RP_8,
46 OR_RP_12,
47 OR_RP_16,
48 OR_RP_24,
49 OR_RP_32,
50 OR_RP_48,
51 OR_RP_64,
52 OR_RP_128,
53
66 OR_RS_2P1 = 32,
67 OR_RS_2P2,
68 OR_RS_4P1,
69 OR_RS_4P2,
70 OR_RS_8P1,
71 OR_RS_8P2,
72 OR_RS_16P1,
73 OR_RS_16P2,
74
75 /*
76 * Predefined object classes that can be used directly by the API user.
77 * It describes schema of data distribution & protection.
78 */
83 OC_BACK_COMPAT = 50,
85 OC_TINY,
91 OC_SMALL,
97 OC_LARGE,
103 OC_MAX,
104
112 OC_RP_TINY = 60,
118 OC_RP_SMALL,
124 OC_RP_LARGE,
130 OC_RP_MAX,
131
142 OC_RP_SF_TINY = 70,
148 OC_RP_SF_SMALL,
154 OC_RP_SF_LARGE,
160 OC_RP_SF_MAX,
161
166 OC_RP_XSF = 80,
167
175 OC_EC_TINY = 100,
181 OC_EC_SMALL,
187 OC_EC_LARGE,
193 OC_EC_MAX,
203 OC_S1 = OBJ_CLASS_DEF(OR_RP_1, 1ULL),
204 OC_S2 = OBJ_CLASS_DEF(OR_RP_1, 2ULL),
205 OC_S4 = OBJ_CLASS_DEF(OR_RP_1, 4ULL),
206 OC_S6 = OBJ_CLASS_DEF(OR_RP_1, 6ULL),
207 OC_S8 = OBJ_CLASS_DEF(OR_RP_1, 8ULL),
208 OC_S12 = OBJ_CLASS_DEF(OR_RP_1, 12ULL),
209 OC_S16 = OBJ_CLASS_DEF(OR_RP_1, 16ULL),
210 OC_S32 = OBJ_CLASS_DEF(OR_RP_1, 32ULL),
211 OC_SX = OBJ_CLASS_DEF(OR_RP_1, MAX_NUM_GROUPS),
212
224 OC_RP_2G1 = OBJ_CLASS_DEF(OR_RP_2, 1ULL),
225 OC_RP_2G2 = OBJ_CLASS_DEF(OR_RP_2, 2ULL),
226 OC_RP_2G4 = OBJ_CLASS_DEF(OR_RP_2, 4ULL),
227 OC_RP_2G6 = OBJ_CLASS_DEF(OR_RP_2, 6ULL),
228 OC_RP_2G8 = OBJ_CLASS_DEF(OR_RP_2, 8ULL),
229 OC_RP_2G12 = OBJ_CLASS_DEF(OR_RP_2, 12ULL),
230 OC_RP_2G16 = OBJ_CLASS_DEF(OR_RP_2, 16ULL),
231 OC_RP_2G32 = OBJ_CLASS_DEF(OR_RP_2, 32ULL),
232 OC_RP_2GX = OBJ_CLASS_DEF(OR_RP_2, MAX_NUM_GROUPS),
233
235 OC_RP_3G1 = OBJ_CLASS_DEF(OR_RP_3, 1ULL),
236 OC_RP_3G2 = OBJ_CLASS_DEF(OR_RP_3, 2ULL),
237 OC_RP_3G4 = OBJ_CLASS_DEF(OR_RP_3, 4ULL),
238 OC_RP_3G6 = OBJ_CLASS_DEF(OR_RP_3, 6ULL),
239 OC_RP_3G8 = OBJ_CLASS_DEF(OR_RP_3, 8ULL),
240 OC_RP_3G12 = OBJ_CLASS_DEF(OR_RP_3, 12ULL),
241 OC_RP_3G16 = OBJ_CLASS_DEF(OR_RP_3, 16ULL),
242 OC_RP_3G32 = OBJ_CLASS_DEF(OR_RP_3, 32ULL),
243 OC_RP_3GX = OBJ_CLASS_DEF(OR_RP_3, MAX_NUM_GROUPS),
244
246 OC_RP_4G1 = OBJ_CLASS_DEF(OR_RP_4, 1ULL),
247 OC_RP_4G2 = OBJ_CLASS_DEF(OR_RP_4, 2ULL),
248 OC_RP_4G4 = OBJ_CLASS_DEF(OR_RP_4, 4ULL),
249 OC_RP_4G6 = OBJ_CLASS_DEF(OR_RP_4, 6ULL),
250 OC_RP_4G8 = OBJ_CLASS_DEF(OR_RP_4, 8ULL),
251 OC_RP_4G12 = OBJ_CLASS_DEF(OR_RP_4, 12ULL),
252 OC_RP_4G16 = OBJ_CLASS_DEF(OR_RP_4, 16ULL),
253 OC_RP_4G32 = OBJ_CLASS_DEF(OR_RP_4, 32ULL),
254 OC_RP_4GX = OBJ_CLASS_DEF(OR_RP_4, MAX_NUM_GROUPS),
255
257 OC_RP_5G1 = OBJ_CLASS_DEF(OR_RP_5, 1ULL),
258 OC_RP_5G2 = OBJ_CLASS_DEF(OR_RP_5, 2ULL),
259 OC_RP_5G4 = OBJ_CLASS_DEF(OR_RP_5, 4ULL),
260 OC_RP_5G6 = OBJ_CLASS_DEF(OR_RP_5, 6ULL),
261 OC_RP_5G8 = OBJ_CLASS_DEF(OR_RP_5, 8ULL),
262 OC_RP_5G12 = OBJ_CLASS_DEF(OR_RP_5, 12ULL),
263 OC_RP_5G16 = OBJ_CLASS_DEF(OR_RP_5, 16ULL),
264 OC_RP_5G32 = OBJ_CLASS_DEF(OR_RP_5, 32ULL),
265 OC_RP_5GX = OBJ_CLASS_DEF(OR_RP_5, MAX_NUM_GROUPS),
266
268 OC_RP_6G1 = OBJ_CLASS_DEF(OR_RP_6, 1ULL),
269 OC_RP_6G2 = OBJ_CLASS_DEF(OR_RP_6, 2ULL),
270 OC_RP_6G4 = OBJ_CLASS_DEF(OR_RP_6, 4ULL),
271 OC_RP_6G6 = OBJ_CLASS_DEF(OR_RP_6, 6ULL),
272 OC_RP_6G8 = OBJ_CLASS_DEF(OR_RP_6, 8ULL),
273 OC_RP_6G12 = OBJ_CLASS_DEF(OR_RP_6, 12ULL),
274 OC_RP_6G16 = OBJ_CLASS_DEF(OR_RP_6, 16ULL),
275 OC_RP_6G32 = OBJ_CLASS_DEF(OR_RP_6, 32ULL),
276 OC_RP_6GX = OBJ_CLASS_DEF(OR_RP_6, MAX_NUM_GROUPS),
277
278 /* OC_XSF will map to one of these */
279 OC_RP_12G1 = OBJ_CLASS_DEF(OR_RP_12, 1ULL),
280 OC_RP_16G1 = OBJ_CLASS_DEF(OR_RP_16, 1ULL),
281 OC_RP_24G1 = OBJ_CLASS_DEF(OR_RP_24, 1ULL),
282 OC_RP_32G1 = OBJ_CLASS_DEF(OR_RP_32, 1ULL),
283 OC_RP_48G1 = OBJ_CLASS_DEF(OR_RP_48, 1ULL),
284 OC_RP_64G1 = OBJ_CLASS_DEF(OR_RP_64, 1ULL),
285 OC_RP_128G1 = OBJ_CLASS_DEF(OR_RP_128, 1ULL),
286
300 OC_EC_2P1G1 = OBJ_CLASS_DEF(OR_RS_2P1, 1ULL),
301 OC_EC_2P1G2 = OBJ_CLASS_DEF(OR_RS_2P1, 2ULL),
302 OC_EC_2P1G4 = OBJ_CLASS_DEF(OR_RS_2P1, 4ULL),
303 OC_EC_2P1G6 = OBJ_CLASS_DEF(OR_RS_2P1, 6ULL),
304 OC_EC_2P1G8 = OBJ_CLASS_DEF(OR_RS_2P1, 8ULL),
305 OC_EC_2P1G12 = OBJ_CLASS_DEF(OR_RS_2P1, 12ULL),
306 OC_EC_2P1G16 = OBJ_CLASS_DEF(OR_RS_2P1, 16ULL),
307 OC_EC_2P1G32 = OBJ_CLASS_DEF(OR_RS_2P1, 32ULL),
308 OC_EC_2P1GX = OBJ_CLASS_DEF(OR_RS_2P1, MAX_NUM_GROUPS),
309
311 OC_EC_2P2G1 = OBJ_CLASS_DEF(OR_RS_2P2, 1ULL),
312 OC_EC_2P2G2 = OBJ_CLASS_DEF(OR_RS_2P2, 2ULL),
313 OC_EC_2P2G4 = OBJ_CLASS_DEF(OR_RS_2P2, 4ULL),
314 OC_EC_2P2G6 = OBJ_CLASS_DEF(OR_RS_2P2, 6ULL),
315 OC_EC_2P2G8 = OBJ_CLASS_DEF(OR_RS_2P2, 8ULL),
316 OC_EC_2P2G12 = OBJ_CLASS_DEF(OR_RS_2P2, 12ULL),
317 OC_EC_2P2G16 = OBJ_CLASS_DEF(OR_RS_2P2, 16ULL),
318 OC_EC_2P2G32 = OBJ_CLASS_DEF(OR_RS_2P2, 32ULL),
319 OC_EC_2P2GX = OBJ_CLASS_DEF(OR_RS_2P2, MAX_NUM_GROUPS),
320
322 OC_EC_4P1G1 = OBJ_CLASS_DEF(OR_RS_4P1, 1ULL),
323 OC_EC_4P1G2 = OBJ_CLASS_DEF(OR_RS_4P1, 2ULL),
324 OC_EC_4P1G4 = OBJ_CLASS_DEF(OR_RS_4P1, 4ULL),
325 OC_EC_4P1G6 = OBJ_CLASS_DEF(OR_RS_4P1, 6ULL),
326 OC_EC_4P1G8 = OBJ_CLASS_DEF(OR_RS_4P1, 8ULL),
327 OC_EC_4P1G12 = OBJ_CLASS_DEF(OR_RS_4P1, 12ULL),
328 OC_EC_4P1G16 = OBJ_CLASS_DEF(OR_RS_4P1, 16ULL),
329 OC_EC_4P1G32 = OBJ_CLASS_DEF(OR_RS_4P1, 32ULL),
330 OC_EC_4P1GX = OBJ_CLASS_DEF(OR_RS_4P1, MAX_NUM_GROUPS),
331
333 OC_EC_4P2G1 = OBJ_CLASS_DEF(OR_RS_4P2, 1ULL),
334 OC_EC_4P2G2 = OBJ_CLASS_DEF(OR_RS_4P2, 2ULL),
335 OC_EC_4P2G4 = OBJ_CLASS_DEF(OR_RS_4P2, 4ULL),
336 OC_EC_4P2G6 = OBJ_CLASS_DEF(OR_RS_4P2, 6ULL),
337 OC_EC_4P2G8 = OBJ_CLASS_DEF(OR_RS_4P2, 8ULL),
338 OC_EC_4P2G12 = OBJ_CLASS_DEF(OR_RS_4P2, 12ULL),
339 OC_EC_4P2G16 = OBJ_CLASS_DEF(OR_RS_4P2, 16ULL),
340 OC_EC_4P2G32 = OBJ_CLASS_DEF(OR_RS_4P2, 32ULL),
341 OC_EC_4P2GX = OBJ_CLASS_DEF(OR_RS_4P2, MAX_NUM_GROUPS),
342
344 OC_EC_8P1G1 = OBJ_CLASS_DEF(OR_RS_8P1, 1ULL),
345 OC_EC_8P1G2 = OBJ_CLASS_DEF(OR_RS_8P1, 2ULL),
346 OC_EC_8P1G4 = OBJ_CLASS_DEF(OR_RS_8P1, 4ULL),
347 OC_EC_8P1G6 = OBJ_CLASS_DEF(OR_RS_8P1, 6ULL),
348 OC_EC_8P1G8 = OBJ_CLASS_DEF(OR_RS_8P1, 8ULL),
349 OC_EC_8P1G12 = OBJ_CLASS_DEF(OR_RS_8P1, 12ULL),
350 OC_EC_8P1G16 = OBJ_CLASS_DEF(OR_RS_8P1, 16ULL),
351 OC_EC_8P1G32 = OBJ_CLASS_DEF(OR_RS_8P1, 32ULL),
352 OC_EC_8P1GX = OBJ_CLASS_DEF(OR_RS_8P1, MAX_NUM_GROUPS),
353
355 OC_EC_8P2G1 = OBJ_CLASS_DEF(OR_RS_8P2, 1ULL),
356 OC_EC_8P2G2 = OBJ_CLASS_DEF(OR_RS_8P2, 2ULL),
357 OC_EC_8P2G4 = OBJ_CLASS_DEF(OR_RS_8P2, 4ULL),
358 OC_EC_8P2G6 = OBJ_CLASS_DEF(OR_RS_8P2, 6ULL),
359 OC_EC_8P2G8 = OBJ_CLASS_DEF(OR_RS_8P2, 8ULL),
360 OC_EC_8P2G12 = OBJ_CLASS_DEF(OR_RS_8P2, 12ULL),
361 OC_EC_8P2G16 = OBJ_CLASS_DEF(OR_RS_8P2, 16ULL),
362 OC_EC_8P2G32 = OBJ_CLASS_DEF(OR_RS_8P2, 32ULL),
363 OC_EC_8P2GX = OBJ_CLASS_DEF(OR_RS_8P2, MAX_NUM_GROUPS),
364
366 OC_EC_16P1G1 = OBJ_CLASS_DEF(OR_RS_16P1, 1ULL),
367 OC_EC_16P1G2 = OBJ_CLASS_DEF(OR_RS_16P1, 2ULL),
368 OC_EC_16P1G4 = OBJ_CLASS_DEF(OR_RS_16P1, 4ULL),
369 OC_EC_16P1G6 = OBJ_CLASS_DEF(OR_RS_16P1, 6ULL),
370 OC_EC_16P1G8 = OBJ_CLASS_DEF(OR_RS_16P1, 8ULL),
371 OC_EC_16P1G12 = OBJ_CLASS_DEF(OR_RS_16P1, 12ULL),
372 OC_EC_16P1G16 = OBJ_CLASS_DEF(OR_RS_16P1, 16ULL),
373 OC_EC_16P1G32 = OBJ_CLASS_DEF(OR_RS_16P1, 32ULL),
374 OC_EC_16P1GX = OBJ_CLASS_DEF(OR_RS_16P1, MAX_NUM_GROUPS),
375
377 OC_EC_16P2G1 = OBJ_CLASS_DEF(OR_RS_16P2, 1ULL),
378 OC_EC_16P2G2 = OBJ_CLASS_DEF(OR_RS_16P2, 2ULL),
379 OC_EC_16P2G4 = OBJ_CLASS_DEF(OR_RS_16P2, 4ULL),
380 OC_EC_16P2G6 = OBJ_CLASS_DEF(OR_RS_16P2, 6ULL),
381 OC_EC_16P2G8 = OBJ_CLASS_DEF(OR_RS_16P2, 8ULL),
382 OC_EC_16P2G12 = OBJ_CLASS_DEF(OR_RS_16P2, 12ULL),
383 OC_EC_16P2G16 = OBJ_CLASS_DEF(OR_RS_16P2, 16ULL),
384 OC_EC_16P2G32 = OBJ_CLASS_DEF(OR_RS_16P2, 32ULL),
385 OC_EC_16P2GX = OBJ_CLASS_DEF(OR_RS_16P2, MAX_NUM_GROUPS),
386
388 OC_RESERVED = 1 << 30,
389
390};
391
392enum daos_obj_schema {
393 DAOS_OS_SINGLE,
394 DAOS_OS_STRIPED,
395 DAOS_OS_DYN_STRIPED,
396 DAOS_OS_DYN_CHUNKED,
397};
398
399enum daos_obj_resil {
400 DAOS_RES_EC,
401 DAOS_RES_REPL,
402};
403
407 enum daos_obj_schema ca_schema;
409 enum daos_obj_resil ca_resil;
411 unsigned int ca_resil_degree;
413 unsigned int ca_grp_nr;
415 union {
417 struct daos_rp_attr {
419 unsigned int r_proto;
421 unsigned int r_num;
422 } rp;
423
425 struct daos_ec_attr {
427 unsigned short e_k;
429 unsigned short e_p;
431 unsigned int e_len;
432 } ec;
433 } u;
435};
436
438typedef uint32_t daos_oclass_id_t;
440typedef uint16_t daos_oclass_hints_t;
441
445 uint32_t cl_nr;
447 uint32_t cl_nr_out;
449 daos_oclass_id_t *cl_cids;
452};
453
461int
462daos_oclass_name2id(const char *name);
463
472ssize_t
473daos_oclass_names_list(size_t size, char *str);
474
483int
484daos_oclass_nr(int opts);
485
495int
496daos_oclass_id2name(daos_oclass_id_t oc_id, char *name);
497
517int
518daos_obj_register_class(daos_handle_t coh, daos_oclass_id_t cid,
519 struct daos_oclass_attr *attr, daos_event_t *ev);
520
538int
539daos_obj_query_class(daos_handle_t coh, daos_oclass_id_t cid,
540 struct daos_oclass_attr *attr, daos_event_t *ev);
541
561int
562daos_obj_list_class(daos_handle_t coh, struct daos_oclass_list *list,
563 daos_anchor_t *anchor, daos_event_t *ev);
564
565#if defined(__cplusplus)
566}
567#endif
568
569#endif /* __DAOS_OBJ_CLASS_H__ */
enum daos_obj_schema ca_schema
unsigned int ca_grp_nr
unsigned int r_num
unsigned short e_p
enum daos_obj_resil ca_resil
unsigned short e_k
unsigned int ca_resil_degree
union daos_oclass_attr::@8 u
unsigned int e_len
unsigned int r_proto
struct daos_oclass_attr * cl_cattrs
daos_oclass_id_t * cl_cids