DAOS API
(v2.1 - dev)
Toggle main menu visibility
Loading...
Searching...
No Matches
daos_types.h
1
9
10
#ifndef DAOS_TYPES_H
11
#define DAOS_TYPES_H
12
13
#if defined(__cplusplus)
14
extern
"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
40
41
typedef
uint64_t daos_size_t;
42
typedef
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
51
typedef
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
60
typedef
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];
66
}
daos_anchor_t
;
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
75
typedef
struct
{
77
uint64_t
cookie
;
78
}
daos_handle_t
;
79
80
#define DAOS_HDL_INVAL ((daos_handle_t){0})
81
#define DAOS_TX_NONE DAOS_HDL_INVAL
82
83
static
inline
bool
84
daos_handle_is_inval(
daos_handle_t
hdl)
85
{
86
return
hdl.
cookie
== 0;
87
}
88
89
static
inline
bool
90
daos_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
114
typedef
uint64_t daos_epoch_t;
115
119
typedef
struct
{
121
daos_epoch_t
epr_lo
;
123
daos_epoch_t
epr_hi
;
124
}
daos_epoch_range_t
;
125
127
#define DAOS_EPOCH_MAX (~0ULL)
128
130
typedef
struct
{
132
uuid_t
ci_uuid
;
134
daos_epoch_t
ci_lsnapshot
;
136
uint32_t
ci_nhandles
;
138
uint32_t
ci_nsnapshots
;
140
uint64_t
ci_md_otime
;
142
uint64_t
ci_md_mtime
;
143
/* TODO: add more members, e.g., size, # objects, uid, gid... */
144
}
daos_cont_info_t
;
145
146
typedef
d_iov_t daos_key_t;
147
148
static
inline
bool
149
daos_key_is_null(daos_key_t key)
150
{
151
return
key.iov_buf_len == 0 || key.iov_buf == NULL;
152
}
153
157
158
typedef
struct
daos_event
{
160
int
ev_error
;
162
struct
{
163
uint64_t space[20];
164
}
ev_private
;
166
uint64_t
ev_debug
;
167
} daos_event_t;
168
170
#define DAOS_EQ_WAIT -1
172
#define DAOS_EQ_NOWAIT 0
173
174
typedef
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
183
typedef
enum
{
184
DAOS_EVS_READY,
185
DAOS_EVS_RUNNING,
186
DAOS_EVS_COMPLETED,
187
DAOS_EVS_ABORTED,
188
} daos_ev_status_t;
189
194
struct
d_tgt_list
{
196
d_rank_t *
tl_ranks
;
198
int32_t *
tl_tgts
;
200
uint32_t
tl_nr
;
201
};
202
203
struct
daos_eq;
204
211
enum
{
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
230
typedef
struct
{
232
uint64_t
lo
;
234
uint64_t
hi
;
235
}
daos_obj_id_t
;
236
237
#define DAOS_UUID_STR_SIZE 37
/* 36 + 1 for '\0' */
238
239
static
inline
bool
240
daos_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
}
263
struct
daos_rank_uri
{
265
uint32_t
dru_rank
;
267
char
*
dru_uri
;
268
};
269
273
struct
daos_sys_info
{
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
;
283
struct
daos_rank_uri
*
dsi_ranks
;
285
uint32_t
dsi_nr_ms_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 */
d_tgt_list
Definition
daos_types.h:194
d_tgt_list::tl_tgts
int32_t * tl_tgts
Definition
daos_types.h:198
d_tgt_list::tl_nr
uint32_t tl_nr
Definition
daos_types.h:200
d_tgt_list::tl_ranks
d_rank_t * tl_ranks
Definition
daos_types.h:196
daos_anchor_t
Definition
daos_types.h:60
daos_anchor_t::da_type
uint16_t da_type
Definition
daos_types.h:61
daos_anchor_t::da_buf
uint8_t da_buf[DAOS_ANCHOR_BUF_MAX]
Definition
daos_types.h:65
daos_anchor_t::da_flags
uint32_t da_flags
Definition
daos_types.h:63
daos_anchor_t::da_shard
uint16_t da_shard
Definition
daos_types.h:62
daos_anchor_t::da_sub_anchors
uint64_t da_sub_anchors
Definition
daos_types.h:64
daos_cont_info_t
Definition
daos_types.h:130
daos_cont_info_t::ci_md_otime
uint64_t ci_md_otime
Definition
daos_types.h:140
daos_cont_info_t::ci_lsnapshot
daos_epoch_t ci_lsnapshot
Definition
daos_types.h:134
daos_cont_info_t::ci_md_mtime
uint64_t ci_md_mtime
Definition
daos_types.h:142
daos_cont_info_t::ci_nhandles
uint32_t ci_nhandles
Definition
daos_types.h:136
daos_cont_info_t::ci_uuid
uuid_t ci_uuid
Definition
daos_types.h:132
daos_cont_info_t::ci_nsnapshots
uint32_t ci_nsnapshots
Definition
daos_types.h:138
daos_epoch_range_t
Definition
daos_types.h:119
daos_epoch_range_t::epr_lo
daos_epoch_t epr_lo
Definition
daos_types.h:121
daos_epoch_range_t::epr_hi
daos_epoch_t epr_hi
Definition
daos_types.h:123
daos_event
Definition
daos_types.h:158
daos_event::ev_error
int ev_error
Definition
daos_types.h:160
daos_event::ev_debug
uint64_t ev_debug
Definition
daos_types.h:166
daos_event::ev_private
struct daos_event::@277125326347062144130016000042162320351057142323 ev_private
daos_handle_t
Definition
daos_types.h:75
daos_handle_t::cookie
uint64_t cookie
Definition
daos_types.h:77
daos_obj_id_t
Definition
daos_types.h:230
daos_obj_id_t::hi
uint64_t hi
Definition
daos_types.h:234
daos_obj_id_t::lo
uint64_t lo
Definition
daos_types.h:232
daos_rank_uri
Definition
daos_types.h:263
daos_rank_uri::dru_uri
char * dru_uri
Definition
daos_types.h:267
daos_rank_uri::dru_rank
uint32_t dru_rank
Definition
daos_types.h:265
daos_sys_info
Definition
daos_types.h:273
daos_sys_info::dsi_nr_ms_ranks
uint32_t dsi_nr_ms_ranks
Definition
daos_types.h:285
daos_sys_info::dsi_ranks
struct daos_rank_uri * dsi_ranks
Definition
daos_types.h:283
daos_sys_info::dsi_nr_ranks
uint32_t dsi_nr_ranks
Definition
daos_types.h:281
daos_sys_info::dsi_system_name
char dsi_system_name[DAOS_SYS_INFO_STRING_MAX+1]
Definition
daos_types.h:275
daos_sys_info::dsi_agent_path
char dsi_agent_path[PATH_MAX]
Definition
daos_types.h:279
daos_sys_info::dsi_fabric_provider
char dsi_fabric_provider[DAOS_SYS_INFO_STRING_MAX+1]
Definition
daos_types.h:277
daos_sys_info::dsi_ms_ranks
uint32_t * dsi_ms_ranks
Definition
daos_types.h:287
src
include
daos_types.h
Generated by
1.17.0