Liborient is a opensource LGPLv3 C shared library that can be used to interact with OrientDB server. More...
Go to the source code of this file.
Data Structures | |
| struct | orientdb |
| orientdb library object More... | |
| struct | o_ac |
| orient access credentials. More... | |
| struct | o_srv |
| orient server stuff. More... | |
| struct | o_conh |
| the definition of a logic connection handler More... | |
| struct | o_err |
| orientdb library error object More... | |
Defines | |
| #define | O_PORT_BIN "2424" |
| orientdb server binary protocol default TCP port | |
| #define | O_RESOLVE_TIMEOUT_SEC 3 |
| seconds to wait (orient_prepare_connection() will block) resolving name for preparing connection to orientdb server | |
| #define | O_READCHUNK_SIZE 256 |
| default read buffer chunk size per connection | |
| #define | O_WRITECHUNK_SIZE 512 |
| default write buffer chunk size per connection | |
| #define | O_SHUTDOWN 1 |
| SHUTDOWN method. | |
| #define | O_CONNECT 2 |
| CONNECT method. | |
| #define | O_DB_OPEN 3 |
| DB_OPEN method. | |
| #define | O_DB_CREATE 4 |
| DB_CREATE method. | |
| #define | O_DB_CLOSE 5 |
| DB_CLOSE method. | |
| #define | O_DB_EXISTS 6 |
| DB_EXISTS method. | |
| #define | O_DB_DELETE 7 |
| DB_DELETE method. | |
| #define | O_DB_SIZE 8 |
| DB_SIZE method. | |
| #define | O_DB_COUNTRECORDS 9 |
| DB_COUNTRECORDS method. | |
| #define | O_DATACLUSTER_ADD 10 |
| DATACLUSTER_ADD method. | |
| #define | O_DATACLUSTER_REMOVE 11 |
| DATACLUSTER_REMOVE method. | |
| #define | O_DATACLUSTER_COUNT 12 |
| DATACLUSTER_COUNT method. | |
| #define | O_DATACLUSTER_DATARANGE 13 |
| DATACLUSTER_DATARANGE method. | |
| #define | O_DATASEGMENT_ADD 20 |
| DATASEGMENT_ADD method. | |
| #define | O_DATASEGMENT_REMOVE 21 |
| DATASEGMENT_REMOVE method. | |
| #define | O_RECORD_LOAD 30 |
| RECORD_LOAD method. | |
| #define | O_RECORD_CREATE 31 |
| RECORD_CREATE method. | |
| #define | O_RECORD_UPDATE 32 |
| RECORD_UPDATE method. | |
| #define | O_RECORD_DELETE 33 |
| RECORD_DELETE method. | |
| #define | O_COUNT 40 |
| COUNT method. | |
| #define | O_COMMAND 41 |
| COMMAND method. | |
| #define | O_INDEX_LOOKUP 50 |
| INDEX_LOOKUP method. | |
| #define | O_INDEX_PUT 51 |
| INDEX_PUT method. | |
| #define | O_INDEX_REMOVE 52 |
| INDEX_REMOVE method. | |
| #define | O_INDEX_SIZE 53 |
| INDEX_SIZE method. | |
| #define | O_INDEX_KEYS 54 |
| INDEX_KEYS method. | |
| #define | O_TX_COMMIT 60 |
| TX_COMMIT method. | |
| #define | O_CONFIG_GET 70 |
| CONFIG_GET method. | |
| #define | O_CONFIG_SET 71 |
| CONFIG_SET method. | |
| #define | O_CONFIG_LIST 72 |
| CONFIG_LIST method. | |
| #define | ORIENT_PARANOID 9 |
| debug / log level setted to PARANOID | |
| #define | ORIENT_DEBUG 8 |
| debug / log level setted to DEBUG | |
| #define | ORIENT_NOTICE 7 |
| debug / log level setted to NOTICE | |
| #define | ORIENT_INFO 6 |
| debug / log level setted to INFO | |
| #define | ORIENT_NORMAL 5 |
| debug / log level setted to NORMAL | |
| #define | ORIENT_WARNING 4 |
| debug / log level setted to WARNING | |
| #define | ORIENT_CRITICAL 3 |
| debug / log level setted to CRITICAL | |
| #define | ORIENT_FATAL 2 |
| debug / log level setted to FATAL | |
| #define | ORIENT_SILENT 1 |
| debug / log level setted to SILENT | |
| #define | ORIENT_ADMIN 1 |
| orient super user | |
| #define | ORIENT_USER 0 |
| orient user | |
| #define | O_MAX_USERLEN 65 |
| maximum user length. | |
| #define | O_MAX_USERPWD 65 |
| maximum password length. | |
| #define | O_MAX_HOSTLEN 256 |
| maximum hostname length | |
| #define | O_MAX_SERVICELEN 16 |
| maximum service length | |
| #define | O_MAX_RESHOSTLEN 47 |
| maximum resolved host length | |
| #define | ORIENT_PROTO_BINARY 1 |
| Orient BINARY protocol. | |
| #define | ORIENT_PROTO_HTTP 101 |
| Orient HTTP/REST protocol. | |
| #define | O_PROTOCOL_UNSUPPORTED 201 |
| Protocol unknown or unsupported. | |
| #define | O_CONNECTION_NOT_PREPARED 0 |
| Logic connection was not prepared. | |
| #define | O_CONNECTION_PREPARED 1 |
| Logic connection was successfully prepared. | |
| #define | O_CONNECTED 1 |
| Connection is established. | |
| #define | O_NOTCONNECTED -1 |
| Connection is NOT established. | |
| #define | O_CONNECTING 0 |
| Connection is connecting. | |
| #define | O_TIMEOUT -2 |
| Operation was in timeout. | |
| #define | O_ERR_READ 10 |
| Read operation was in error. | |
| #define | O_SUCCESS 20 |
| Operation was in success. | |
| #define | O_DBTYPE_LOCAL 1 |
| Orient persistent (local) database. | |
| #define | O_DBCLUSTER_PHYSICAL 1 |
| Cluster type is physical. | |
| #define | O_DBCLUSTER_LOGICAL 2 |
| Cluster type is logical. | |
| #define | O_DBCLUSTER_MEMORY 3 |
| Cluster type is in memory. | |
Functions | |
| orientdb * | orient_new (void) |
| initialize a new orientdb library handler. | |
| void | orient_free (orientdb *oh) |
| free internal resources acquired by orient_new(). | |
| void | orient_debug_setlevel (orientdb *oh, int level) |
| change the debug level for the given orient object. | |
| void | orient_debug_sethook (orientdb *oh, void *function_pointer) |
| setup a custom callback function for debug. | |
| o_conh * | orient_prepare_connection (orientdb *oh, int protocol, const char *host, const char *service) |
| prepare a new logic orient connection handler. | |
| void | orient_free_connection (orientdb *oh, o_conh *och) |
| free resources allocated by a prepared orient logic connection handler created by a previous call of orient_prepare_connection(). | |
| void | orient_set_credentials (orientdb *oh, o_conh *och, int admin, const char *username, const char *password) |
| set credentials for the given och prepared connection. | |
| unsigned long | orient_connect (orientdb *oh, o_conh *och, struct timeval timeout) |
| create a connection with the OrientDB server. | |
| int | orient_connection_status (orientdb *oh, o_conh *och, unsigned long cid) |
| check the connection status for the given connection ID | |
| void | orient_close (orientdb *oh, o_conh *och, unsigned long id) |
| close a previously opened connection. | |
| int | orient_shutdown_server (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| shutdown the orientdb server (if you have granted permission) | |
| int | orient_dbconnect (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| execute the CONNECT, that put the db in a CONNECTED state allowing you to execute some methods | |
| int | orient_dbopen (orientdb *oh, o_conh *och, unsigned long cid, const char *dbname, struct timeval timeout) |
| open a database to work with | |
| int | orient_dbclose (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| put the database in closed state (DBOPEN or DBCONNECT put it to open state) | |
| int | orient_create_database (orientdb *oh, o_conh *och, unsigned long cid, const char *db_name, int db_type, struct timeval timeout) |
| create a new database | |
| int | orient_db_exists (orientdb *oh, o_conh *och, unsigned long cid, const char *db_name, struct timeval timeout) |
| check if the given database exists (return 0) or not (return 1). | |
| int | orient_db_delete (orientdb *oh, o_conh *och, unsigned long cid, const char *db_name, struct timeval timeout) |
| removes a database from the OrientDB Server instance. | |
| unsigned long | orient_db_size (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| return database size in bytes | |
| unsigned long | orient_db_countrecords (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| Return the number of records for the DB. | |
| int | orient_config_list (orientdb *oh, o_conh *och, unsigned long cid, struct timeval timeout) |
| get the list of configuration parameters | |
| int | orient_add_datacluster (orientdb *oh, o_conh *och, unsigned long cid, int cluster_type, const char *cluster_name, const char *cluster_file, int initial_size, struct timeval timeout) |
| add a new datacluster to the opened database | |
Liborient is a opensource LGPLv3 C shared library that can be used to interact with OrientDB server.
OrientDB (http://www.orientechnologies.com/) is a very fast object and graph database written in Java. We made the effort of writing this library because at that time there was not a C binding for orient.
This is not a program that you can use directly, but it's a shared library that can be used by applications that want to connect to OrientDB using the binary protocol. REST API are not implemented for now.
If you have any questions, please write me a email at: dino@tuxweb.it
NOTE: OrientDB uses a very very very ugly way to avoid breaking things at binary protocol level: make mandatory to client libraries to check the orient magic number. If the library was compiled for a different magic number than the server it cannot be used and the library must be fixed and recompiled with the new magic number. This way, OrientDB BREAKS binary compatibility.
| #define O_MAX_USERLEN 65 |
maximum user length.
A byte is needed for the last NULL byte
| #define O_MAX_USERPWD 65 |
maximum password length.
A byte is needed for the last NULL byte
close a previously opened connection.
You MUST close any connection opened with orient_connect().
create a connection with the OrientDB server.
Connection handler (och) MUST be prepared first. You can call this function many times, if you want to handle more than one connection in parallel. A connection id is returned, or 0 if there was problems creating the handler for the new connection. The returned connection id can be used to evaluate, use and close each connection created with this function.
| int orient_db_delete | ( | orientdb * | oh, | |
| o_conh * | och, | |||
| unsigned long | cid, | |||
| const char * | db_name, | |||
| struct timeval | timeout | |||
| ) |
removes a database from the OrientDB Server instance.
It returns true if has been deleted (non-zero) or false (zero).
| int orient_db_exists | ( | orientdb * | oh, | |
| o_conh * | och, | |||
| unsigned long | cid, | |||
| const char * | db_name, | |||
| struct timeval | timeout | |||
| ) |
check if the given database exists (return 0) or not (return 1).
Return -1 on errors
| void orient_debug_sethook | ( | orientdb * | oh, | |
| void * | function_pointer | |||
| ) |
setup a custom callback function for debug.
function_pointer can be setted to a custom function that will be called anytime there is a debug message for the preimposted level and below
| void orient_debug_setlevel | ( | orientdb * | oh, | |
| int | level | |||
| ) |
change the debug level for the given orient object.
You can set one of the following debug levels: ORIENT_PARANOID, ORIENT_DEBUG, ORIENT_NOTICE, ORIENT_INFO, ORIENT_NORMAL, ORIENT_WARNING, ORIENT_CRITICAL, ORIENT_FATAL, ORIENT_SILENT.
| void orient_free | ( | orientdb * | oh | ) |
free internal resources acquired by orient_new().
You cannot reuse the given handler after calling this function. If you need to you have first to call orient_new() again. The handler is setted to NULL.
| orientdb* orient_new | ( | void | ) |
initialize a new orientdb library handler.
This is the very first function to call before using the library. When finished, the returned handler MUST be freed calling orient_free().
| o_conh* orient_prepare_connection | ( | orientdb * | oh, | |
| int | protocol, | |||
| const char * | host, | |||
| const char * | service | |||
| ) |
prepare a new logic orient connection handler.
We do not create a new physical connection here, but prepare things for it.
1.7.1