Logo ROOT  
Reference Guide
daos.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2016-2018 Intel Corporation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/**
17 * \file
18 *
19 * This file is a reduced version of `daos_xxx.h` headers that provides (simplified) declarations for use in
20 * libdaos_mock.
21 */
22
23#ifndef __DAOS_H__
24#define __DAOS_H__
25extern "C" {
26
27//////////////////////////////////////////////////////////////////////////////// daos_types.h
28
29#include <stdint.h>
30#include <stdio.h>
31#include <string.h>
32#include <stdbool.h>
33#include <uuid/uuid.h>
34#include <ctype.h>
35
36/** iovec for memory buffer */
37typedef struct {
38 void *iov_buf;
40 size_t iov_len;
41} d_iov_t;
42
43/** Scatter/gather list for memory buffers */
44typedef struct {
45 uint32_t sg_nr;
46 uint32_t sg_nr_out;
49
50static inline void d_iov_set(d_iov_t *iov, void *buf, size_t size)
51{
52 iov->iov_buf = buf;
53 iov->iov_len = iov->iov_buf_len = size;
54}
55
56typedef uint64_t daos_size_t;
57
58/** Generic handle for various DAOS components like container, object, etc. */
59typedef struct {
60 uint64_t cookie;
62
63typedef enum {
65 DAOS_EQR_WAITING = (1 << 1),
68
69#define DAOS_HDL_INVAL ((daos_handle_t){0})
70#define DAOS_TX_NONE DAOS_HDL_INVAL
71
72#define DAOS_PC_RO (1U << 0)
73#define DAOS_PC_RW (1U << 1)
74#define DAOS_PC_EX (1U << 2)
75
77
78/** Event and event queue */
79typedef struct daos_event {
81 struct {
82 uint64_t space[19];
84 uint64_t ev_debug;
86
87/** Wait for completion event forever */
88#define DAOS_EQ_WAIT -1
89/** Always return immediately */
90#define DAOS_EQ_NOWAIT 0
91
92
93//////////////////////////////////////////////////////////////////////////////// daos_event.h
94
96int daos_eq_destroy(daos_handle_t eqh, int flags);
97int daos_eq_poll(daos_handle_t eqh, int wait_running, int64_t timeout, unsigned int nevents, daos_event_t **events);
98
99int daos_event_test(daos_event_t *ev, int64_t timeout, bool *flag);
103
104//////////////////////////////////////////////////////////////////////////////// daos_obj_class.h
105
106
107/** Predefined object classes */
108enum {
110
111 /** Replicated object class which is extremely scalable for fetch. */
113
114 /** Object classes with explicit layout */
115 OC_S1 = 200,
130
131 /** Class ID equal or higher than this is reserved */
132 OC_RESERVED = (1U << 10),
133};
134
135typedef uint16_t daos_oclass_id_t;
136typedef uint16_t daos_oclass_hints_t;
137
138int daos_oclass_name2id(const char *name);
140
141
142//////////////////////////////////////////////////////////////////////////////// daos_obj.h
143
144
145typedef struct {
146 uint64_t lo;
147 uint64_t hi;
149
150#define DAOS_OBJ_NIL ((daos_obj_id_t){0})
151
152#define OID_FMT_INTR_BITS 32 // 32 bits for DAOS internal use
153#define OID_FMT_TYPE_BITS 8
154#define OID_FMT_CLASS_BITS 8
155#define OID_FMT_META_BITS 16
156
157#define OID_FMT_TYPE_SHIFT (64 - OID_FMT_TYPE_BITS)
158#define OID_FMT_CLASS_SHIFT (OID_FMT_TYPE_SHIFT - OID_FMT_CLASS_BITS)
159#define OID_FMT_META_SHIFT (OID_FMT_CLASS_SHIFT - OID_FMT_META_BITS)
160
161/// DAOS object type
163 DAOS_OT_MULTI_HASHED = 0, // default: multi-level KV with hashed [ad]keys
170};
171
173{
174 return type <= DAOS_OT_MAX;
175}
176
177enum {
180};
181
182/** Object open modes */
183enum {
184 DAOS_OO_RO = (1 << 1),
185 DAOS_OO_RW = (1 << 2),
186};
187
188typedef struct {
189 uint64_t rx_idx;
190 uint64_t rx_nr;
192
193/** Type of the value accessed in an IOD */
194typedef enum {
197
198typedef struct {
202 unsigned int iod_nr;
204} daos_iod_t;
205
206typedef struct {
207 char unused; // silence [-Wextern-c-compat]
208} daos_iom_t;
209
210enum {
211 /** Any record size, it is used by fetch */
213};
214
215/// Flags for oclass hints
216enum {
217 // OC Redundancy flags
218 DAOS_OCH_RDD_DEF = (1 << 0), // Default: RF prop
219 // OC Sharding flags
220 DAOS_OCH_SHD_DEF = (1 << 4), // Default: MAX for array & flat KV, else 1
221};
222
224 daos_oclass_hints_t hints, uint32_t args);
225int daos_obj_open(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev);
227int daos_obj_fetch(daos_handle_t oh, daos_handle_t th, uint64_t flags,
228 daos_key_t *dkey, unsigned int nr, daos_iod_t *iods,
229 d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev);
230int daos_obj_update(daos_handle_t oh, daos_handle_t th, uint64_t flags,
231 daos_key_t *dkey, unsigned int nr, daos_iod_t *iods,
232 d_sg_list_t *sgls, daos_event_t *ev);
233
234
235//////////////////////////////////////////////////////////////////////////////// daos_prop.h
236
237/** daos properties, for pool or container */
238typedef struct {
239 char unused; // silence [-Wextern-c-compat]
241
242#define DAOS_PROP_LABEL_MAX_LEN (127)
243#define DAOS_PROP_MAX_LABEL_BUF_LEN (DAOS_PROP_LABEL_MAX_LEN + 1)
244#define DAOS_UUID_STR_SIZE (37) // 36 + 1 for '\0'
245
246static inline bool daos_label_is_valid(const char * /*label*/)
247{
248 return true;
249}
250
251//////////////////////////////////////////////////////////////////////////////// daos_cont.h
252
253
254#define DAOS_COO_RO (1U << 0)
255#define DAOS_COO_RW (1U << 1)
256
257/** Container information */
258typedef struct {
259 uuid_t ci_uuid;
261
262int daos_cont_create_with_label(daos_handle_t poh, const char *label, daos_prop_t *cont_prop, uuid_t *uuid,
263 daos_event_t *ev);
264int daos_cont_open(daos_handle_t poh, const char *uuid, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info,
265 daos_event_t *ev);
267
268//////////////////////////////////////////////////////////////////////////////// daos_pool.h
269
270
271/** Storage pool */
272typedef struct {
273 uuid_t pi_uuid;
275
276int daos_pool_connect(const char *pool, const char *grp, unsigned int flags, daos_handle_t *poh, daos_pool_info_t *info,
277 daos_event_t *ev);
279
280//////////////////////////////////////////////////////////////////////////////// daos_errno.h
281
282#define DER_ERR_GURT_BASE 1000
283#define DER_INVAL (DER_ERR_GURT_BASE + 3)
284#define DER_EXIST (DER_ERR_GURT_BASE + 4)
285
286const char *d_errstr(int rc);
287
288
289//////////////////////////////////////////////////////////////////////////////// daos.h
290
291
292int daos_init(void);
293int daos_fini(void);
294}
295#endif /* __DAOS_H__ */
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition: TGX11.cxx:110
int daos_oclass_id2name(daos_oclass_id_t oc_id, char *name)
const char * d_errstr(int rc)
int daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev)
d_iov_t daos_key_t
Definition: daos.h:76
daos_otype_t
DAOS object type.
Definition: daos.h:162
@ DAOS_OT_MULTI_HASHED
Definition: daos.h:163
@ DAOS_OT_ARRAY_BYTE
Definition: daos.h:168
@ DAOS_OT_MAX
Definition: daos.h:169
@ DAOS_OT_ARRAY
Definition: daos.h:167
@ DAOS_OT_AKEY_UINT64
Definition: daos.h:165
@ DAOS_OT_DKEY_UINT64
Definition: daos.h:164
@ DAOS_OT_MULTI_UINT64
Definition: daos.h:166
int daos_oclass_name2id(const char *name)
daos_eq_query_t
Definition: daos.h:63
@ DAOS_EQR_ALL
Definition: daos.h:66
@ DAOS_EQR_WAITING
Definition: daos.h:65
@ DAOS_EQR_COMPLETED
Definition: daos.h:64
int daos_obj_fetch(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev)
static void d_iov_set(d_iov_t *iov, void *buf, size_t size)
Definition: daos.h:50
@ DAOS_OO_RW
Definition: daos.h:185
@ DAOS_OO_RO
Definition: daos.h:184
int daos_obj_open(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev)
uint16_t daos_oclass_hints_t
Definition: daos.h:136
int daos_pool_connect(const char *pool, const char *grp, unsigned int flags, daos_handle_t *poh, daos_pool_info_t *info, daos_event_t *ev)
int daos_event_fini(daos_event_t *ev)
@ DAOS_REC_ANY
Any record size, it is used by fetch.
Definition: daos.h:212
int daos_init(void)
int daos_obj_generate_oid(daos_handle_t coh, daos_obj_id_t *oid, enum daos_otype_t type, daos_oclass_id_t cid, daos_oclass_hints_t hints, uint32_t args)
int daos_obj_update(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_event_t *ev)
int daos_cont_close(daos_handle_t coh, daos_event_t *ev)
static bool daos_label_is_valid(const char *)
Definition: daos.h:246
uint16_t daos_oclass_id_t
Definition: daos.h:135
int daos_event_init(daos_event_t *ev, daos_handle_t eqh, daos_event_t *parent)
int daos_event_test(daos_event_t *ev, int64_t timeout, bool *flag)
struct daos_event daos_event_t
Event and event queue.
@ DAOS_COND_DKEY_FETCH
Definition: daos.h:178
@ DAOS_COND_AKEY_FETCH
Definition: daos.h:179
static bool daos_otype_t_is_valid(enum daos_otype_t type)
Definition: daos.h:172
int daos_eq_create(daos_handle_t *eqh)
@ DAOS_OCH_SHD_DEF
Definition: daos.h:220
@ DAOS_OCH_RDD_DEF
Definition: daos.h:218
int daos_obj_close(daos_handle_t oh, daos_event_t *ev)
daos_iod_type_t
Type of the value accessed in an IOD.
Definition: daos.h:194
@ DAOS_IOD_SINGLE
Definition: daos.h:195
int daos_cont_create_with_label(daos_handle_t poh, const char *label, daos_prop_t *cont_prop, uuid_t *uuid, daos_event_t *ev)
int daos_eq_destroy(daos_handle_t eqh, int flags)
int daos_eq_poll(daos_handle_t eqh, int wait_running, int64_t timeout, unsigned int nevents, daos_event_t **events)
int daos_cont_open(daos_handle_t poh, const char *uuid, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info, daos_event_t *ev)
int daos_fini(void)
int daos_event_parent_barrier(daos_event_t *ev)
uint64_t daos_size_t
Definition: daos.h:56
@ OC_S32
Definition: daos.h:120
@ OC_S4
Definition: daos.h:117
@ OC_S4K
Definition: daos.h:127
@ OC_S128
Definition: daos.h:122
@ OC_S512
Definition: daos.h:124
@ OC_RESERVED
Class ID equal or higher than this is reserved.
Definition: daos.h:132
@ OC_S256
Definition: daos.h:123
@ OC_S2
Definition: daos.h:116
@ OC_S2K
Definition: daos.h:126
@ OC_SX
Definition: daos.h:129
@ OC_S8
Definition: daos.h:118
@ OC_UNKNOWN
Definition: daos.h:109
@ OC_S16
Definition: daos.h:119
@ OC_S1K
Definition: daos.h:125
@ OC_S8K
Definition: daos.h:128
@ OC_S1
Object classes with explicit layout.
Definition: daos.h:115
@ OC_S64
Definition: daos.h:121
@ OC_RP_XSF
Replicated object class which is extremely scalable for fetch.
Definition: daos.h:112
iovec for memory buffer
Definition: daos.h:37
size_t iov_buf_len
Definition: daos.h:39
void * iov_buf
Definition: daos.h:38
size_t iov_len
Definition: daos.h:40
Scatter/gather list for memory buffers.
Definition: daos.h:44
uint32_t sg_nr_out
Definition: daos.h:46
d_iov_t * sg_iovs
Definition: daos.h:47
uint32_t sg_nr
Definition: daos.h:45
Container information.
Definition: daos.h:258
uuid_t ci_uuid
Definition: daos.h:259
Event and event queue.
Definition: daos.h:79
int ev_error
Definition: daos.h:80
uint64_t space[19]
Definition: daos.h:82
struct daos_event::@190 ev_private
uint64_t ev_debug
Definition: daos.h:84
Generic handle for various DAOS components like container, object, etc.
Definition: daos.h:59
uint64_t cookie
Definition: daos.h:60
daos_iod_type_t iod_type
Definition: daos.h:200
unsigned int iod_nr
Definition: daos.h:202
daos_key_t iod_name
Definition: daos.h:199
daos_size_t iod_size
Definition: daos.h:201
daos_recx_t * iod_recxs
Definition: daos.h:203
char unused
Definition: daos.h:207
uint64_t hi
Definition: daos.h:147
uint64_t lo
Definition: daos.h:146
Storage pool.
Definition: daos.h:272
uuid_t pi_uuid
Definition: daos.h:273
daos properties, for pool or container
Definition: daos.h:238
char unused
Definition: daos.h:239
uint64_t rx_nr
Definition: daos.h:190
uint64_t rx_idx
Definition: daos.h:189