SequoiaDB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
sdbclient::sdbDataSource Class Reference

The sdb data source. More...

#include <sdbDataSource.hpp>

Inherits SDBObject.

Public Member Functions

 sdbDataSource ()
 The constructor of sdbDataSource.
 
 ~sdbDataSource ()
 The destructor of sdbDataSource.
 
INT32 init (const std::string &url, const sdbDataSourceConf &conf)
 Initialize sdbDataSource.
 
INT32 init (const std::vector< std::string > &vUrls, const sdbDataSourceConf &conf)
 Initialize sdbDataSource.
 
INT32 getIdleConnNum () const
 Get idle connection number or -1 for DataSource has not been initialized yet.
 
INT32 getUsedConnNum () const
 Get used connection number or -1 for DataSource has not been initialized yet.
 
INT32 getNormalCoordNum () const
 Get the number of reachable coord nodes or -1 for DataSource has not been initialized yet.
 
INT32 getAbnormalCoordNum () const
 Get the number of unreachable coord nodes or -1 for DataSource has not been initialized yet.
 
INT32 getLocalCoordNum () const
 Get the number of local coord nodes or -1 for DataSource has not been initialized yet.
 
void addCoord (const string &url)
 Add a coord node.
 
void removeCoord (const string &url)
 Remove a coord node.
 
INT32 enable ()
 Enable sdbDataSource.
 
INT32 disable ()
 Disable sdbDataSource. After disable, the DataSource will disconnect all the connections and release the handle of the connections. So stop using the connection handle which has not been released to the DataSource.
 
INT32 getConnection (sdb *&conn, INT64 timeoutms=5000)
 Get a connection form sdbDataSource.
 
void releaseConnection (sdb *conn)
 Give back a connection to sdbDataSource.
 
void close ()
 Close sdbDataSource.
 

Detailed Description

The sdb data source.

Member Function Documentation

INT32 sdbclient::sdbDataSource::addCoord ( const string &  url)

Add a coord node.

Parameters
[in]urlA coord node("ubuntu-xxx:11810")
INT32 sdbclient::sdbDataSource::disable ( )

Disable sdbDataSource. After disable, the DataSource will disconnect all the connections and release the handle of the connections. So stop using the connection handle which has not been released to the DataSource.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::enable ( )

Enable sdbDataSource.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::getAbnormalCoordNum ( ) const

Get the number of unreachable coord nodes or -1 for DataSource has not been initialized yet.

Return values
Thenumber of unreachable coord nodes
INT32 sdbclient::sdbDataSource::getConnection ( sdb *&  conn,
INT64  timeoutsec = 5000 
)

Get a connection form sdbDataSource.

Parameters
[out]connA connection
[in]timeoutmsThe time to wait when connection number reach to max connection number,default:5000ms. when timeoutms is set to 0, means waiting until a connection is available. when timeoutms is less than 0, set it to be 0.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::getIdleConnNum ( ) const

Get idle connection number or -1 for DataSource has not been initialized yet.

Return values
Thenumber of idle connection
INT32 sdbclient::sdbDataSource::getLocalCoordNum ( ) const

Get the number of local coord nodes or -1 for DataSource has not been initialized yet.

Return values
Thenumber of local coord nodes
INT32 sdbclient::sdbDataSource::getNormalCoordNum ( ) const

Get the number of reachable coord nodes or -1 for DataSource has not been initialized yet.

Return values
Thenumber of reachable coord nodes
INT32 sdbclient::sdbDataSource::getUsedConnNum ( ) const

Get used connection number or -1 for DataSource has not been initialized yet.

Return values
Thenumber of used connection
INT32 sdbclient::sdbDataSource::init ( const std::string &  url,
const sdbDataSourceConf conf 
)

Initialize sdbDataSource.

Parameters
[in]urlA coord node("ubuntu-xxx:11810")
[in]confThe sdbDataSourceConf
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::init ( const std::vector< std::string > &  vUrls,
const sdbDataSourceConf conf 
)

Initialize sdbDataSource.

Parameters
[in]vUrlsA list of coord node("ubuntu-xxx:11810")
[in]confThe sdbDataSourceConf
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::releaseConnection ( sdb conn)

Give back a connection to sdbDataSource.

Parameters
[in]connA connection
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbDataSource::removeCoord ( const string &  url)

Remove a coord node.

Parameters
[in]urlA coord node("ubuntu-xxx:11810")

The documentation for this class was generated from the following file: