![]() |
Kea
1.5.0
|
Common CQL connector pool. More...
#include <cql_connection.h>
Inheritance diagram for isc::db::CqlConnection:Public Member Functions | |
| CqlConnection (const ParameterMap ¶meters) | |
| Constructor. More... | |
| virtual | ~CqlConnection () |
| Destructor. More... | |
| virtual void | commit () |
| Commit Transactions. More... | |
| void | openDatabase () |
| Open database. More... | |
| void | prepareStatements (StatementMap &statements) |
| Prepare statements. More... | |
| virtual void | rollback () |
| Rollback Transactions. More... | |
| void | setConsistency (bool force, CassConsistency consistency) |
| Set consistency. More... | |
| void | startTransaction () |
| Start transaction. More... | |
Public Member Functions inherited from isc::db::DatabaseConnection | |
| DatabaseConnection (const ParameterMap ¶meters) | |
| Constructor. More... | |
| virtual | ~DatabaseConnection () |
| Destructor. More... | |
| bool | configuredReadOnly () const |
| Convenience method checking if database should be opened with read only access. More... | |
| std::string | getParameter (const std::string &name) const |
| Returns value of a connection parameter. More... | |
| bool | invokeDbLostCallback () const |
| Invokes the connection's lost connectivity callback. More... | |
| virtual ReconnectCtlPtr | makeReconnectCtl () const |
| Instantiates a ReconnectCtl based on the connection's reconnect parameters. More... | |
Static Public Member Functions | |
| static const std::string | checkFutureError (const std::string &what, CassFuture *future, StatementTag statement_tag=NULL) |
| Check for errors. More... | |
Static Public Member Functions inherited from isc::db::DatabaseConnection | |
| static ParameterMap | parse (const std::string &dbaccess) |
| Parse database access string. More... | |
| static std::string | redactedAccessString (const ParameterMap ¶meters) |
| Redact database access string. More... | |
| static isc::data::ElementPtr | toElement (const ParameterMap ¶ms) |
| Unparse a parameter map. More... | |
| static isc::data::ElementPtr | toElementDbAccessString (const std::string &dbaccess) |
| Unparse an access string. More... | |
Public Attributes | |
| CassCluster * | cluster_ |
| CQL connection handle. More... | |
| CassConsistency | consistency_ |
| CQL consistency. More... | |
| bool | force_consistency_ |
| CQL consistency enabled. More... | |
| const CassKeyspaceMeta * | keyspace_meta_ |
| Keyspace meta information, used for UDTs. More... | |
| const CassSchemaMeta * | schema_meta_ |
| CassSession * | session_ |
| CQL session handle. More... | |
| StatementMap | statements_ |
| Pointer to external array of tagged statements containing statement name, array of names of bind parameters and text query. More... | |
Additional Inherited Members | |
Public Types inherited from isc::db::DatabaseConnection | |
| typedef boost::function< bool(ReconnectCtlPtr db_retry)> | DbLostCallback |
| Defines a callback prototype for propogating events upward. More... | |
| typedef std::map< std::string, std::string > | ParameterMap |
| Database configuration parameter map. More... | |
Static Public Attributes inherited from isc::db::DatabaseConnection | |
| static DbLostCallback | db_lost_callback = 0 |
| Optional call back function to invoke if a successfully open connection subsequently fails. More... | |
| static const time_t | MAX_DB_TIME = 2147483647 |
| Defines maximum value for time that can be reliably stored. More... | |
Common CQL connector pool.
Provides common operations for the Cassandra database connection used by CqlLeaseMgr, CqlHostDataSource and CqlSrvConfigMgr. Manages the connection to the Cassandra database and preparing of compiled statements. Its fields are public because they are used (both set and retrieved) in classes that use instances of CqlConnection.
Definition at line 119 of file cql_connection.h.
|
explicit |
Constructor.
Initialize CqlConnection object with parameters needed for connection.
| parameters | specify the connection details (username, ip addresses etc.) |
Definition at line 31 of file cql_connection.cc.
|
virtual |
Destructor.
Definition at line 37 of file cql_connection.cc.
References checkFutureError(), cluster_, isc::db::CQL_DEALLOC_ERROR, DB_LOG_ERROR, isc::db::CqlTaggedStatement::prepared_statement_, schema_meta_, session_, and statements_.
Here is the call graph for this function:
|
static |
Check for errors.
Check for errors on the current database operation and returns text description of what happened. In case of success, also returns some logging friendly text.
| what | text description of the operation |
| future | the structure that holds the status of operation |
| statement_tag | statement that was used (optional) |
Definition at line 367 of file cql_connection.cc.
Referenced by isc::db::CqlExchange::executeMutation(), isc::db::CqlExchange::executeSelect(), isc::dhcp::CqlLeaseStatsQuery::executeSelect(), openDatabase(), prepareStatements(), and ~CqlConnection().
|
virtual |
Commit Transactions.
Definition at line 357 of file cql_connection.cc.
References isc::db::CQL_CONNECTION_COMMIT, isc::db::DB_DBG_TRACE_DETAIL, and DB_LOG_DEBUG.
Referenced by isc::dhcp::CqlLeaseMgr::commit().
| void isc::db::CqlConnection::openDatabase | ( | ) |
Open database.
Opens the database using the information supplied in the parameters passed to the constructor. If no parameters are supplied, the default values will be used. The parameters supported as as follows (default values specified in parentheses):
| DbOpenError | error opening the database |
Definition at line 78 of file cql_connection.cc.
References checkFutureError(), cluster_, isc::db::DatabaseConnection::getParameter(), isc_throw, keyspace_meta_, schema_meta_, session_, and isc::Exception::what().
Referenced by isc::dhcp::CqlHostDataSourceImpl::CqlHostDataSourceImpl(), and isc::dhcp::CqlLeaseMgr::CqlLeaseMgr().
Here is the call graph for this function:| void isc::db::CqlConnection::prepareStatements | ( | StatementMap & | statements | ) |
Prepare statements.
Creates the prepared statements for all of the CQL statements used by the CQL backend.
| statements | statements to be prepared |
| isc::db::DbOperationError | if an operation on the open database has failed |
| isc::InvalidParameter | if there is an invalid access in the vector. This represents an internal error within the code. |
Definition at line 315 of file cql_connection.cc.
References checkFutureError(), isc_throw, isc::db::CqlTaggedStatement::name_, isc::db::CqlTaggedStatement::prepared_statement_, session_, statements_, and isc::db::CqlTaggedStatement::text_.
Referenced by isc::dhcp::CqlHostDataSourceImpl::CqlHostDataSourceImpl(), and isc::dhcp::CqlLeaseMgr::CqlLeaseMgr().
Here is the call graph for this function:
|
virtual |
Rollback Transactions.
Definition at line 362 of file cql_connection.cc.
References isc::db::CQL_CONNECTION_ROLLBACK, isc::db::DB_DBG_TRACE_DETAIL, and DB_LOG_DEBUG.
Referenced by isc::dhcp::CqlLeaseMgr::rollback().
| void isc::db::CqlConnection::setConsistency | ( | bool | force, |
| CassConsistency | consistency | ||
| ) |
Set consistency.
Definition at line 346 of file cql_connection.cc.
References consistency_, and force_consistency_.
| void isc::db::CqlConnection::startTransaction | ( | ) |
Start transaction.
Definition at line 352 of file cql_connection.cc.
References isc::db::CQL_CONNECTION_BEGIN_TRANSACTION, isc::db::DB_DBG_TRACE_DETAIL, and DB_LOG_DEBUG.
| CassCluster* isc::db::CqlConnection::cluster_ |
CQL connection handle.
Definition at line 194 of file cql_connection.h.
Referenced by openDatabase(), and ~CqlConnection().
| CassConsistency isc::db::CqlConnection::consistency_ |
CQL consistency.
Definition at line 200 of file cql_connection.h.
Referenced by isc::db::CqlExchange::executeMutation(), isc::db::CqlExchange::executeSelect(), isc::dhcp::CqlLeaseStatsQuery::executeSelect(), and setConsistency().
| bool isc::db::CqlConnection::force_consistency_ |
CQL consistency enabled.
Definition at line 209 of file cql_connection.h.
Referenced by isc::db::CqlExchange::executeMutation(), isc::db::CqlExchange::executeSelect(), isc::dhcp::CqlLeaseStatsQuery::executeSelect(), and setConsistency().
| const CassKeyspaceMeta* isc::db::CqlConnection::keyspace_meta_ |
Keyspace meta information, used for UDTs.
Definition at line 206 of file cql_connection.h.
Referenced by openDatabase(), and isc::db::Udt::Udt().
| const CassSchemaMeta* isc::db::CqlConnection::schema_meta_ |
Definition at line 203 of file cql_connection.h.
Referenced by openDatabase(), and ~CqlConnection().
| CassSession* isc::db::CqlConnection::session_ |
CQL session handle.
Definition at line 197 of file cql_connection.h.
Referenced by isc::db::CqlExchange::executeMutation(), isc::db::CqlExchange::executeSelect(), isc::dhcp::CqlLeaseStatsQuery::executeSelect(), openDatabase(), prepareStatements(), and ~CqlConnection().
| StatementMap isc::db::CqlConnection::statements_ |
Pointer to external array of tagged statements containing statement name, array of names of bind parameters and text query.
Definition at line 191 of file cql_connection.h.
Referenced by isc::db::CqlExchange::executeMutation(), isc::db::CqlExchange::executeSelect(), isc::dhcp::CqlLeaseStatsQuery::executeSelect(), prepareStatements(), and ~CqlConnection().