ESDM
Middleware for Earth System Data
esdm-datatypes.h
Go to the documentation of this file.
1 
5 #ifndef ESDM_DATATYPES_H
6 #define ESDM_DATATYPES_H
7 
8 #include <smd.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #define ESDM_MAX_SIZE 1024
15 
16 typedef smd_dtype_t *esdm_type_t;
17 
18 // ESDM Parameters and Status /////////////////////////////////////////////////
19 //
23 typedef enum {
24  ESDM_MODE_FLAG_WRITE = 1,
25  ESDM_MODE_FLAG_READ = 2
27 
28 // where is the data accessible
29 typedef enum data_accessibility_t {
30  ESDM_ACCESSIBILITY_GLOBAL, // shared file system etc.
31  ESDM_ACCESSIBILITY_NODELOCAL
32 } data_accessibility_t;
33 
37 typedef enum esdm_status {
38  ESDM_SUCCESS = 0,
39  ESDM_ERROR, //some unspecific error, used when none of the below fits
40 
41  ESDM_INVALID_ARGUMENT_ERROR,
42  ESDM_INVALID_STATE_ERROR, //returned when the state of an object does not allow the attempted operation
43  ESDM_INVALID_DATA_ERROR, //returned when some input data is in an inconsistent state
44  ESDM_INVALID_PERMISSIONS,
45  ESDM_INCOMPLETE_DATA, //returned when a read requests data that does not exist and no fill-value is set for the dataset
46  ESDM_DIRTY_DATA_ERROR, //attempt to read data from disk that's been modified in memory, the read would discard the in-memory changes
47  ESDM_DELETED_DATA_ERROR //attempt to access data that has been deleted from disk
49 
54  ESDM_LOGLEVEL_NOTSET,
55  ESDM_LOGLEVEL_ERROR,
56  ESDM_LOGLEVEL_WARNING,
57  ESDM_LOGLEVEL_INFO,
58  ESDM_LOGLEVEL_DEBUG
59 };
60 typedef enum esdm_loglevel esdm_loglevel_e;
61 
62 // LOGICAL/DOMAIN DATATYPES ///////////////////////////////////////////////////
63 
64 typedef struct esdm_attr_group_t esdm_attr_group_t;
65 typedef struct esdm_attr_t esdm_attr_t;
66 typedef struct esdm_backend_t esdm_backend_t;
69 typedef struct esdm_container_t esdm_container_t;
70 typedef struct esdm_dataset_iterator_t esdm_dataset_iterator_t;
71 typedef struct esdm_dataset_t esdm_dataset_t;
72 typedef struct esdm_datasets_t esdm_datasets_t;
73 typedef struct esdm_dataspace_t esdm_dataspace_t;
74 typedef struct esdm_fragment_t esdm_fragment_t;
75 typedef struct esdm_grid_t esdm_grid_t;
79 
80 //This needs to be public to allow creating simple dataspaces.
82  esdm_type_t type;
83  int64_t dims;
84  int64_t *size;
85  int64_t *offset;
86  int64_t *strideBacking; //May hold a sufficiently large memory buffer to be used in case that a stride is set. This is used for simple dataspaces which must use a stack based stride.
87  int64_t *stride; //may be NULL, in this case contiguous storage in C order is assumed
88 };
89 
90 //Facilitate creating small dataspace objects on the stack.
91 //To be used with one of the esdm_dataspace_<N>d[o]() constructor macros.
92 typedef struct esdm_simple_dspace_t {
93  esdm_dataspace_t* ptr;
95 
97 
101 typedef struct esdm_statistics_t {
102  uint64_t bytesUser; //the amount of bytes that the user requested to be read/written
103  uint64_t bytesInternal; //the amount of bytes that were read/written due to an internal request
104  uint64_t bytesIo; //the amount of bytes that actually were read/written from/to storage hardware
105  uint64_t requests; //the amount of read/write requests issued by the user
106  uint64_t internalRequests; //the amount of internal read/write requests that were generated
107  uint64_t fragments; //the amount of data object actually read/written from/to storage hardware
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 
115 #endif
esdm_status
Definition: esdm-datatypes.h:37
esdm_loglevel
Definition: esdm-datatypes.h:53
esdm_mode_flags_e
Definition: esdm-datatypes.h:23
struct esdm_statistics_t esdm_statistics_t
Definition: esdm-datatypes-internal.h:123
Definition: esdm-datatypes-internal.h:197
Definition: esdm-datatypes-internal.h:252
Definition: esdm-datatypes-internal.h:41
Definition: esdm-datatypes-internal.h:59
Definition: esdm-datatypes-internal.h:35
Definition: esdm-datatypes.h:81
Definition: esdm-datatypes-internal.h:78
Definition: esdm-grid.c:30
Definition: esdm-grid.c:18
Definition: esdm-datatypes-internal.h:161
Definition: esdm-datatypes-internal.h:209
Definition: esdm-datatypes.h:92
Definition: esdm-datatypes.h:101
Definition: esdm-datatypes-internal.h:16