ESDM
Middleware for Earth System Data
wos_wrapper.h
1 /* This file is part of ESDM.
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with ESDM. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __WOS_WRAPPER_H
18 #define __WOS_WRAPPER_H
19 
20 using namespace wosapi;
21 
22 extern "C" {
23 
25  WosClusterPtr wos;
26  t_WosClusterPtr(WosClusterPtr w): wos(w) {
27  }
28  t_WosClusterPtr(): wos() {
29  }
30 };
31 
32 struct t_WosStatus {
33  WosStatus wstatus;
34  t_WosStatus(WosStatus ws): wstatus(ws) {
35  }
36  t_WosStatus(): wstatus() {
37  }
38 };
39 
40 struct t_WosOID {
41  WosOID woid;
42  t_WosOID(WosOID wo): woid(wo) {
43  }
44  t_WosOID(): woid() {
45  }
46 };
47 
48 struct t_WosPolicy {
49  WosPolicy wpolicy;
50  t_WosPolicy(WosPolicy wp): wpolicy(wp) {
51  }
52  t_WosPolicy(): wpolicy() {
53  }
54 };
55 
56 struct t_WosObjPtr {
57  WosObjPtr wobj;
58  t_WosObjPtr(WosObjPtr wj): wobj(wj) {
59  }
60  t_WosObjPtr(): wobj() {
61  }
62 };
63 
65  WosPutStreamPtr ps;
66  t_WosPutStreamPtr(WosPutStreamPtr wps): ps(wps) {
67  }
68  t_WosPutStreamPtr(): ps() {
69  }
70 };
71 
73  WosGetStreamPtr gs;
74  t_WosGetStreamPtr(WosGetStreamPtr wgs): gs(wgs) {
75  }
76  t_WosGetStreamPtr(): gs() {
77  }
78 };
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 typedef struct t_WosClusterPtr t_WosClusterPtr;
85 typedef struct t_WosStatus t_WosStatus;
86 typedef struct t_WosOID t_WosOID;
87 typedef struct t_WosPolicy t_WosPolicy;
88 typedef struct t_WosObjPtr t_WosObjPtr;
89 typedef struct t_WosPutStream t_WosPutStream;
90 typedef struct t_WosGetStream t_WosGetStream;
93 typedef struct t_WosClusterImplPtr t_WosClusterImplPtr;
94 
95 enum WosStatusType { ok,
96  error,
97  NoNodeForPolicy = 200,
98  NoNodeForObject = 201,
99  UnknownPolicyName = 202,
100  InternalError = 203,
101  ObjectFrozen = 204,
102  InvalidObjId = 205,
103  NoSpace = 206,
104  ObjNotFound = 207,
105  ObjCorrupted = 208,
106  FsCorrupted = 209,
107  PolicyNotSupported = 210,
108  IOErr = 211,
109  InvalidObjectSize = 212,
110  MissingObject = 213,
111  TemporarilyNotSupported = 214,
112  OutOfMemory = 215,
113  ReservationNotFound = 216,
114  EmptyObject = 217,
115  InvalidMetadataKey = 218,
116  UnusedReservation = 219,
117  WireCorruption = 220,
118  CommandTimeout = 221,
119  InvalidGetSpanMode = 222,
120  PutStreamAbandoned = 223,
121  IncompleteSearchMetadata = 224,
122  InvalidSearchMetadataTextLength = 225,
123  InvalidIntegerSearchMetadata = 226,
124  InvalidRealSearchMetadata = 227,
125  ObjectComplianceReject = 228,
126  InvalidComplianceDate = 229,
127  _max_err_code // insert new errors above this
128 };
129 
130 enum BufferMode {
131  Buffered,
132  Unbuffered
133 };
134 
135 enum IntegrityCheck {
136  IntegrityCheckEnabled,
137  IntegrityCheckDisabled
138 };
139 
140 typedef void *Context;
141 
142 typedef void (*Callback)(t_WosStatus *, t_WosObjPtr *, Context);
143 
144 t_WosClusterPtr *Conn(char *host);
145 
150 
154 void Get_b(t_WosStatus *, const t_WosOID *, t_WosObjPtr *, t_WosClusterPtr *);
155 
159 void Reserve_b(t_WosStatus *, t_WosOID *, t_WosPolicy *, t_WosClusterPtr *);
160 
164 void PutOID_b(t_WosStatus *, const t_WosOID *, t_WosObjPtr *, t_WosClusterPtr *);
165 
169 void Delete_b(t_WosStatus *, const t_WosOID *, t_WosClusterPtr *);
170 
174 void Exists_b(t_WosStatus *, const t_WosOID *, t_WosClusterPtr *);
175 
179 void Put_nb(t_WosObjPtr *, t_WosPolicy *, Callback, Context, t_WosClusterPtr *);
180 
184 void Get_nb(const t_WosOID *, Callback, Context, t_WosClusterPtr *);
185 
189 void Reserve_nb(t_WosPolicy *, Callback, Context, t_WosClusterPtr *);
190 
194 void PutOID_nb(t_WosObjPtr *, const t_WosOID *, Callback, Context, t_WosClusterPtr *);
195 
199 void Delete_nb(const t_WosOID *, Callback, Context, t_WosClusterPtr *);
200 
204 void Exists_nb(const t_WosOID *, Callback, Context, t_WosClusterPtr *);
205 
209 void Wait(t_WosClusterPtr *);
210 
214 t_WosPutStreamPtr *CreatePutStream(t_WosPolicy *, t_WosClusterPtr *);
215 
219 t_WosPutStreamPtr *CreatePutOIDStream(t_WosOID *, t_WosClusterPtr *);
220 
224 t_WosGetStreamPtr *CreateGetStream(t_WosOID *woid, t_WosClusterPtr *wos);
225 
229 void SetMetaStream(const char *key, const char *value, t_WosPutStreamPtr *wps);
230 
234 void PutSpan(t_WosStatus *, const void *, unsigned long int, unsigned long int, t_WosPutStreamPtr *);
235 
236 void ClosePutStream(t_WosStatus *, t_WosOID *, t_WosPutStreamPtr *);
237 
238 void PutSpan_nb(const void *, unsigned long int, unsigned long int, Callback, Context, t_WosPutStreamPtr *);
239 
243 void GetSpan(t_WosStatus *wstatus, t_WosObjPtr *wobj, unsigned long int off, unsigned long int len, t_WosGetStreamPtr *gs);
244 
248 t_WosPolicy *GetPolicy(t_WosClusterPtr *, char *);
249 
253 t_WosObjPtr *WosObjCreate();
254 t_WosOID *CreateWoid();
255 t_WosStatus *CreateStatus();
256 
260 void DeleteWosObj(t_WosObjPtr *);
261 void DeleteWosWoid(t_WosOID *);
262 void DeleteWosStatus(t_WosStatus *);
263 void DeleteWosPolicy(t_WosPolicy *);
264 void DeleteWosCluster(t_WosClusterPtr *);
265 void DeletePutStream(t_WosPutStreamPtr *);
266 
270 t_WosObjPtr *WosObjHookCreate();
271 
276 void SetMetaObj(const char *, const char *, t_WosObjPtr *);
277 void SetDataObj(const void *, int, t_WosObjPtr *);
278 void GetDataObj(const void **, int *, const t_WosObjPtr *);
279 void GetMetaObj(const char *, char **, const t_WosObjPtr *);
280 
281 t_WosOID *GetOidObj(t_WosObjPtr *);
282 const char *OIDtoString(t_WosOID *);
283 void SetOID(t_WosOID *woid, const char *oid);
284 
288 int GetStatus(const t_WosStatus *);
289 
293 void CatchError(const t_WosStatus *);
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 #endif
Definition: wos_wrapper.h:24
Definition: wos_wrapper.h:72
Definition: wos_wrapper.h:40
Definition: wos_wrapper.h:56
Definition: wos_wrapper.h:48
Definition: wos_wrapper.h:64
Definition: wos_wrapper.h:32