Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 uint64_t iod_flags;
203 unsigned int iod_nr;
205} daos_iod_t;
206
207typedef struct {
208 char unused; // silence [-Wextern-c-compat]
209} daos_iom_t;
210
211enum {
212 /** Any record size, it is used by fetch */
214};
215
216/// Flags for oclass hints
217enum {
218 // OC Redundancy flags
219 DAOS_OCH_RDD_DEF = (1 << 0), // Default: RF prop
220 // OC Sharding flags
221 DAOS_OCH_SHD_DEF = (1 << 4), // Default: MAX for array & flat KV, else 1
222};
223
225 daos_oclass_hints_t hints, uint32_t args);
226int daos_obj_open(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev);
228int daos_obj_fetch(daos_handle_t oh, daos_handle_t th, uint64_t flags,
229 daos_key_t *dkey, unsigned int nr, daos_iod_t *iods,
230 d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev);
231int daos_obj_update(daos_handle_t oh, daos_handle_t th, uint64_t flags,
232 daos_key_t *dkey, unsigned int nr, daos_iod_t *iods,
233 d_sg_list_t *sgls, daos_event_t *ev);
234
235
236//////////////////////////////////////////////////////////////////////////////// daos_prop.h
237
238/** daos properties, for pool or container */
239typedef struct {
240 char unused; // silence [-Wextern-c-compat]
242
243#define DAOS_PROP_LABEL_MAX_LEN (127)
244#define DAOS_PROP_MAX_LABEL_BUF_LEN (DAOS_PROP_LABEL_MAX_LEN + 1)
245#define DAOS_UUID_STR_SIZE (37) // 36 + 1 for '\0'
246
247static inline bool daos_label_is_valid(const char * /*label*/)
248{
249 return true;
250}
251
252//////////////////////////////////////////////////////////////////////////////// daos_cont.h
253
254
255#define DAOS_COO_RO (1U << 0)
256#define DAOS_COO_RW (1U << 1)
257
258/** Container information */
259typedef struct {
260 uuid_t ci_uuid;
262
263int daos_cont_create_with_label(daos_handle_t poh, const char *label, daos_prop_t *cont_prop, uuid_t *uuid,
264 daos_event_t *ev);
265int daos_cont_open(daos_handle_t poh, const char *uuid, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info,
266 daos_event_t *ev);
268
269//////////////////////////////////////////////////////////////////////////////// daos_pool.h
270
271
272/** Storage pool */
273typedef struct {
274 uuid_t pi_uuid;
276
277int daos_pool_connect(const char *pool, const char *grp, unsigned int flags, daos_handle_t *poh, daos_pool_info_t *info,
278 daos_event_t *ev);
280
281//////////////////////////////////////////////////////////////////////////////// daos_errno.h
282
283#define DER_ERR_GURT_BASE 1000
284#define DER_INVAL (DER_ERR_GURT_BASE + 3)
285#define DER_EXIST (DER_ERR_GURT_BASE + 4)
286
287const char *d_errstr(int rc);
288
289
290//////////////////////////////////////////////////////////////////////////////// daos.h
291
292
293int daos_init(void);
294int daos_fini(void);
295}
296#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)
@ 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
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
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)
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:247
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)
@ DAOS_REC_ANY
Any record size, it is used by fetch.
Definition daos.h:213
struct daos_event daos_event_t
Event and event queue.
static bool daos_otype_t_is_valid(enum daos_otype_t type)
Definition daos.h:172
int daos_eq_create(daos_handle_t *eqh)
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)
@ DAOS_OCH_SHD_DEF
Definition daos.h:221
@ DAOS_OCH_RDD_DEF
Definition daos.h:219
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)
@ DAOS_OO_RW
Definition daos.h:185
@ DAOS_OO_RO
Definition daos.h:184
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)
@ DAOS_COND_DKEY_FETCH
Definition daos.h:178
@ DAOS_COND_AKEY_FETCH
Definition daos.h:179
int daos_fini(void)
int daos_event_parent_barrier(daos_event_t *ev)
uint64_t daos_size_t
Definition daos.h:56
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:259
uuid_t ci_uuid
Definition daos.h:260
Event and event queue.
Definition daos.h:79
struct daos_event::@179 ev_private
int ev_error
Definition daos.h:80
uint64_t space[19]
Definition daos.h:82
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
uint64_t iod_flags
Definition daos.h:202
daos_iod_type_t iod_type
Definition daos.h:200
unsigned int iod_nr
Definition daos.h:203
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:204
char unused
Definition daos.h:208
uint64_t hi
Definition daos.h:147
uint64_t lo
Definition daos.h:146
Storage pool.
Definition daos.h:273
uuid_t pi_uuid
Definition daos.h:274
daos properties, for pool or container
Definition daos.h:239
char unused
Definition daos.h:240
uint64_t rx_nr
Definition daos.h:190
uint64_t rx_idx
Definition daos.h:189