rgma.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) Members of the EGEE Collaboration. 2004.
00003  * See http://eu-egee.org/partners/ for details on the copyright holders.
00004  * For license conditions see the license file or http://eu-egee.org/license.html
00005  */
00006 
00007 /* NB. This header retains some old definitions for backwards compatiblity.
00008    To use these old definitions, you need to compile with -DRGMA_V4_COMPAT and
00009    link with the 4.2.0 version of the library. Support for these old
00010    definitions will be removed in the next release. */
00011 
00012 #ifndef RGMA_H
00013 #define RGMA_H
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 #include <stdio.h>  /* for FILE */
00020 
00021 /* GLOBAL CONSTANTS ***********************************************************/
00022 
00023 #define RGMAQueryType_LATEST                  1  /* Latest query type. */
00024 #define RGMAQueryType_HISTORY                 2  /* History query type. */
00025 #define RGMAQueryType_CONTINUOUS              4  /* Continuous query type. */
00026 #define RGMAQueryType_STATIC                  8  /* Static query type. */
00027 #define RGMAQueryType_INTERVAL                16 /* Time-interval modifier. */
00028 
00029 #define RGMAStorageType_MEMORY                0 /* Memory storage type. */
00030 #define RGMAStorageType_FILE                  1 /* deprecated (don't use it) */
00031 #define RGMAStorageType_DATABASE              2 /* Database storage type. */
00032 
00033 #define RGMAProducerProps_LATEST              1 /* Supports latest queries. */
00034 #define RGMAProducerProps_HISTORY             2 /* Supports history queries. */
00035 #define RGMAProducerProps_IGNORESLOWCONSUMERS 4 /* deprecated (don't use it) */
00036 #define RGMAProducerProps_CONTINUOUS          8 /* Supports continuous qs. */
00037 #define RGMAProducerProps_STATIC              16 /* Supports static queries. */
00038 #define RGMAProducerProps_SECONDARYPRODUCER   32 /* Is a Secondary Producer. */
00039 
00040 #define RGMAColumnType_INTEGER                0 /* INTEGER data type. */
00041 #define RGMAColumnType_REAL                   1 /* REAL data type. */
00042 #define RGMAColumnType_DOUBLE                 2 /* DOUBLE data type. */
00043 #define RGMAColumnType_TIMESTAMP              3 /* TIMESTAMP data type. */
00044 #define RGMAColumnType_CHAR                   4 /* CHAR data type. */
00045 #define RGMAColumnType_VARCHAR                5 /* VARCHAR data type. */
00046 #define RGMAColumnType_DATE                   6 /* DATE data type. */
00047 #define RGMAColumnType_TIME                   7 /* TIME data type. */
00048 
00049 #define RGMAResourceType_UNSET                0 /* Unset (not connected). */
00050 #define RGMAResourceType_CONSUMER             1 /* Consumer resource. */
00051 #define RGMAResourceType_PRIMARYPRODUCER      2 /* Primary Producer resource. */
00052 #define RGMAResourceType_SECONDARYPRODUCER    3 /* Secondary Producer res. */
00053 #define RGMAResourceType_ONDEMANDPRODUCER     4 /* On-demand Producer res. */
00054 
00055 #define RGMAService_PRIMARYPRODUCER           0 /* Primary Producer Service */
00056 #define RGMAService_SECONDARYPRODUCER         1 /* Secondary Producer Service */
00057 #define RGMAService_ONDEMANDPRODUCER          2 /* On-demand Producer Service */
00058 #define RGMAService_CONSUMER                  3 /* Consumer Service */
00059 #define RGMAService_REGISTRY                  4 /* Registry Service */
00060 #define RGMAService_SCHEMA                    5 /* Schema Service */
00061 #define RGMAService_MEDIATOR                  6 /* Mediator Service */
00062 
00063 #define RGMA_REMOTEEXCEPTION                  1 /* Service connection error. */
00064 #define RGMA_UNKNOWNRESOURCEEXCEPTION         2 /* No such resource error. */
00065 #define RGMA_APIEXCEPTION                     3 /* deprecated */
00066 #define RGMA_EXCEPTION                        4 /* Other R-GMA error. */
00067 
00068 #define RGMA_UNCLASSIFIEDEXCEPTION            0 /* Sub-exception. */
00069 #define RGMA_SECURITYEXCEPTION                1 /* Sub-exception. */
00070 #define RGMA_USEREXCEPTION                    2 /* Sub-exception. */
00071 #define RGMA_BUFFERFULLEXCEPTION              3 /* Sub-exception. */
00072 
00073 
00074 /* DEPRECATED CONSTANTS *******************************************************/
00075 
00076 #ifdef RGMA_V4_COMPAT
00077 #define RGMAStorageType_VALID(t) ((t) >= 0 && (t) <= 2)  /* deprecated */
00078 #define RGMAColumnType_VALID(t) ((t) >= 0 && (t) <= 7)   /* deprecated */
00079 #define RGMAResourceType_VALID(t) ((t) >= 1 && (t) <= 4) /* deprecated */
00080 #endif /* RGMA_V4_COMPAT */
00081 
00082 
00083 /* GLOBAL TYPE DEFINITIONS ****************************************************/
00084 
00094 typedef struct RGMAResource_S RGMAResource;
00095 
00096 
00105 typedef struct
00106 {      /* Doxygen requires    */
00108         int resourceId;                              /* the comments to     */                      /* precede the fields. */
00110         char *url;                                   
00111 } RGMAResourceEndpoint;
00112 
00113 
00114 #ifndef RGMA_V4_COMPAT /* v5 version */
00115 
00151 typedef struct
00152 {
00154         int errorType;
00156         int errorNumber;
00158         char *errorMessage;
00160         int numSuccessfulOps;
00161 } RGMAException;
00162 #endif /* RGMA_V4_COMPAT */
00163 
00164 
00165 #ifndef RGMA_V4_COMPAT /* v5 version */
00166 
00175 typedef struct
00176 {
00178         char *location;
00180         char *username;
00182         char *password;
00184         char *logicalName;
00185 } RGMAStorageLocation;
00186 #endif /* RGMA_V4_COMPAT */
00187 
00188 
00195 typedef struct
00196 {
00198         int numStrings;
00200         char **string;
00201 } RGMAStringList;
00202 
00203 
00210 typedef struct
00211 {
00213         char **cols;
00214 } RGMARow;
00215 
00216 
00217 #ifndef RGMA_V4_COMPAT /* v5 version */
00218 
00246 typedef struct
00247 {
00249         int numRows;
00251         int numCols;
00253         char **tableNames;
00255         char **columnNames;
00257         int *columnTypes;
00259         RGMARow *rows;
00261         char *warningMessage;
00263         int endOfResults;
00264 } RGMAResultSet;
00265 #endif /* RGMA_V4_COMPAT */
00266 
00267 
00276 typedef struct
00277 {
00279         int type;
00281         char *logicalName;
00283         char *location;
00284 } RGMATupleStore;
00285 
00286 
00294 typedef struct
00295 {
00297         int numTupleStores;
00299         RGMATupleStore *tupleStore;
00300 } RGMATupleStoreList;
00301 
00302 
00306 typedef struct
00307 {
00309         RGMAResourceEndpoint *endpoint;
00311         char *tableName;
00318         int producerType;
00320         int hrpSec;
00322         char *qosAttrib;
00323 } RGMAProducerTableEntry;
00324 
00325 
00333 typedef struct
00334 {
00336         int numProducerTableEntries;
00338         RGMAProducerTableEntry *producerTableEntry;
00339 } RGMAProducerTableEntryList;
00340 
00341 
00345 typedef struct
00346 {
00348         char *indexName;
00350         int numColumns;
00352         char **column;
00353 } RGMAIndex;
00354 
00355 
00363 typedef struct
00364 {
00366         int numIndexes;
00368         RGMAIndex *index;
00369 } RGMAIndexList;
00370 
00371 
00380 typedef struct
00381 {
00383         char *name;
00385         int type;
00387         int size;
00389         int notNull;
00391         int primaryKey;
00392 } RGMAColumnDefinition;
00393 
00394 
00401 typedef struct
00402 {
00404         char *tableName;
00406         int numColumns;
00408         RGMAColumnDefinition *column;
00409 } RGMATableDefinition;
00410 
00411 
00412 /* DEPRECATED TYPE DEFINITIONS ************************************************/
00413 
00414 #ifdef RGMA_V4_COMPAT
00415 
00417 typedef struct RGMAException_S
00418 {
00419         int errorType;
00420         int errorNumber;
00421         char *errorMessage;
00422         struct RGMAException_S *next;
00423 } RGMAException;
00424 
00426 typedef struct RGMAStorageLocation_S
00427 {
00428         char *location;
00429         char *username;
00430         char *password;
00431 } RGMAStorageLocation;
00432 
00434 typedef struct RGMAResultSet_S
00435 {
00436         int numRows;
00437         int numCols;
00438         char **tableNames;
00439         char **columnNames;
00440         int *columnTypes;
00441         RGMARow *rows;
00442         char *warningMessage;
00443 } RGMAResultSet;
00444 
00447 typedef struct RGMATableAuthorization_S
00448 {
00449         int num_rules;
00450         char **rules;
00451 } RGMATableAuthorization;
00452 
00453 #endif /* RGMA_V4_COMPAT */
00454 
00455 
00456 /* PUBLIC FUNCTIONS ***********************************************************/
00457 
00489 extern int RGMA_createConsumer(int terminationInterval, const char *selectStatement, int queryType, int timeInterval, RGMAResource **resourcePP);
00490 
00491 
00492 #ifndef RGMA_V4_COMPAT /* v5 version */
00493 
00520 extern int RGMA_createPrimaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, RGMAResource **resourcePP);
00521 #endif /* RGMA_V4_COMPAT */
00522 
00523 
00524 #ifndef RGMA_V4_COMPAT /* v5 version */
00525 
00552 extern int RGMA_createSecondaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, RGMAResource **resourcePP);
00553 #endif /* RGMA_V4_COMPAT */
00554 
00555 
00556 #ifndef RGMA_V4_COMPAT /* v4 version */
00557 
00576 extern int RGMA_createOnDemandProducer(int terminationInterval, const char *uri, RGMAResource **resourcePP);
00577 #endif /* RGMA_V4_COMPAT */
00578 
00579 
00604 extern int RGMA_reconnect(RGMAResourceEndpoint *endpointP, int resourceType, RGMAResource **resourcePP);
00605 
00606 
00628 extern int RGMAPrimaryProducer_declareTable(RGMAResource *resourceP, const char *tableName, const char *predicate, int hrpSec, int lrpSec);
00629 
00630 
00631 #ifndef RGMA_V4_COMPAT /* v5 version */
00632 
00646 extern int RGMAPrimaryProducer_insert(RGMAResource *resourceP, const char *insertStatement, int lrpSec);
00647 #endif /* RGMA_V4_COMPAT */
00648 
00649 
00650 #ifndef RGMA_V4_COMPAT /* v5 version */
00651 
00667 extern int RGMAPrimaryProducer_insertList(RGMAResource *resourceP, int numInserts, char **insertStatements, int lrpSec);
00668 #endif /* RGMA_V4_COMPAT */
00669 
00670 
00685 extern RGMATupleStoreList *RGMAPrimaryProducer_listTupleStores(RGMAException *exceptionP);
00686 
00687 
00698 extern int RGMAPrimaryProducer_dropTupleStore(const char *logicalName, RGMAException *exceptionP);
00699 
00700 
00712 extern int RGMAPrimaryProducer_getHistoryRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00713 
00714 
00726 extern int RGMAPrimaryProducer_getLatestRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00727 
00728 
00746 extern int RGMASecondaryProducer_declareTable(RGMAResource *resourceP, const char *tableName, const char *predicate, int hrpSec);
00747 
00748 
00763 extern RGMATupleStoreList *RGMASecondaryProducer_listTupleStores(RGMAException *exceptionP);
00764 
00765 
00776 extern int RGMASecondaryProducer_dropTupleStore(const char *logicalName, RGMAException *exceptionP);
00777 
00778 
00790 extern int RGMASecondaryProducer_getHistoryRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00791 
00792 
00808 extern int RGMAOnDemandProducer_declareStaticTable(RGMAResource *resourceP, const char *tableName, const char *predicate);
00809 
00810 
00830 extern int RGMAConsumer_start(RGMAResource *resourceP, int timeoutSec);
00831 
00832 
00851 extern int RGMAConsumer_startDirected(RGMAResource *resourceP, int timeoutSec, int numProducers, RGMAResourceEndpoint *producers);
00852 
00853 
00865 extern int RGMAConsumer_abort(RGMAResource *resourceP);
00866 
00867 
00880 extern int RGMAConsumer_hasAborted(RGMAResource *resourceP);
00881 
00882 
00899 extern RGMAResultSet *RGMAConsumer_pop(RGMAResource *resourceP, int maxCount);
00900 
00901 
00910 extern int RGMA_getTerminationInterval(RGMAResource *resourceP);
00911 
00912 
00923 extern int RGMA_showSignOfLife(RGMAResource *resourceP);
00924 
00925 
00937 extern int RGMA_close(RGMAResource *resourceP);
00938 
00939 
00950 extern int RGMA_destroy(RGMAResource *resourceP);
00951 
00952 
00966 extern int RGMARegistry_createRegistry(const char *vdbName, const char *registryService, RGMAException *exceptionP);
00967 
00968 
00982 extern int RGMARegistry_destroyRegistry(const char *vdbName, const char *registryService, RGMAException *exceptionP);
00983 
00984 
00996 extern RGMAProducerTableEntryList *RGMARegistry_getAllProducersForTable(const char *vdbName, const char *tableName, RGMAException *exceptionP);
00997 
00998 
01012 extern int RGMASchema_createSchema(const char *vdbName, const char *schemaService, RGMAException *exceptionP);
01013 
01014 
01028 extern int RGMASchema_destroySchema(const char *vdbName, const char *schemaService, RGMAException *exceptionP);
01029 
01030 
01046 extern int RGMASchema_createTable(const char *vdbName, const char *createTableStatement, int numRules, char **rules, RGMAException *exceptionP);
01047 
01048 
01059 extern int RGMASchema_dropTable(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01060 
01061 
01074 extern int RGMASchema_createIndex(const char *vdbName, const char *createIndexStatement, RGMAException *exceptionP);
01075 
01076 
01087 extern int RGMASchema_dropIndex(const char *vdbName, const char *indexName, RGMAException *exceptionP);
01088 
01089 
01105 extern int RGMASchema_createView(const char *vdbName, const char *createViewStatement, int numRules, char **rules, RGMAException *exceptionP);
01106 
01107 
01118 extern int RGMASchema_dropView(const char *vdbName, const char *viewName, RGMAException *exceptionP);
01119 
01120 
01134 extern RGMAStringList *RGMASchema_getAllTables(const char *vdbName, RGMAException *exceptionP);
01135 
01136 
01151 extern RGMATableDefinition *RGMASchema_getTableDefinition(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01152 
01153 
01168 extern RGMAIndexList *RGMASchema_getTableIndexes(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01169 
01170 
01186 extern int RGMASchema_setAuthorizationRules(const char *vdbName, const char *tableName, int numRules, char **rules, RGMAException *exceptionP);
01187 
01188 
01204 extern RGMAStringList *RGMASchema_getAuthorizationRules(const char *vdbName, const char *tableName,  RGMAException *exceptionP);
01205 
01206 
01220 extern int RGMA_setProperty(int service, const char *name, const char *parameter, const char *value, RGMAException *exceptionP);
01221 
01222 
01238 extern char *RGMA_getProperty(int service, const char *name, const char *parameter, RGMAException *exceptionP);
01239 
01240 
01259 extern char *RGMA_getVersion(int service, RGMAException *exceptionP);
01260 
01261 
01262 /* THESE REMAINING (PUBLIC) FUNCTIONS ARE HANDLED LOCALLY BY THE API) *********/
01263 
01264 
01276 extern RGMAResourceEndpoint *RGMA_getEndpoint(RGMAResource *resourceP);
01277 
01278 
01290 extern const RGMAException *RGMA_getException(RGMAResource *resourceP);
01291 
01292 
01309 extern char *RGMA_getResultSetValue(RGMAResultSet *rs, int rowNum, int colNum, const char *colName);
01310 
01311 
01323 extern void RGMA_printResultSet(FILE *stream, RGMAResultSet *rs);
01324 
01325 
01338 extern void RGMA_freeResource(RGMAResource *resourceP);
01339 
01340 
01350 extern void RGMA_freeEndpoint(RGMAResourceEndpoint *endpointP);
01351 
01352 
01365 extern void RGMA_freeException(RGMAException *exceptionP);
01366 
01367 
01377 extern void RGMA_freeStringList(RGMAStringList *stringListP);
01378 
01379 
01389 extern void RGMA_freeResultSet(RGMAResultSet *resultSetP);
01390 
01391 
01401 extern void RGMA_freeTupleStoreList(RGMATupleStoreList *tupleStoreListP);
01402 
01403 
01414 extern void RGMA_freeProducerTableEntryList(RGMAProducerTableEntryList *producerTableEntryListP);
01415 
01416 
01426 extern void RGMA_freeIndexList(RGMAIndexList *indexListP);
01427 
01428 
01438 extern void RGMA_freeTableDefinition(RGMATableDefinition *tableDefinitionP);
01439 
01440 
01441 /* DEPRECATED FUNCTIONS *******************************************************/
01442 
01443 #ifdef RGMA_V4_COMPAT
01444 
01446 extern int RGMA_createPrimaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, int numVOs, char **voNames, RGMAResource **resourcePP);
01447 
01449 extern int RGMA_createSecondaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, int numVOs, char **voNames, RGMAResource **resourcePP);
01450 
01452 extern int RGMA_createOnDemandProducer(int terminationInterval, const char *uri, int numVOs, char **voNames, RGMAResource **resourcePP);
01453 
01455 extern int RGMAPrimaryProducer_insert(RGMAResource *resourceP, const char *insertStatement);
01456 
01458 extern int RGMAPrimaryProducer_insertList(RGMAResource *resourceP, int numInserts, char **insertStatements);
01459 
01460 #endif /* RGMA_V4_COMPAT */
01461 
01462 /* isExecuting and count are identical in v4 and v5 */
01463 
01465 extern int RGMAConsumer_isExecuting(RGMAResource *resourceP);
01466 
01468 extern int RGMAConsumer_count(RGMAResource *resourceP);
01469 
01470 /******************************************************************************/
01471 
01472 
01473 #ifdef __cplusplus
01474 }
01475 #endif
01476 
01477 #endif /* RGMA_H */
01478 
01479 /* End of file. */

Generated on Thu May 11 19:24:12 2006 for RGMA C API by doxygen 1.3.5