The sdb connection pool.
More...
#include <sdbConnectionPool.hpp>
|
| sdbConnectionPool () |
| The constructor of sdbConnectionPool.
|
|
| ~sdbConnectionPool () |
| The destructor of sdbConnectionPool.
|
|
INT32 | init (const std::string &address, const sdbConnectionPoolConf &conf) |
| Initialize connection pool.
|
|
INT32 | init (const std::vector< std::string > &addrs, const sdbConnectionPoolConf &conf) |
| Initialize connection pool.
|
|
INT32 | getIdleConnNum () const |
| Get idle connection number or -1 for connection pool has not been initialized yet.
|
|
INT32 | getUsedConnNum () const |
| Get used connection number or -1 for connection pool has not been initialized yet.
|
|
INT32 | getNormalAddrNum () const |
| Get the number of reachable address or -1 for connection pool has not been initialized yet.
|
|
INT32 | getAbnormalAddrNum () const |
| Get the number of unreachable address or -1 for connection pool has not been initialized yet.
|
|
INT32 | getLocalAddrNum () const |
| Get the number of local address or -1 for connection pool has not been initialized yet.
|
|
INT32 | getConnection (sdb *&conn, INT64 timeoutms=5000) |
| Get a connection form connection pool.
|
|
void | releaseConnection (sdb *&conn) |
| Give back a connection to connection pool. If the connection pool had been closed, do nothing.
|
|
INT32 | close () |
| Close connection pool.
|
|
void | updateAuthInfo (const string &username, const string &passwd) |
| update authentication information
|
|
void | updateAuthInfo (const string &username, const string &cipherFile, const string &token) |
| update authentication information
|
|
INT32 | updateAddress (const std::vector< std::string > &addrs) |
| update the addresses of the connection pool, the new address list will replace the old address list, and idle connections whose addresses are not in the new address list will be cleared.
|
|
void sdbclient::sdbConnectionPool::close |
( |
| ) |
|
Close connection pool.
- Return values
-
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbclient::sdbConnectionPool::getAbnormalAddrNum |
( |
| ) |
const |
Get the number of unreachable address or -1 for connection pool has not been initialized yet.
- Return values
-
The | number of unreachable coord nodes |
INT32 sdbclient::sdbConnectionPool::getConnection |
( |
sdb *& |
conn, |
|
|
INT64 |
timeoutsec = 5000 |
|
) |
| |
Get a connection form connection pool.
- Parameters
-
[out] | conn | A connection |
[in] | timeoutms | The 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_OK | Operation Success |
Others | Operation Fail |
INT32 sdbclient::sdbConnectionPool::getIdleConnNum |
( |
| ) |
const |
Get idle connection number or -1 for connection pool has not been initialized yet.
- Return values
-
The | number of idle connection |
INT32 sdbclient::sdbConnectionPool::getLocalAddrNum |
( |
| ) |
const |
Get the number of local address or -1 for connection pool has not been initialized yet.
- Return values
-
The | number of local coord nodes |
INT32 sdbclient::sdbConnectionPool::getNormalAddrNum |
( |
| ) |
const |
Get the number of reachable address or -1 for connection pool has not been initialized yet.
- Return values
-
The | number of reachable coord nodes |
INT32 sdbclient::sdbConnectionPool::getUsedConnNum |
( |
| ) |
const |
Get used connection number or -1 for connection pool has not been initialized yet.
- Return values
-
The | number of used connection |
INT32 sdbclient::sdbConnectionPool::init |
( |
const std::string & |
address, |
|
|
const sdbConnectionPoolConf & |
conf |
|
) |
| |
Initialize connection pool.
- Parameters
-
- Return values
-
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbclient::sdbConnectionPool::init |
( |
const std::vector< std::string > & |
addrs, |
|
|
const sdbConnectionPoolConf & |
conf |
|
) |
| |
Initialize connection pool.
- Parameters
-
- Return values
-
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbclient::sdbConnectionPool::releaseConnection |
( |
sdb *& |
conn | ) |
|
Give back a connection to connection pool. If the connection pool had been closed, do nothing.
- Parameters
-
- Return values
-
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbclient::sdbConnectionPool::updateAddress |
( |
const std::vector< std::string > & |
addrs | ) |
|
update the addresses of the connection pool, the new address list will replace the old address list, and idle connections whose addresses are not in the new address list will be cleared.
- Parameters
-
[in] | coordAddrs | A list of coord node |
- Return values
-
SDB_OK | Operation Success |
Others | Operation Fail |
void sdbclient::sdbConnectionPool::updateAuthInfo |
( |
const string & |
username, |
|
|
const string & |
passwd |
|
) |
| |
update authentication information
- Parameters
-
[in] | username | The new user name |
[in] | passwd | The new password |
void sdbclient::sdbConnectionPool::updateAuthInfo |
( |
const string & |
username, |
|
|
const string & |
cipherFile, |
|
|
const string & |
token |
|
) |
| |
update authentication information
- Parameters
-
[in] | username | The new user name |
[in] | cipherFile | The new cipherfile location |
[in] | token | The new password encryption token |
The documentation for this class was generated from the following file: