Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

pbs_db_conn_t: Structure used to maintain the database connection information. All elements of this structure are generic and are not bound to any particular database.

Code Block
struct pbs_db_connection {
      void    *conn_db_handle;      /* opaque database handle  */
      int     conn_state;           /* Database connection status */
      int     conn_db_state;        /* Databese states, db up? down? starting? */
}
typedef struct pbs_db_connection pbs_db_conn_t;

/* Values for conn_state */
#define PBS_DB_CONNECT_STATE_NOT_CONNECTED  1 /* Not connected to the db */
#define PBS_DB_CONNECT_STATE_CONNECTING	    2 /* Connecting to the db */
#define PBS_DB_CONNECT_STATE_CONNECTED      3 /* Connected to the db */
#define PBS_DB_CONNECT_STATE_FAILED         4 /* Coonection to db failed */

/* Values for conn_db_state */
#define PBS_DB_DOWN		1  /* Database is down */
#define PBS_DB_STARTING		2  /* Database is starting */
#define PBS_DB_STARTED		3 *conn_db_handle;      /* Databaseopaque database ishandle up */

pbs_db_obj_info_t: Wrapper object structure. It contains a pointer to one of the several database structures. Most of the database manipulation/query functions take this structure as a parameter. Depending on the contained structure type, an appropriate internal database manipulation/query function is eventually called. This allows keeping the interface simpler and generic.

...

Description: Setup a persistent database connection for further use by APIs which will work on PBS objects. On success return the connection information.

Signature:

(int pbs_db_connect(void *conn_t *) pbs_db_connect(handle, char *pbs_ds_host, int pbs_ds_port, int timeout)

Parameters::

conn_db_handle[out]: This pointer will have connection information for the database on successfull connection.

pbs_data_service_host[in]: Hostname information where the database is running.

...

timeout[in]: Timeout in seconds before the API will return if it is taking too long to connect.

Returns:  Pointer to the initialized connection structure of type (pbs_db_conn_t *)

...

Error code

0: On successful connection setup to the database.

NULL!0: On connection failure.

1.2.3. pbs_db_disconnect

Description: Disconnect the PBS server from a database connection.

Signature:

int pbs_db_disconnect(pbsvoid *conn_db_conn_t *connhandle)

Parameters:

conn_db_handle[in]: Connection structure with connection handler to the database which was created by pbs_db_connectionconnect.

Returns: Returns status of the disconnection.

0 - for successful database disconnect.

-1 - for failure

1.2.4. pbs_db_save_obj

...

Signature:

int pbs_db_save_obj(pbsvoid *conn_db_conn_t *connhandle, pbs_db_obj_info_t *obj, int savetype)

Parameters:

conn_db_handle[in]:The database connnection handle Connection handler to the database which was created by pbs_db_connectionconnect.

obj[in]: The PBS object to save. Based on the type defined within obj structure, right PBS object will be picked and dealt with.

...

Signature:

int pbs_db_delete_obj(pbsvoid *conn_db_conn_t *connhandle, pbs_db_obj_info_t *obj)

Parameters:

conn_db_handle[in]:The database connection handle Connection handler to the database which was created by pbs_db_connectionconnect.

obj[in]: PBS object information to be deleted. Based on the type defined within the obj structure, the right PBS object will be picked and dealt with.

...

Description: This API lets PBS load objects data from the database. This API can work with any of the PBS objects.
Signature:

int pbs_db_load_obj(pbsvoid *conn_db_conn_t *connhandle, pbs_db_obj_info_t *obj)

Parameters:

conn_db_handle[in] - The database connection handle : Connection handler to the database which was created by pbs_db_connectionconnect..
obj[in/out] - PBS object information to be loaded from the database. Based on the type defined within obj structure, right PBS object will be picked and dealt with.

...

Signature:

int pbs_db_find_obj(pbsvoid *conn_db_conn_t *connhandle, pbs_db_obj_info_t *obj, pbs_db_query_options_t *opts, query_cb_t query_cb)

Parameters:

conn_db_handle[in]:The database connection handle Connection handler to the database which was created by pbs_db_connectionconnect..

obj[in/out]: Information of the object to be found.

...

Signature:

int pbs_db_del_attr_obj(pbsvoid *conn_db_conn_t *connhandle, void *obj_id, char *sv_time, pbs_db_attr_list_t *attr_list)

Parameters:

conn_db_handle[in]:The database connection handle Connection handler to the database which was created by pbs_db_connectionconnect..

obj_id[in]: Object id for the delete attributes action.

...

Signature:

int pbs_start_db(char *pbs_ds_host, int pbs_ds_port)

Returns: Error Status code

0 - Success

Non zero - On Failure

...

Signature:

int pbs_shutdown_db(char *pbs_ds_host, int pbs_ds_port)

Returns: Error Status code

0 - Success

Non zero - On Failure

...

Description: This API can be used to check if the database instance is running.

Signature:

Signature:

int pbs_status_db(char *pbs_ds_host, int pbs_statusds_db(port)

Returns: Error Status code

1 - Database is downnot running.

2 - Database is startingrunning on a different host.

3 - Database is uprunning on the localhost.

-1 - On Failure

1.2.12. pbs_db_password

...

Signature:

int pbs_db_password(pbsvoid *conn_db_conn_t *connhandle, char *user_name, char *password, int change_user)

Parameters:

conn_db_handle[in]:The database connection handle Connection handler to the database which was created by pbs_db_connectionconnect.

user_name[in]: Database user name.

...

Signature:

void get_db_errmsg(int failcode, char **errmsg)

Parameters:

failcode[in]: Error code returned by one of the above APIs.

errmsg[out]: returns the db DB error message if any.