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

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_types.h
1
9
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
23#include <uuid/uuid.h>
25#include <cart/types.h>
26
27#include <daos_errno.h>
28
30#define DAOS_SYS_NAME_MAX 15
31
33#define DAOS_SYS_INFO_STRING_MAX 63
34
38
39typedef uint64_t daos_size_t;
40typedef uint64_t daos_off_t;
41
42#define crt_proc_daos_key_t crt_proc_d_iov_t
43#define crt_proc_daos_size_t crt_proc_uint64_t
44#define crt_proc_daos_epoch_t crt_proc_uint64_t
45
47#define DAOS_HKEY_MAX 32
48
49typedef enum {
50 DAOS_ANCHOR_TYPE_ZERO = 0,
51 DAOS_ANCHOR_TYPE_HKEY = 1,
52 DAOS_ANCHOR_TYPE_KEY = 2,
53 DAOS_ANCHOR_TYPE_EOF = 3,
54} daos_anchor_type_t;
55
56#define DAOS_ANCHOR_BUF_MAX 104
58 typedef struct {
59 uint16_t da_type;
60 uint16_t da_shard;
61 uint32_t da_flags;
62 uint64_t da_sub_anchors;
63 uint8_t da_buf[DAOS_ANCHOR_BUF_MAX];
64} daos_anchor_t;
65
66#define DAOS_ANCHOR_INIT { .da_type = DAOS_ANCHOR_TYPE_ZERO, \
67 .da_shard = 0, \
68 .da_flags = 0, \
69 .da_sub_anchors = 0, \
70 .da_buf = { 0 } }
71
73 typedef struct {
75 uint64_t cookie;
76} daos_handle_t;
77
78#define DAOS_HDL_INVAL ((daos_handle_t){0})
79#define DAOS_TX_NONE DAOS_HDL_INVAL
80
81static inline bool
82daos_handle_is_inval(daos_handle_t hdl)
83{
84 return hdl.cookie == 0;
85}
86
87static inline bool
88daos_handle_is_valid(daos_handle_t hdl)
89{
90 return !daos_handle_is_inval(hdl);
91}
92
102#define DAOS_PC_RO (1U << 0)
103#define DAOS_PC_RW (1U << 1)
104#define DAOS_PC_EX (1U << 2)
105
106#define DAOS_PC_NBITS 3
107#define DAOS_PC_MASK ((1U << DAOS_PC_NBITS) - 1)
108
112typedef uint64_t daos_epoch_t;
113
117 typedef struct {
119 daos_epoch_t epr_lo;
121 daos_epoch_t epr_hi;
122} daos_epoch_range_t;
123
125#define DAOS_EPOCH_MAX (~0ULL)
126
128 typedef struct {
130 uuid_t ci_uuid;
132 daos_epoch_t ci_lsnapshot;
134 uint32_t ci_nhandles;
136 uint32_t ci_nsnapshots;
138 uint64_t ci_md_otime;
140 uint64_t ci_md_mtime;
141 /* TODO: add more members, e.g., size, # objects, uid, gid... */
142} daos_cont_info_t;
143
144typedef d_iov_t daos_key_t;
145
149
150 typedef struct daos_event {
152 int ev_error;
154 struct {
155 uint64_t space[20];
156 } ev_private;
158 uint64_t ev_debug;
159} daos_event_t;
160
162#define DAOS_EQ_WAIT -1
164#define DAOS_EQ_NOWAIT 0
165
166typedef enum {
168 DAOS_EQR_COMPLETED = (1),
170 DAOS_EQR_WAITING = (1 << 1),
172 DAOS_EQR_ALL = (DAOS_EQR_COMPLETED | DAOS_EQR_WAITING),
173} daos_eq_query_t;
174
175typedef enum {
176 DAOS_EVS_READY,
177 DAOS_EVS_RUNNING,
178 DAOS_EVS_COMPLETED,
179 DAOS_EVS_ABORTED,
180} daos_ev_status_t;
181
186 struct d_tgt_list {
188 d_rank_t *tl_ranks;
190 int32_t *tl_tgts;
192 uint32_t tl_nr;
193};
194
195struct daos_eq;
196
203enum {
204 DAOS_HTYPE_EQ = 1,
205 DAOS_HTYPE_POOL = 3,
206 DAOS_HTYPE_CO = 5,
207 DAOS_HTYPE_OBJ = 7,
208 DAOS_HTYPE_ARRAY = 9,
209 DAOS_HTYPE_TX = 11,
210 DAOS_HTYPE_KV = 13,
211 /* Must enlarge D_HTYPE_BITS to add more types */
212};
213
222 typedef struct {
224 uint64_t lo;
226 uint64_t hi;
227} daos_obj_id_t;
228
232 struct daos_rank_uri {
234 uint32_t dru_rank;
236 char *dru_uri;
237};
238
242 struct daos_sys_info {
244 char dsi_system_name[DAOS_SYS_INFO_STRING_MAX + 1];
246 char dsi_fabric_provider[DAOS_SYS_INFO_STRING_MAX + 1];
248 uint32_t dsi_nr_ranks;
250 struct daos_rank_uri *dsi_ranks;
251};
252
254#define DAOS_ATTR_NAME_MAX 511
255
256#if defined(__cplusplus)
257}
258#endif
259
260#endif /* DAOS_TYPES_H */
d_tgt_list
Definition daos_types.h:186
d_tgt_list::tl_tgts
int32_t * tl_tgts
Definition daos_types.h:190
d_tgt_list::tl_nr
uint32_t tl_nr
Definition daos_types.h:192
d_tgt_list::tl_ranks
d_rank_t * tl_ranks
Definition daos_types.h:188
daos_anchor_t
Definition daos_types.h:58
daos_anchor_t::da_type
uint16_t da_type
Definition daos_types.h:59
daos_anchor_t::da_buf
uint8_t da_buf[DAOS_ANCHOR_BUF_MAX]
Definition daos_types.h:63
daos_anchor_t::da_flags
uint32_t da_flags
Definition daos_types.h:61
daos_anchor_t::da_shard
uint16_t da_shard
Definition daos_types.h:60
daos_anchor_t::da_sub_anchors
uint64_t da_sub_anchors
Definition daos_types.h:62
daos_cont_info_t
Definition daos_types.h:128
daos_cont_info_t::ci_md_otime
uint64_t ci_md_otime
Definition daos_types.h:138
daos_cont_info_t::ci_lsnapshot
daos_epoch_t ci_lsnapshot
Definition daos_types.h:132
daos_cont_info_t::ci_md_mtime
uint64_t ci_md_mtime
Definition daos_types.h:140
daos_cont_info_t::ci_nhandles
uint32_t ci_nhandles
Definition daos_types.h:134
daos_cont_info_t::ci_uuid
uuid_t ci_uuid
Definition daos_types.h:130
daos_cont_info_t::ci_nsnapshots
uint32_t ci_nsnapshots
Definition daos_types.h:136
daos_epoch_range_t
Definition daos_types.h:117
daos_epoch_range_t::epr_lo
daos_epoch_t epr_lo
Definition daos_types.h:119
daos_epoch_range_t::epr_hi
daos_epoch_t epr_hi
Definition daos_types.h:121
daos_event
Definition daos_types.h:150
daos_event::ev_error
int ev_error
Definition daos_types.h:152
daos_event::ev_debug
uint64_t ev_debug
Definition daos_types.h:158
daos_event::ev_private
struct daos_event::@277125326347062144130016000042162320351057142323 ev_private
daos_handle_t
Definition daos_types.h:73
daos_handle_t::cookie
uint64_t cookie
Definition daos_types.h:75
daos_obj_id_t
Definition daos_types.h:222
daos_obj_id_t::hi
uint64_t hi
Definition daos_types.h:226
daos_obj_id_t::lo
uint64_t lo
Definition daos_types.h:224
daos_rank_uri
Definition daos_types.h:232
daos_rank_uri::dru_uri
char * dru_uri
Definition daos_types.h:236
daos_rank_uri::dru_rank
uint32_t dru_rank
Definition daos_types.h:234
daos_sys_info
Definition daos_types.h:242
daos_sys_info::dsi_ranks
struct daos_rank_uri * dsi_ranks
Definition daos_types.h:250
daos_sys_info::dsi_nr_ranks
uint32_t dsi_nr_ranks
Definition daos_types.h:248
daos_sys_info::dsi_system_name
char dsi_system_name[DAOS_SYS_INFO_STRING_MAX+1]
Definition daos_types.h:244
daos_sys_info::dsi_fabric_provider
char dsi_fabric_provider[DAOS_SYS_INFO_STRING_MAX+1]
Definition daos_types.h:246