|
Katana Plug-in APIs 0.1
|
00001 #ifndef FnGeolibRuntimeSuite_H 00002 #define FnGeolibRuntimeSuite_H 00003 00004 #include <stdint.h> 00005 #include <FnGeolib/suite/FnGeolibOpSuite.h> 00006 00007 extern "C" { 00008 00011 typedef struct FnGeolibRuntimeStruct * FnGeolibRuntimeHandle; 00012 00015 typedef struct FnGeolibTransactionStruct * FnGeolibTransactionHandle; 00016 00021 typedef int32_t FnGeolibOpId; 00022 00023 #define kFnKatGeolibNullOpId 0 00024 #define kFnKatUUIDStringReprLength 36ul 00025 00028 typedef int32_t FnGeolibClientId; 00029 00032 typedef int32_t FnGeolibCommitId; 00033 00034 #define kFnKatGeolibNoOp "no-op" 00035 00036 typedef int64_t (*FnGeolibWriteToStream)(void *stream, const void *buf, int64_t size); 00037 typedef int64_t (*FnGeolibReadFromStream)(void *stream, void *buf, int64_t size); 00038 00039 #define FnGeolibRuntimeSuite_version 2 00040 00041 enum { 00042 kFnGeolibStatus_OK = 0, 00043 kFnGeolibStatus_InvalidArgument, 00044 }; 00045 typedef int FnGeolibStatus; 00046 00047 typedef void (*FnGeolibCompletionHandler)(FnGeolibStatus status, 00048 const void* response, 00049 int64_t length, 00050 void* context); 00051 00053 #define kFnKatGeoSyncRuntime "runtime-sync" 00054 #define kFnKatGeoSyncWithProfilingRuntime "runtime-sync-prof" 00055 #define kFnKatGeoAsyncRuntime "runtime-async" 00056 #define kFnKatGeoAsyncWithProfilingRuntime "runtime-async-prof" 00057 #define kFnKatGeoConcurrentRuntime "runtime-concurrent" 00058 #define kFnKatGeoConcurrentExperimentalRuntime "runtime-concurrent-experimental" 00059 00064 struct FnGeolibRuntimeSuite_v2 00065 { 00066 FnGeolibRuntimeHandle (*createRuntime)(); 00067 void (*destroyRuntime)(FnGeolibRuntimeHandle handle); 00068 void (*registerOp)(FnGeolibRuntimeHandle handle, const char *opType, 00069 FnGeolibOpSuite_v1 *opSuite); 00070 00071 FnGeolibTransactionHandle (*createTransaction)( 00072 FnGeolibRuntimeHandle handle); 00073 void (*destroyTransaction)(FnGeolibRuntimeHandle handle, 00074 FnGeolibTransactionHandle txn); 00075 00076 FnGeolibOpId (*createOp)(FnGeolibRuntimeHandle handle, 00077 FnGeolibTransactionHandle txn); 00078 void (*retainOp)(FnGeolibRuntimeHandle handle, FnGeolibOpId op); 00079 void (*releaseOp)(FnGeolibRuntimeHandle handle, FnGeolibOpId op); 00080 void (*setOpArgs)(FnGeolibRuntimeHandle handle, 00081 FnGeolibTransactionHandle txn, 00082 FnGeolibOpId op, const char *opType, FnAttributeHandle args); 00083 void (*setOpInputs)(FnGeolibRuntimeHandle handle, 00084 FnGeolibTransactionHandle txn, FnGeolibOpId op, 00085 FnGeolibOpId *inputs, int32_t numInputs); 00086 00087 void (*getOpArgs)(FnGeolibRuntimeHandle handle, FnGeolibOpId op, 00088 const char **opType, FnAttributeHandle *args); 00089 00090 // This returns an int attr, which are PRE-INCREMENTED FnGeolibClientId(s) 00091 // The caller MUST release all returned clients. 00092 FnAttributeHandle (*getOpInputs)(FnGeolibRuntimeHandle handle, 00093 FnGeolibOpId op); 00094 uint8_t (*isValidOp)(FnGeolibRuntimeHandle handle, FnGeolibOpId op); 00095 00096 FnGeolibClientId (*createClient)(FnGeolibRuntimeHandle handle, 00097 FnGeolibTransactionHandle txn); 00098 void (*retainClient)(FnGeolibRuntimeHandle handle, FnGeolibClientId client); 00099 void (*releaseClient)(FnGeolibRuntimeHandle handle, FnGeolibClientId client); 00100 void (*setClientOp)(FnGeolibRuntimeHandle handle, 00101 FnGeolibTransactionHandle txn, 00102 FnGeolibClientId client, FnGeolibOpId op); 00103 00104 /* returns a new reference to the Op, which you are reponsible to release */ 00105 FnGeolibOpId (*getClientOp)(FnGeolibRuntimeHandle handle, FnGeolibClientId client); 00106 00107 FnGeolibCommitId (*commit)(FnGeolibRuntimeHandle handle, 00108 FnGeolibTransactionHandle *transactions, int32_t numTransactions); 00109 00110 FnGeolibCommitId (*getLatestCommitId)(FnGeolibRuntimeHandle handle); 00111 00112 void (*setLocationsOpen)(FnGeolibRuntimeHandle handle, 00113 FnGeolibClientId client, FnAttributeHandle locationPaths); 00114 void (*setLocationsClosed)(FnGeolibRuntimeHandle handle, 00115 FnGeolibClientId client, FnAttributeHandle locationPaths); 00116 void (*setLocationsOpenRecursive)(FnGeolibRuntimeHandle handle, 00117 FnGeolibClientId client, FnAttributeHandle locationPaths, 00118 FnAttributeHandle stopTypes); 00119 void (*setLocationsClosedRecursive)(FnGeolibRuntimeHandle handle, 00120 FnGeolibClientId client, FnAttributeHandle locationPaths); 00121 void (*interruptOpenRecursive)(FnGeolibRuntimeHandle handle, 00122 FnGeolibClientId client); 00123 void (*setLocationsActive)(FnGeolibRuntimeHandle handle, 00124 FnGeolibClientId client, FnAttributeHandle locationPaths); 00125 void (*setLocationsInactive)(FnGeolibRuntimeHandle handle, 00126 FnGeolibClientId client, FnAttributeHandle locationPaths); 00127 FnAttributeHandle (*getOpenLocations)(FnGeolibRuntimeHandle handle, 00128 FnGeolibClientId client, const char *rootLocationPath); 00129 FnAttributeHandle (*getActiveLocations)(FnGeolibRuntimeHandle handle, 00130 FnGeolibClientId client, const char *rootLocationPath); 00131 uint8_t (*isLocationOpen)(FnGeolibRuntimeHandle handle, 00132 FnGeolibClientId client, const char *locationPath); 00133 uint8_t (*isLocationActive)(FnGeolibRuntimeHandle handle, 00134 FnGeolibClientId client, const char *locationPath); 00135 00136 void (*setAllOpen)(FnGeolibRuntimeHandle handle, 00137 FnGeolibClientId client, uint8_t allOpen); 00138 uint8_t (*isAllOpen)(FnGeolibRuntimeHandle handle, 00139 FnGeolibClientId client); 00140 00141 uint8_t (*hasLocationEvents)(FnGeolibRuntimeHandle handle, 00142 FnGeolibClientId client); 00143 FnAttributeHandle (*getLocationEvents)(FnGeolibRuntimeHandle handle, 00144 FnGeolibClientId client, int32_t maxEvents); 00145 void (*setEventCachingEnabled)(FnGeolibRuntimeHandle handle, 00146 FnGeolibClientId client, uint8_t enabled); 00147 uint8_t (*isEventCachingEnabled)(FnGeolibRuntimeHandle handle, 00148 FnGeolibClientId client); 00149 FnAttributeHandle (*getCachedLocation)(FnGeolibRuntimeHandle handle, 00150 FnGeolibClientId client, const char *locationPath); 00151 uint8_t (*isLocationDataCurrent)(FnGeolibRuntimeHandle handle, 00152 FnGeolibClientId client, const char *locationPath, 00153 FnGeolibCommitId commitId); 00154 00155 const char *(*getRootLocationPath)(FnGeolibRuntimeHandle handle); 00156 00157 // location data 00158 FnAttributeHandle (*cookLocation)(FnGeolibRuntimeHandle handle, 00159 FnGeolibClientId client, const char *locationPath); 00160 00161 FnAttributeHandle (*getOptions)(FnGeolibRuntimeHandle handle); 00162 00163 void (*setOptions)(FnGeolibRuntimeHandle handle, 00164 FnAttributeHandle options); 00165 00166 00167 // op tree serialization 00168 uint8_t (*serializeOps)(FnGeolibRuntimeHandle handle, 00169 FnGeolibOpId op, 00170 void *writeStream, FnGeolibWriteToStream writeFunc, 00171 FnAttributeHandle *errorMessage); 00172 00177 FnGeolibOpId (*deserializeOps)(FnGeolibRuntimeHandle handle, 00178 FnGeolibTransactionHandle txn, 00179 void *readStream, FnGeolibReadFromStream readFunc, 00180 FnAttributeHandle *errorMessage); 00181 00182 uint8_t (*isProcessing)(FnGeolibRuntimeHandle handle); 00183 00184 void (*flushCaches)(FnGeolibRuntimeHandle handle); 00185 00186 void (*evict)(FnGeolibRuntimeHandle handle, const char *primaryPathToKeep); 00187 00188 FnAttributeHandle (*describeOp)(FnGeolibRuntimeHandle handle, 00189 const char* opType); 00190 00191 FnAttributeHandle (*getRegisteredOpTypes)(FnGeolibRuntimeHandle handle); 00192 00193 void (*_sendMessageInternal)(FnGeolibRuntimeHandle handle, 00194 const void* payload, 00195 int64_t length, 00196 void* context, 00197 FnGeolibCompletionHandler handler); 00198 00199 void (*retainRuntime)(FnGeolibRuntimeHandle handle); 00200 void (*releaseRuntime)(FnGeolibRuntimeHandle handle); 00201 00203 void (*setNodeName)(FnGeolibRuntimeHandle handle, 00204 FnGeolibTransactionHandle txn, 00205 FnGeolibOpId op, 00206 const char* nodeName); 00207 00211 void (*getNodeName)(FnGeolibRuntimeHandle handle, 00212 FnGeolibOpId op, 00213 const char** nodeName); 00214 00215 void (*finalize)(FnGeolibRuntimeHandle handle); 00216 00218 void (*setNodeType)(FnGeolibRuntimeHandle handle, 00219 FnGeolibTransactionHandle txn, 00220 FnGeolibOpId op, 00221 const char* nodeType); 00222 00226 void (*getNodeType)(FnGeolibRuntimeHandle handle, 00227 FnGeolibOpId op, 00228 const char** nodeType); 00229 00231 void (*setTag)(FnGeolibRuntimeHandle handle, 00232 FnGeolibTransactionHandle txn, 00233 FnGeolibOpId op, 00234 const char* tag); 00235 00237 void (*getTag)(FnGeolibRuntimeHandle handle, FnGeolibOpId op, char* tag); 00238 }; 00239 } 00240 #endif /* FnGeolibRuntimeSuite_H */
1.7.3