Kea
1.9.9-git
|
Provides mechanisms for sending and retrieving data from the hosts table. More...
Public Member Functions | |
CqlHostExchange () | |
Constructor. More... | |
virtual | ~CqlHostExchange () |
Virtual destructor. More... | |
void | createBindForDelete (const HostPtr &host, const Optional< SubnetID > &subnet_id, const IPv6Resrv *const reservation, const std::string &option_space, const OptionDescriptor &option_descriptor, StatementTag statement_tag, AnyArray &data) |
Binds Host to data array to send data to the Cassandra database. More... | |
void | createBindForMutation (const HostPtr &host, const Optional< SubnetID > &subnet_id, const IPv6Resrv *const reservation, const std::string &option_space, const OptionDescriptor &option_descriptor, StatementTag statement_tag, AnyArray &data) |
Binds Host to data array to send data to the Cassandra database. More... | |
virtual void | createBindForSelect (AnyArray &data, StatementTag statement_tag=NULL) override |
Binds member variables to data array to receive Host data. More... | |
uint64_t | hashIntoId () const |
Create unique hash for storage in table id. More... | |
uint64_t | hashIntoKey () const |
Create unique key for storage in table key. More... | |
std::string | hostKey () const |
Create unique key string for a host. More... | |
void | prepareExchange (const HostPtr &host, const Optional< SubnetID > &subnet_id, const IPv6Resrv *const reservation, const std::string &option_space, const OptionDescriptor &option_descriptor) |
Sets the exchange members with data of Host. More... | |
virtual boost::any | retrieve () override |
Copy received data into Host object. More... | |
const OptionWrapper | retrieveOption () const |
Retrieves option from members. More... | |
const IPv6Resrv | retrieveReservation () const |
Creates IPv6 reservation from the data contained in the currently processed row. More... | |
Public Member Functions inherited from isc::db::CqlExchange | |
CqlExchange () | |
Constructor. More... | |
virtual | ~CqlExchange () |
Destructor. More... | |
void | executeMutation (const CqlConnection &connection, const AnyArray &assigned_values, StatementTag statement_tag) |
Executes INSERT, UPDATE or DELETE statements. More... | |
AnyArray | executeSelect (const CqlConnection &connection, const AnyArray &where_values, StatementTag statement_tag, const bool &single=false) |
Executes SELECT statements. More... | |
bool | statementApplied (CassFuture *future, size_t *row_count=NULL, size_t *column_count=NULL) |
Check if CQL statement has been applied. More... | |
Public Member Functions inherited from isc::db::SqlExchange | |
SqlExchange () | |
Constructor. More... | |
virtual | ~SqlExchange () |
Destructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::db::CqlExchange | |
static void | convertToDatabaseTime (const time_t &cltt, const uint32_t &valid_lifetime, cass_int64_t &expire) |
static void | convertFromDatabaseTime (const cass_int64_t &expire, const cass_int64_t &valid_lifetime, time_t &cltt) |
Converts time from Cassandra format. More... | |
Provides mechanisms for sending and retrieving data from the hosts table.
Definition at line 126 of file cql_host_data_source.cc.
isc::dhcp::CqlHostExchange::CqlHostExchange | ( | ) |
|
virtual |
Virtual destructor.
Definition at line 1453 of file cql_host_data_source.cc.
void isc::dhcp::CqlHostExchange::createBindForDelete | ( | const HostPtr & | host, |
const Optional< SubnetID > & | subnet_id, | ||
const IPv6Resrv *const | reservation, | ||
const std::string & | option_space, | ||
const OptionDescriptor & | option_descriptor, | ||
StatementTag | statement_tag, | ||
AnyArray & | data | ||
) |
Binds Host to data array to send data to the Cassandra database.
Fills in the bind array for sending data stored in the Host object to the database.
host | Host object being deleted from the Cassandra database |
subnet_id | identifier of the subnet to which the host belongs |
reservation | IPv6 reservation belonging to the host |
option_space | option space |
option_descriptor | structure used to hold option information |
statement_tag | tag of the statement being executed |
data | array being filled with data from to the Host object |
Definition at line 1790 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc_throw, prepareExchange(), and isc::Exception::what().
Referenced by isc::dhcp::CqlHostDataSourceImpl::insertOrDeleteHost().
void isc::dhcp::CqlHostExchange::createBindForMutation | ( | const HostPtr & | host, |
const Optional< SubnetID > & | subnet_id, | ||
const IPv6Resrv *const | reservation, | ||
const std::string & | option_space, | ||
const OptionDescriptor & | option_descriptor, | ||
StatementTag | statement_tag, | ||
AnyArray & | data | ||
) |
Binds Host to data array to send data to the Cassandra database.
Fills in the bind array for sending data stored in the Host object to the database.
host | Host object being added to the Cassandra database |
subnet_id | identifier of the subnet to which the host belongs |
reservation | IPv6 reservation belonging to the host |
option_space | option space |
option_descriptor | structure used to hold option information |
statement_tag | tag of the statement being executed |
data | array being filled with data from to the Host object |
Definition at line 1732 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc_throw, prepareExchange(), and isc::Exception::what().
Referenced by isc::dhcp::CqlHostDataSourceImpl::insertOrDeleteHost().
|
overridevirtual |
Binds member variables to data array to receive Host data.
Creates a bind array to receive Host data from the Cassandra database. After data is successfully received, retrieve() can be called to retrieve the Host object. Called in db::CqlExchange::executeSelect().
data | array of objects representing data being retrieved |
statement_tag | prepared statement being executed; defaults to an invalid statement |
Denormalized reservation columns
Implements isc::db::CqlExchange.
Definition at line 1457 of file cql_host_data_source.cc.
References isc::db::AnyArray::add().
uint64_t isc::dhcp::CqlHostExchange::hashIntoId | ( | ) | const |
Create unique hash for storage in table id.
Hash function used for creating a pseudo-unique hash from member values which uniquely determine an entry in the table. Uses FNV-1a on 64 bits.
The primary key clustering column aggregates: host_identifier, host_identifier_type, host_ipv4_subnet_id, host_ipv6_subnet_id, host_ipv4_address, reserved_ipv6_prefix_address, reserved_ipv6_prefix_length, option_code, option_space.
Definition at line 1816 of file cql_host_data_source.cc.
References hostKey(), and isc::dhcp::OPTION_SPACE_MAX_LEN.
Referenced by prepareExchange().
uint64_t isc::dhcp::CqlHostExchange::hashIntoKey | ( | ) | const |
Create unique key for storage in table key.
The primary key partition key aggregates: host_identifier, host_identifier_type, host_ipv4_subnet_id, host_ipv6_subnet_id, host_ipv4_address
Definition at line 1836 of file cql_host_data_source.cc.
References hostKey().
Referenced by isc::dhcp::CqlHostDataSourceImpl::getHostKey(), isc::dhcp::CqlHostDataSourceImpl::getHostKey4(), isc::dhcp::CqlHostDataSourceImpl::getHostKey6(), isc::dhcp::CqlHostDataSourceImpl::getNextHostKey(), isc::dhcp::CqlHostDataSourceImpl::getNextHostKey4(), isc::dhcp::CqlHostDataSourceImpl::getNextHostKey6(), and prepareExchange().
std::string isc::dhcp::CqlHostExchange::hostKey | ( | ) | const |
Create unique key string for a host.
The primary key partition key aggregates: host_identifier, host_identifier_type, host_ipv4_subnet_id, host_ipv6_subnet_id, host_ipv4_address
Definition at line 1843 of file cql_host_data_source.cc.
References isc::dhcp::DUID::MAX_DUID_LEN, and isc::dhcp::DUID::toText().
Referenced by hashIntoId(), and hashIntoKey().
void isc::dhcp::CqlHostExchange::prepareExchange | ( | const HostPtr & | host, |
const Optional< SubnetID > & | subnet_id, | ||
const IPv6Resrv *const | reservation, | ||
const std::string & | option_space, | ||
const OptionDescriptor & | option_descriptor | ||
) |
Sets the exchange members with data of Host.
Fills in the members of the exchange with data from Host object.
host | Host object being modified in the Cassandra database |
subnet_id | identifier of the subnet to which the host belongs |
reservation | IPv6 reservation belonging to the host |
option_space | option space |
option_descriptor | structure used to hold option information |
Definition at line 1528 of file cql_host_data_source.cc.
References isc::dhcp::CLIENT_CLASSES_MAX_LEN, isc::dhcp::OptionDescriptor::formatted_value_, isc::data::UserContext::getContext(), isc::dhcp::IPv6Resrv::getPrefix(), isc::dhcp::IPv6Resrv::getPrefixLen(), isc::dhcp::IPv6Resrv::getType(), hashIntoId(), hashIntoKey(), isc_throw, isc::dhcp::DUID::MAX_DUID_LEN, isc::dhcp::OptionDescriptor::option_, isc::dhcp::OptionDescriptor::persistent_, isc::asiolink::IOAddress::toText(), isc::dhcp::IPv6Resrv::TYPE_NA, isc::util::Optional< T >::unspecified(), and isc::Exception::what().
Referenced by createBindForDelete(), and createBindForMutation().
|
overridevirtual |
Copy received data into Host object.
Copies information about the host into a newly created Host object Called in executeSelect after createBindForSelect().
Implements isc::db::CqlExchange.
Definition at line 1865 of file cql_host_data_source.cc.
References isc::dhcp::Host::addReservation(), isc::dhcp::Host::getCfgOption4(), isc::dhcp::Host::getCfgOption6(), isc::dhcp::Host::hasReservation(), isc_throw, retrieveOption(), retrieveReservation(), isc::data::UserContext::setContext(), isc::dhcp::Host::setHostId(), isc::dhcp::Option::V4, isc::dhcp::Option::V6, and isc::Exception::what().
const OptionWrapper isc::dhcp::CqlHostExchange::retrieveOption | ( | ) | const |
Retrieves option from members.
Called after createBindForSelect().
Definition at line 1955 of file cql_host_data_source.cc.
References DHCP4_OPTION_SPACE, DHCP6_OPTION_SPACE, isc::dhcp::LibDHCP::getOptionDef(), isc::dhcp::LibDHCP::getRuntimeOptionDef(), isc::dhcp::LibDHCP::getVendorOptionDef(), isc_throw, isc::dhcp::LibDHCP::optionSpaceToVendorId(), and isc::Exception::what().
Referenced by retrieve().
const IPv6Resrv isc::dhcp::CqlHostExchange::retrieveReservation | ( | ) | const |
Creates IPv6 reservation from the data contained in the currently processed row.
Called after createBindForSelect().
Definition at line 1932 of file cql_host_data_source.cc.
References isc_throw, isc::dhcp::IPv6Resrv::TYPE_NA, and isc::dhcp::IPv6Resrv::TYPE_PD.
Referenced by retrieve().
|
static |
Definition at line 304 of file cql_host_data_source.cc.
|
static |
Definition at line 264 of file cql_host_data_source.cc.
|
static |
Definition at line 268 of file cql_host_data_source.cc.
|
static |
Definition at line 319 of file cql_host_data_source.cc.
|
static |
Definition at line 324 of file cql_host_data_source.cc.
|
static |
Definition at line 329 of file cql_host_data_source.cc.
|
static |
Definition at line 272 of file cql_host_data_source.cc.
|
static |
Definition at line 309 of file cql_host_data_source.cc.
|
static |
Definition at line 287 of file cql_host_data_source.cc.
|
static |
Definition at line 276 of file cql_host_data_source.cc.
|
static |
Definition at line 334 of file cql_host_data_source.cc.
|
static |
Definition at line 339 of file cql_host_data_source.cc.
|
static |
Definition at line 344 of file cql_host_data_source.cc.
|
static |
Definition at line 296 of file cql_host_data_source.cc.
|
static |
Definition at line 314 of file cql_host_data_source.cc.
|
static |
Definition at line 300 of file cql_host_data_source.cc.
|
static |
Definition at line 282 of file cql_host_data_source.cc.
|
static |
Definition at line 349 of file cql_host_data_source.cc.
|
static |
Definition at line 354 of file cql_host_data_source.cc.
|
static |
Definition at line 360 of file cql_host_data_source.cc.
|
static |
Definition at line 369 of file cql_host_data_source.cc.
|
static |
Definition at line 365 of file cql_host_data_source.cc.
|
static |
Definition at line 373 of file cql_host_data_source.cc.
|
static |
Definition at line 377 of file cql_host_data_source.cc.
|
static |
Statement tags.
Definition at line 260 of file cql_host_data_source.cc.
|
static |
Cassandra statements.
Definition at line 381 of file cql_host_data_source.cc.