DAOS API (v2.1 - dev)
Loading...
Searching...
No Matches
daos_types.h
1
10#ifndef DAOS_TYPES_H
11#define DAOS_TYPES_H
12
13#if defined(__cplusplus)
14extern "C" {
15#endif
16
17#include <stdint.h>
18#include <stdio.h>
19#include <string.h>
20#include <stdbool.h>
21#include <ctype.h>
22#include <limits.h>
23
25#include <uuid/uuid.h>
27#include <cart/types.h>
28
29#include <daos_errno.h>
30
32#define DAOS_SYS_NAME_MAX 15
33
35#define DAOS_SYS_INFO_STRING_MAX 63
36
41typedef uint64_t daos_size_t;
42typedef uint64_t daos_off_t;
43
44#define crt_proc_daos_key_t crt_proc_d_iov_t
45#define crt_proc_daos_size_t crt_proc_uint64_t
46#define crt_proc_daos_epoch_t crt_proc_uint64_t
47
49#define DAOS_HKEY_MAX 32
50
51typedef enum {
52 DAOS_ANCHOR_TYPE_ZERO = 0,
53 DAOS_ANCHOR_TYPE_HKEY = 1,
54 DAOS_ANCHOR_TYPE_KEY = 2,
55 DAOS_ANCHOR_TYPE_EOF = 3,
56} daos_anchor_type_t;
57
58#define DAOS_ANCHOR_BUF_MAX 104
60typedef struct {
61 uint16_t da_type;
62 uint16_t da_shard;
63 uint32_t da_flags;
64 uint64_t da_sub_anchors;
65 uint8_t da_buf[DAOS_ANCHOR_BUF_MAX];
67
68#define DAOS_ANCHOR_INIT { .da_type = DAOS_ANCHOR_TYPE_ZERO, \
69 .da_shard = 0, \
70 .da_flags = 0, \
71 .da_sub_anchors = 0, \
72 .da_buf = { 0 } }
73
75typedef struct {
77 uint64_t cookie;
79
80#define DAOS_HDL_INVAL ((daos_handle_t){0})
81#define DAOS_TX_NONE DAOS_HDL_INVAL
82
83static inline bool
84daos_handle_is_inval(daos_handle_t hdl)
85{
86 return hdl.cookie == 0;
87}
88
89static inline bool
90daos_handle_is_valid(daos_handle_t hdl)
91{
92 return !daos_handle_is_inval(hdl);
93}
94
104#define DAOS_PC_RO (1U << 0)
105#define DAOS_PC_RW (1U << 1)
106#define DAOS_PC_EX (1U << 2)
107
108#define DAOS_PC_NBITS 3
109#define DAOS_PC_MASK ((1U << DAOS_PC_NBITS) - 1)
110
114typedef uint64_t daos_epoch_t;
115
119typedef struct {
121 daos_epoch_t epr_lo;
123 daos_epoch_t epr_hi;
125
127#define DAOS_EPOCH_MAX (~0ULL)
128
130typedef struct {
132 uuid_t ci_uuid;
134 daos_epoch_t ci_lsnapshot;
136 uint32_t ci_nhandles;
140 uint64_t ci_md_otime;
142 uint64_t ci_md_mtime;
143 /* TODO: add more members, e.g., size, # objects, uid, gid... */
145
146typedef d_iov_t daos_key_t;
147
148static inline bool
149daos_key_is_null(daos_key_t key)
150{
151 return key.iov_buf_len == 0 || key.iov_buf == NULL;
152}
153
158typedef struct daos_event {
162 struct {
163 uint64_t space[20];
166 uint64_t ev_debug;
168
170#define DAOS_EQ_WAIT -1
172#define DAOS_EQ_NOWAIT 0
173
174typedef enum {
176 DAOS_EQR_COMPLETED = (1),
178 DAOS_EQR_WAITING = (1 << 1),
180 DAOS_EQR_ALL = (DAOS_EQR_COMPLETED | DAOS_EQR_WAITING),
181} daos_eq_query_t;
182
183typedef enum {
184 DAOS_EVS_READY,
185 DAOS_EVS_RUNNING,
186 DAOS_EVS_COMPLETED,
187 DAOS_EVS_ABORTED,
188} daos_ev_status_t;
189
196 d_rank_t *tl_ranks;
198 int32_t *tl_tgts;
200 uint32_t tl_nr;
201};
202
203struct daos_eq;
204
211enum {
212 DAOS_HTYPE_EQ = 1,
213 DAOS_HTYPE_POOL = 3,
214 DAOS_HTYPE_CO = 5,
215 DAOS_HTYPE_OBJ = 7,
216 DAOS_HTYPE_ARRAY = 9,
217 DAOS_HTYPE_TX = 11,
218 DAOS_HTYPE_KV = 13,
219 /* Must enlarge D_HTYPE_BITS to add more types */
220};
221
230typedef struct {
232 uint64_t lo;
234 uint64_t hi;
236
237#define DAOS_UUID_STR_SIZE 37 /* 36 + 1 for '\0' */
238
239static inline bool
240daos_is_valid_uuid_string(const char *uuid)
241{
242 const char *p;
243 int len = DAOS_UUID_STR_SIZE - 1; /* Not include the terminated '\0' */
244 int i;
245
246 if (strnlen(uuid, len) != len)
247 return false;
248
249 for (i = 0, p = uuid; i < len; i++, p++) {
250 if (i == 8 || i == 13 || i == 18 || i == 23) {
251 if (*p != '-')
252 return false;
253 } else if (!isxdigit(*p)) {
254 return false;
255 }
256 }
257
258 return true;
259}
265 uint32_t dru_rank;
267 char *dru_uri;
268};
269
275 char dsi_system_name[DAOS_SYS_INFO_STRING_MAX + 1];
277 char dsi_fabric_provider[DAOS_SYS_INFO_STRING_MAX + 1];
279 char dsi_agent_path[PATH_MAX];
281 uint32_t dsi_nr_ranks;
287 uint32_t *dsi_ms_ranks;
288};
289
291#define DAOS_ATTR_NAME_MAX 511
292
293#if defined(__cplusplus)
294}
295#endif
296
297#endif /* DAOS_TYPES_H */
int32_t * tl_tgts
Definition daos_types.h:198
uint32_t tl_nr
Definition daos_types.h:200
d_rank_t * tl_ranks
Definition daos_types.h:196
uint16_t da_type
Definition daos_types.h:61
uint32_t da_flags
Definition daos_types.h:63
uint16_t da_shard
Definition daos_types.h:62
uint64_t da_sub_anchors
Definition daos_types.h:64
uint64_t ci_md_otime
Definition daos_types.h:140
daos_epoch_t ci_lsnapshot
Definition daos_types.h:134
uint64_t ci_md_mtime
Definition daos_types.h:142
uint32_t ci_nhandles
Definition daos_types.h:136
uint32_t ci_nsnapshots
Definition daos_types.h:138
daos_epoch_t epr_lo
Definition daos_types.h:121
daos_epoch_t epr_hi
Definition daos_types.h:123
struct daos_event::@32 ev_private
uint64_t ev_debug
Definition daos_types.h:166
uint64_t cookie
Definition daos_types.h:77
uint64_t hi
Definition daos_types.h:234
uint64_t lo
Definition daos_types.h:232
uint32_t dru_rank
Definition daos_types.h:265
uint32_t dsi_nr_ms_ranks
Definition daos_types.h:285
struct daos_rank_uri * dsi_ranks
Definition daos_types.h:283
uint32_t dsi_nr_ranks
Definition daos_types.h:281
char dsi_system_name[DAOS_SYS_INFO_STRING_MAX+1]
Definition daos_types.h:275
char dsi_agent_path[PATH_MAX]
Definition daos_types.h:279
char dsi_fabric_provider[DAOS_SYS_INFO_STRING_MAX+1]
Definition daos_types.h:277
uint32_t * dsi_ms_ranks
Definition daos_types.h:287