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 #define RGMA_NOWORKINGREPLICASEXCEPTION           7 /* Sub-exception. */
00073 #define RGMA_BUSYEXCEPTION                                        9 /* Sub-exception. */
00074 
00075 /* DEPRECATED CONSTANTS *******************************************************/
00076 
00077 #ifdef RGMA_V4_COMPAT
00078 #define RGMAStorageType_VALID(t) ((t) >= 0 && (t) <= 2)  /* deprecated */
00079 #define RGMAColumnType_VALID(t) ((t) >= 0 && (t) <= 7)   /* deprecated */
00080 #define RGMAResourceType_VALID(t) ((t) >= 1 && (t) <= 4) /* deprecated */
00081 #endif /* RGMA_V4_COMPAT */
00082 
00083 
00084 /* GLOBAL TYPE DEFINITIONS ****************************************************/
00085 
00095 typedef struct RGMAResource_S RGMAResource;
00096 
00097 
00106 typedef struct
00107 {      /* Doxygen requires    */
00109         int resourceId;                              /* the comments to     */                      /* precede the fields. */
00111         char *url;                                   
00112 } RGMAResourceEndpoint;
00113 
00114 
00115 #ifndef RGMA_V4_COMPAT /* v5 version */
00116 
00152 typedef struct
00153 {
00155         int errorType;
00157         int errorNumber;
00159         char *errorMessage;
00161         int numSuccessfulOps;
00162 } RGMAException;
00163 #endif /* RGMA_V4_COMPAT */
00164 
00165 
00166 #ifndef RGMA_V4_COMPAT /* v5 version */
00167 
00176 typedef struct
00177 {
00179         char *location;
00181         char *username;
00183         char *password;
00185         char *logicalName;
00186 } RGMAStorageLocation;
00187 #endif /* RGMA_V4_COMPAT */
00188 
00189 
00196 typedef struct
00197 {
00199         int numStrings;
00201         char **string;
00202 } RGMAStringList;
00203 
00204 
00211 typedef struct
00212 {
00214         char **cols;
00215 } RGMARow;
00216 
00217 
00218 #ifndef RGMA_V4_COMPAT /* v5 version */
00219 
00247 typedef struct
00248 {
00250         int numRows;
00252         int numCols;
00254         char **tableNames;
00256         char **columnNames;
00258         int *columnTypes;
00260         RGMARow *rows;
00262         char *warningMessage;
00264         int endOfResults;
00265 } RGMAResultSet;
00266 #endif /* RGMA_V4_COMPAT */
00267 
00268 
00277 typedef struct
00278 {
00280         int type;
00282         char *logicalName;
00284         char *location;
00285 } RGMATupleStore;
00286 
00287 
00295 typedef struct
00296 {
00298         int numTupleStores;
00300         RGMATupleStore *tupleStore;
00301 } RGMATupleStoreList;
00302 
00303 
00307 typedef struct
00308 {
00310         RGMAResourceEndpoint *endpoint;
00312         char *tableName;
00319         int producerType;
00321         int hrpSec;
00323         char *qosAttrib;
00324 } RGMAProducerTableEntry;
00325 
00326 
00334 typedef struct
00335 {
00337         int numProducerTableEntries;
00339         RGMAProducerTableEntry *producerTableEntry;
00340 } RGMAProducerTableEntryList;
00341 
00342 
00346 typedef struct
00347 {
00349         char *indexName;
00351         int numColumns;
00353         char **column;
00354 } RGMAIndex;
00355 
00356 
00364 typedef struct
00365 {
00367         int numIndexes;
00369         RGMAIndex *index;
00370 } RGMAIndexList;
00371 
00372 
00381 typedef struct
00382 {
00384         char *name;
00386         int type;
00388         int size;
00390         int notNull;
00392         int primaryKey;
00393 } RGMAColumnDefinition;
00394 
00395 
00402 typedef struct
00403 {
00405         char *tableName;
00407         int numColumns;
00409         RGMAColumnDefinition *column;
00410 } RGMATableDefinition;
00411 
00412 
00413 /* DEPRECATED TYPE DEFINITIONS ************************************************/
00414 
00415 #ifdef RGMA_V4_COMPAT
00416 
00418 typedef struct RGMAException_S
00419 {
00420         int errorType;
00421         int errorNumber;
00422         char *errorMessage;
00423         struct RGMAException_S *next;
00424 } RGMAException;
00425 
00427 typedef struct RGMAStorageLocation_S
00428 {
00429         char *location;
00430         char *username;
00431         char *password;
00432 } RGMAStorageLocation;
00433 
00435 typedef struct RGMAResultSet_S
00436 {
00437         int numRows;
00438         int numCols;
00439         char **tableNames;
00440         char **columnNames;
00441         int *columnTypes;
00442         RGMARow *rows;
00443         char *warningMessage;
00444 } RGMAResultSet;
00445 
00448 typedef struct RGMATableAuthorization_S
00449 {
00450         int num_rules;
00451         char **rules;
00452 } RGMATableAuthorization;
00453 
00454 #endif /* RGMA_V4_COMPAT */
00455 
00456 
00457 /* PUBLIC FUNCTIONS ***********************************************************/
00458 
00490 extern int RGMA_createConsumer(int terminationInterval, const char *selectStatement, int queryType, int timeInterval, RGMAResource **resourcePP);
00491 
00492 
00493 #ifndef RGMA_V4_COMPAT /* v5 version */
00494 
00521 extern int RGMA_createPrimaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, RGMAResource **resourcePP);
00522 #endif /* RGMA_V4_COMPAT */
00523 
00524 
00525 #ifndef RGMA_V4_COMPAT /* v5 version */
00526 
00553 extern int RGMA_createSecondaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, RGMAResource **resourcePP);
00554 #endif /* RGMA_V4_COMPAT */
00555 
00556 
00557 #ifndef RGMA_V4_COMPAT /* v4 version */
00558 
00577 extern int RGMA_createOnDemandProducer(int terminationInterval, const char *uri, RGMAResource **resourcePP);
00578 #endif /* RGMA_V4_COMPAT */
00579 
00580 
00605 extern int RGMA_reconnect(RGMAResourceEndpoint *endpointP, int resourceType, RGMAResource **resourcePP);
00606 
00607 
00629 extern int RGMAPrimaryProducer_declareTable(RGMAResource *resourceP, const char *tableName, const char *predicate, int hrpSec, int lrpSec);
00630 
00631 
00632 #ifndef RGMA_V4_COMPAT /* v5 version */
00633 
00647 extern int RGMAPrimaryProducer_insert(RGMAResource *resourceP, const char *insertStatement, int lrpSec);
00648 #endif /* RGMA_V4_COMPAT */
00649 
00650 
00651 #ifndef RGMA_V4_COMPAT /* v5 version */
00652 
00668 extern int RGMAPrimaryProducer_insertList(RGMAResource *resourceP, int numInserts, char **insertStatements, int lrpSec);
00669 #endif /* RGMA_V4_COMPAT */
00670 
00671 
00686 extern RGMATupleStoreList *RGMAPrimaryProducer_listTupleStores(RGMAException *exceptionP);
00687 
00688 
00699 extern int RGMAPrimaryProducer_dropTupleStore(const char *logicalName, RGMAException *exceptionP);
00700 
00701 
00713 extern int RGMAPrimaryProducer_getHistoryRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00714 
00715 
00727 extern int RGMAPrimaryProducer_getLatestRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00728 
00729 
00747 extern int RGMASecondaryProducer_declareTable(RGMAResource *resourceP, const char *tableName, const char *predicate, int hrpSec);
00748 
00749 
00764 extern RGMATupleStoreList *RGMASecondaryProducer_listTupleStores(RGMAException *exceptionP);
00765 
00766 
00777 extern int RGMASecondaryProducer_dropTupleStore(const char *logicalName, RGMAException *exceptionP);
00778 
00779 
00791 extern int RGMASecondaryProducer_getHistoryRetentionPeriod(RGMAResource *resourceP, const char *tableName);
00792 
00793 
00809 extern int RGMAOnDemandProducer_declareStaticTable(RGMAResource *resourceP, const char *tableName, const char *predicate);
00810 
00811 
00831 extern int RGMAConsumer_start(RGMAResource *resourceP, int timeoutSec);
00832 
00833 
00852 extern int RGMAConsumer_startDirected(RGMAResource *resourceP, int timeoutSec, int numProducers, RGMAResourceEndpoint *producers);
00853 
00854 
00866 extern int RGMAConsumer_abort(RGMAResource *resourceP);
00867 
00868 
00881 extern int RGMAConsumer_hasAborted(RGMAResource *resourceP);
00882 
00883 
00900 extern RGMAResultSet *RGMAConsumer_pop(RGMAResource *resourceP, int maxCount);
00901 
00902 
00911 extern int RGMA_getTerminationInterval(RGMAResource *resourceP);
00912 
00913 
00924 extern int RGMA_showSignOfLife(RGMAResource *resourceP);
00925 
00926 
00938 extern int RGMA_close(RGMAResource *resourceP);
00939 
00940 
00951 extern int RGMA_destroy(RGMAResource *resourceP);
00952 
00953 
00967 extern int RGMARegistry_createRegistry(const char *vdbName, const char *registryService, RGMAException *exceptionP);
00968 
00969 
00983 extern int RGMARegistry_destroyRegistry(const char *vdbName, const char *registryService, RGMAException *exceptionP);
00984 
00985 
00997 extern RGMAProducerTableEntryList *RGMARegistry_getAllProducersForTable(const char *vdbName, const char *tableName, RGMAException *exceptionP);
00998 
00999 
01013 extern int RGMASchema_createSchema(const char *vdbName, const char *schemaService, RGMAException *exceptionP);
01014 
01015 
01029 extern int RGMASchema_destroySchema(const char *vdbName, const char *schemaService, RGMAException *exceptionP);
01030 
01031 
01047 extern int RGMASchema_createTable(const char *vdbName, const char *createTableStatement, int numRules, char **rules, RGMAException *exceptionP);
01048 
01049 
01060 extern int RGMASchema_dropTable(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01061 
01062 
01075 extern int RGMASchema_createIndex(const char *vdbName, const char *createIndexStatement, RGMAException *exceptionP);
01076 
01077 
01088 extern int RGMASchema_dropIndex(const char *vdbName, const char *indexName, RGMAException *exceptionP);
01089 
01090 
01106 extern int RGMASchema_createView(const char *vdbName, const char *createViewStatement, int numRules, char **rules, RGMAException *exceptionP);
01107 
01108 
01119 extern int RGMASchema_dropView(const char *vdbName, const char *viewName, RGMAException *exceptionP);
01120 
01121 
01135 extern RGMAStringList *RGMASchema_getAllTables(const char *vdbName, RGMAException *exceptionP);
01136 
01137 
01152 extern RGMATableDefinition *RGMASchema_getTableDefinition(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01153 
01154 
01169 extern RGMAIndexList *RGMASchema_getTableIndexes(const char *vdbName, const char *tableName, RGMAException *exceptionP);
01170 
01171 
01187 extern int RGMASchema_setAuthorizationRules(const char *vdbName, const char *tableName, int numRules, char **rules, RGMAException *exceptionP);
01188 
01189 
01205 extern RGMAStringList *RGMASchema_getAuthorizationRules(const char *vdbName, const char *tableName,  RGMAException *exceptionP);
01206 
01207 
01221 extern int RGMA_setProperty(int service, const char *name, const char *parameter, const char *value, RGMAException *exceptionP);
01222 
01223 
01239 extern char *RGMA_getProperty(int service, const char *name, const char *parameter, RGMAException *exceptionP);
01240 
01241 
01260 extern char *RGMA_getVersion(int service, RGMAException *exceptionP);
01261 
01262 
01263 /* THESE REMAINING (PUBLIC) FUNCTIONS ARE HANDLED LOCALLY BY THE API) *********/
01264 
01265 
01277 extern RGMAResourceEndpoint *RGMA_getEndpoint(RGMAResource *resourceP);
01278 
01279 
01291 extern const RGMAException *RGMA_getException(RGMAResource *resourceP);
01292 
01293 
01310 extern char *RGMA_getResultSetValue(RGMAResultSet *rs, int rowNum, int colNum, const char *colName);
01311 
01312 
01324 extern void RGMA_printResultSet(FILE *stream, RGMAResultSet *rs);
01325 
01326 
01339 extern void RGMA_freeResource(RGMAResource *resourceP);
01340 
01341 
01351 extern void RGMA_freeEndpoint(RGMAResourceEndpoint *endpointP);
01352 
01353 
01366 extern void RGMA_freeException(RGMAException *exceptionP);
01367 
01368 
01378 extern void RGMA_freeStringList(RGMAStringList *stringListP);
01379 
01380 
01390 extern void RGMA_freeResultSet(RGMAResultSet *resultSetP);
01391 
01392 
01402 extern void RGMA_freeTupleStoreList(RGMATupleStoreList *tupleStoreListP);
01403 
01404 
01415 extern void RGMA_freeProducerTableEntryList(RGMAProducerTableEntryList *producerTableEntryListP);
01416 
01417 
01427 extern void RGMA_freeIndexList(RGMAIndexList *indexListP);
01428 
01429 
01439 extern void RGMA_freeTableDefinition(RGMATableDefinition *tableDefinitionP);
01440 
01441 
01442 /* DEPRECATED FUNCTIONS *******************************************************/
01443 
01444 #ifdef RGMA_V4_COMPAT
01445 
01447 extern int RGMA_createPrimaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, int numVOs, char **voNames, RGMAResource **resourcePP);
01448 
01450 extern int RGMA_createSecondaryProducer(int terminationInterval, int properties, int storageType, RGMAStorageLocation *storageLocation, int numVOs, char **voNames, RGMAResource **resourcePP);
01451 
01453 extern int RGMA_createOnDemandProducer(int terminationInterval, const char *uri, int numVOs, char **voNames, RGMAResource **resourcePP);
01454 
01456 extern int RGMAPrimaryProducer_insert(RGMAResource *resourceP, const char *insertStatement);
01457 
01459 extern int RGMAPrimaryProducer_insertList(RGMAResource *resourceP, int numInserts, char **insertStatements);
01460 
01461 #endif /* RGMA_V4_COMPAT */
01462 
01463 /* isExecuting and count are identical in v4 and v5 */
01464 
01466 extern int RGMAConsumer_isExecuting(RGMAResource *resourceP);
01467 
01469 extern int RGMAConsumer_count(RGMAResource *resourceP);
01470 
01471 /******************************************************************************/
01472 
01473 
01474 #ifdef __cplusplus
01475 }
01476 #endif
01477 
01478 #endif /* RGMA_H */
01479 
01480 /* End of file. */

Generated on Wed Apr 25 19:11:54 2007 for RGMA C API by doxygen 1.3.5