Kea
1.9.9-git
|
Implementation of the CqlHostDataSource. More...
Public Member Functions | |
CqlHostDataSourceImpl (const DatabaseConnection::ParameterMap ¶meters) | |
Constructor. More... | |
virtual | ~CqlHostDataSourceImpl () |
Destructor. More... | |
virtual ConstHostPtr | get4 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const |
Implementation of CqlHostDataSource::get4() More... | |
virtual ConstHostPtr | get4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const |
Implementation of CqlHostDataSource::get4() More... | |
virtual ConstHostPtr | get6 (const asiolink::IOAddress &prefix, const uint8_t prefix_len) const |
Retrieves a host by its reserved IPv6 address or prefix. More... | |
virtual ConstHostPtr | get6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const |
Implementation of CqlHostDataSource::get6() More... | |
virtual ConstHostPtr | get6 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const |
Implementation of CqlHostDataSource::get6() More... | |
virtual ConstHostCollection | getAll (const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const |
Implementation of CqlHostDataSource::getAll() More... | |
virtual ConstHostCollection | getAll4 (const SubnetID &subnet_id) const |
Implementation of CqlHostDataSource::getAll4() More... | |
virtual ConstHostCollection | getAll4 (const asiolink::IOAddress &address) const |
Implementation of CqlHostDataSource::getAll4() More... | |
virtual ConstHostCollection | getAll6 (const SubnetID &subnet_id) const |
Implementation of CqlHostDataSource::getAll6() More... | |
virtual ConstHostCollection | getAllbyHostname (const std::string &hostname) const |
Implementation of CqlHostDataSource::getAllbyHostname() More... | |
virtual ConstHostCollection | getAllbyHostname4 (const std::string &hostname, const SubnetID &subnet_id) const |
Implementation of CqlHostDataSource::getAllbyHostname4() More... | |
virtual ConstHostCollection | getAllbyHostname6 (const std::string &hostname, const SubnetID &subnet_id) const |
Implementation of CqlHostDataSource::getAllbyHostname6() More... | |
virtual ConstHostCollection | getAllHosts () const |
Implementation of CqlHostDataSource::getAllHosts() More... | |
virtual std::string | getName () const |
Implementation of CqlHostDataSource::getName() More... | |
virtual ConstHostCollection | getPage4 (const SubnetID &subnet_id, uint64_t lower_host_id, const HostPageSize &page_size) const |
Implementation of CqlHostDataSource::getPage4() More... | |
virtual ConstHostCollection | getPage4 (uint64_t lower_host_id, const HostPageSize &page_size) const |
Implementation of CqlHostDataSource::getPage4() More... | |
virtual ConstHostCollection | getPage6 (const SubnetID &subnet_id, uint64_t lower_host_id, const HostPageSize &page_size) const |
Implementation of CqlHostDataSource::getPage6() More... | |
virtual ConstHostCollection | getPage6 (uint64_t lower_host_id, const HostPageSize &page_size) const |
Implementation of CqlHostDataSource::getPage6() More... | |
virtual VersionPair | getVersion () const |
Implementation of CqlHostDataSource::getVersion() More... | |
virtual bool | insertOrDelete (const HostPtr &host, bool insert) |
Implementation of CqlHostDataSource::add() and del() More... | |
Protected Member Functions | |
virtual ConstHostPtr | getHost (StatementTag statement_tag, AnyArray &where_values) const |
Retrieves a single host. More... | |
virtual ConstHostPtr | getHostByKey (uint64_t key) const |
Retrieves a host by key. More... | |
virtual ConstHostCollection | getHostCollection (StatementTag statement_tag, AnyArray &where_values) const |
Retrieves a collection of hosts. More... | |
virtual ConstHostCollection | getHostCollectionPage4 (const SubnetID &subnet_id, uint64_t lower_host_id, size_t count=0) const |
Retrieves a page of hosts. More... | |
virtual ConstHostCollection | getHostCollectionPage4 (uint64_t lower_host_id, size_t count=0) const |
Retrieves a page of hosts. More... | |
virtual ConstHostCollection | getHostCollectionPage6 (const SubnetID &subnet_id, uint64_t lower_host_id, size_t count=0) const |
Retrieves a page of hosts. More... | |
virtual ConstHostCollection | getHostCollectionPage6 (uint64_t lower_host_id, size_t count=0) const |
Retrieves a page of hosts. More... | |
virtual bool | getHostKey (uint64_t lower_host_id, uint64_t &key) const |
Retrieves a valid host key. More... | |
virtual bool | getHostKey4 (const SubnetID &subnet_id, uint64_t lower_host_id, uint64_t &key) const |
Retrieves a valid host key. More... | |
virtual bool | getHostKey6 (const SubnetID &subnet_id, uint64_t lower_host_id, uint64_t &key) const |
Retrieves a valid host key. More... | |
virtual bool | getNextHostKey (uint64_t &key) const |
Retrieves next valid host key. More... | |
virtual bool | getNextHostKey4 (const SubnetID &subnet_id, uint64_t &key) const |
Retrieves next valid host key. More... | |
virtual bool | getNextHostKey6 (const SubnetID &subnet_id, uint64_t &key) const |
Retrieves next valid host key. More... | |
virtual bool | insertOrDeleteHost (bool insert, const HostPtr &host, const Optional< SubnetID > &subnet_id=Optional< SubnetID >(), const IPv6Resrv *const reservation=NULL, const std::string &option_space=NULL_OPTION_SPACE, const OptionDescriptor &option_descriptor=OptionDescriptor(false)) |
Inserts or deletes a single host. More... | |
virtual bool | insertOrDeleteHostWithOptions (bool insert, const HostPtr &host, const IPv6Resrv *const reservation=NULL, const std::list< std::string > &option_spaces=std::list< std::string >(), const ConstCfgOptionPtr cfg_option=ConstCfgOptionPtr()) |
Adds/deletes any options found in the Host object to/from a separate table entry. More... | |
virtual bool | insertOrDeleteHostWithReservations (bool insert, const HostPtr &host, const IPv6Resrv *const reservation, const std::list< std::string > &option_spaces4, const ConstCfgOptionPtr cfg_option4, const std::list< std::string > &option_spaces6, const ConstCfgOptionPtr cfg_option6) |
Adds/deletes any reservations found in the Host object to/from a separate table entry. More... | |
virtual void | mergeHosts (const ConstHostPtr &source_host, HostPtr &target_host) const |
Merge denormalized table entries that belong to the same host into a single host, one by one. More... | |
Implementation of the CqlHostDataSource.
This class is encapsulate all the Cassandra communication details.
Definition at line 2048 of file cql_host_data_source.cc.
|
explicit |
Constructor.
This constructor opens database connection and initializes prepared statements used in the queries.
parameters | parameters passed to the CQL connection. |
Definition at line 2512 of file cql_host_data_source.cc.
References isc::db::CQL_SCHEMA_VERSION_MAJOR, isc::db::CQL_SCHEMA_VERSION_MINOR, getVersion(), isc_throw, isc::db::CqlConnection::openDatabase(), and isc::db::CqlConnection::prepareStatements().
|
virtual |
Destructor.
Definition at line 2532 of file cql_host_data_source.cc.
|
virtual |
Implementation of CqlHostDataSource::get4()
See CqlHostDataSource::get4() for parameter details.
subnet_id | Id of the subnet to look into |
address | IPv4 address to be retrieved |
Definition at line 2582 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), getHost(), isc_throw, isc::asiolink::IOAddress::isV4(), and isc::asiolink::IOAddress::toUint32().
Referenced by isc::dhcp::CqlHostDataSource::del(), isc::dhcp::CqlHostDataSource::del4(), and isc::dhcp::CqlHostDataSource::get4().
|
virtual |
Implementation of CqlHostDataSource::get4()
See CqlHostDataSource::get4() for parameter details.
subnet_id | Id of the subnet to look into |
identifier_type | type of the identifier |
identifier_begin | pointer to the first byte of the identifier |
identifier_len | length of the identifier |
Definition at line 2605 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHost().
|
virtual |
Retrieves a host by its reserved IPv6 address or prefix.
See CqlHostDataSource::get6() for parameter details.
prefix | IPv6 address or prefix |
prefix_len | length of the prefix (or 128 for address) |
Definition at line 2628 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), getAll(), getHost(), isc_throw, and isc::asiolink::IOAddress::toText().
Referenced by isc::dhcp::CqlHostDataSource::del6(), and isc::dhcp::CqlHostDataSource::get6().
|
virtual |
Implementation of CqlHostDataSource::get6()
See CqlHostDataSource::get6() for parameter details.
subnet_id | Id of the subnet to look into |
identifier_type | type of the identifier (duid, hwaddr, flex, etc.) |
identifier_begin | pointer to the first byte of the identifier |
identifier_len | length of the identifier |
Definition at line 2671 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHost().
|
virtual |
Implementation of CqlHostDataSource::get6()
See CqlHostDataSource::get6() for parameter details.
subnet_id | Id of the subnet to look into |
address | IPv6 address to be retrieved |
Definition at line 2694 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), getHost(), and isc::asiolink::IOAddress::toText().
|
virtual |
Implementation of CqlHostDataSource::getAll()
See CqlHostDataSource::getAll() for parameter details.
identifier_type | type of the identifier (duid, hwaddr, flex, etc.) |
identifier_begin | pointer to the first byte of the identifier |
identifier_len | length of the identifier |
Definition at line 2712 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by get6(), and isc::dhcp::CqlHostDataSource::getAll().
|
virtual |
Implementation of CqlHostDataSource::getAll4()
See CqlHostDataSource::getAll4() for parameter details.
subnet_id | identifier of the subnet to which hosts belong |
Definition at line 2732 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAll4().
|
virtual |
Implementation of CqlHostDataSource::getAll4()
See CqlHostDataSource::getAll4() for parameter details.
address | IPv4 address of the reservation to be retrieved |
Definition at line 2872 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), getHostCollection(), and isc::asiolink::IOAddress::toUint32().
|
virtual |
Implementation of CqlHostDataSource::getAll6()
See CqlHostDataSource::getAll6() for parameter details.
subnet_id | identifier of the subnet to which hosts belong |
Definition at line 2749 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAll6().
|
virtual |
Implementation of CqlHostDataSource::getAllbyHostname()
See CqlHostDataSource::getAllbyHostname() for parameter details.
hostname | The lower case hostname. |
Definition at line 2766 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAllbyHostname().
|
virtual |
Implementation of CqlHostDataSource::getAllbyHostname4()
See CqlHostDataSource::getAllbyHostname4() for parameter details.
hostname | The lower case hostname. |
subnet_id | Subnet identifier. |
Definition at line 2783 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAllbyHostname4().
|
virtual |
Implementation of CqlHostDataSource::getAllbyHostname6()
See CqlHostDataSource::getAllbyHostname6() for parameter details.
hostname | The lower case hostname. |
subnet_id | Subnet identifier. |
Definition at line 2803 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), and getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAllbyHostname6().
|
virtual |
Implementation of CqlHostDataSource::getAllHosts()
See CqlHostDataSource::getAllHosts() for parameter details.
Definition at line 2888 of file cql_host_data_source.cc.
References getHostCollection().
Referenced by isc::dhcp::CqlHostDataSource::getAllHosts().
|
protectedvirtual |
Retrieves a single host.
Calls getHostCollection() and checks if a single host was returned.
where_values | array of bound objects used to filter the results |
statement_tag | prepared statement being executed |
MultipleRecords | exception if two or more hosts are returned |
Definition at line 2989 of file cql_host_data_source.cc.
References getHostCollection(), and isc_throw.
Referenced by get4(), and get6().
|
protectedvirtual |
Retrieves a host by key.
key | identifier of the host |
Definition at line 3048 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), getHostCollection(), and isc_throw.
Referenced by getHostCollectionPage4(), and getHostCollectionPage6().
|
protectedvirtual |
Retrieves a collection of hosts.
Calls db::CqlExchange::executeSelect().
where_values | array of bound objects used to filter the results |
statement_tag | prepared statement being executed |
Definition at line 3007 of file cql_host_data_source.cc.
References isc::db::CqlExchange::executeSelect(), and mergeHosts().
Referenced by getAll(), getAll4(), getAll6(), getAllbyHostname(), getAllbyHostname4(), getAllbyHostname6(), getAllHosts(), getHost(), and getHostByKey().
|
protectedvirtual |
Retrieves a page of hosts.
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
count | the size of the page |
Definition at line 3073 of file cql_host_data_source.cc.
References getHostByKey(), and getHostKey4().
Referenced by getPage4().
|
protectedvirtual |
Retrieves a page of hosts.
lower_host_id | Host identifier used as lower bound for the returned range. |
count | the size of the page |
Definition at line 3115 of file cql_host_data_source.cc.
References getHostByKey(), and getHostKey().
|
protectedvirtual |
Retrieves a page of hosts.
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
count | the size of the page |
Definition at line 3094 of file cql_host_data_source.cc.
References getHostByKey(), and getHostKey6().
Referenced by getPage6().
|
protectedvirtual |
Retrieves a page of hosts.
lower_host_id | Host identifier used as lower bound for the returned range. |
count | the size of the page |
Definition at line 3135 of file cql_host_data_source.cc.
References getHostByKey(), and getHostKey().
|
protectedvirtual |
Retrieves a valid host key.
if lower_host_id is 0 the key parameter will be updated with the key of the first host if lower_host_id is not 0 the key parameter will be updated with the next valid host key
lower_host_id | Host identifier used as lower bound for the returned range. |
key | identifier of the host which will be updated |
Definition at line 3255 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), getNextHostKey(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostCollectionPage4(), and getHostCollectionPage6().
|
protectedvirtual |
Retrieves a valid host key.
if lower_host_id is 0 the key parameter will be updated with the key of the first host if lower_host_id is not 0 the key parameter will be updated with the next valid host key
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
key | identifier of the host which will be updated |
Definition at line 3155 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), getNextHostKey4(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostCollectionPage4().
|
protectedvirtual |
Retrieves a valid host key.
if lower_host_id is 0 the key parameter will be updated with the key of the first host if lower_host_id is not 0 the key parameter will be updated with the next valid host key
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
key | identifier of the host which will be updated |
Definition at line 3205 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), getNextHostKey6(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostCollectionPage6().
|
virtual |
Implementation of CqlHostDataSource::getName()
Definition at line 2900 of file cql_host_data_source.cc.
References isc::db::DatabaseConnection::getParameter().
Referenced by isc::dhcp::CqlHostDataSource::getName().
|
protectedvirtual |
Retrieves next valid host key.
key | identifier of the host which will be updated with the next valid host key |
Definition at line 3361 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostKey().
|
protectedvirtual |
Retrieves next valid host key.
subnet_id | identifier of the subnet to which hosts belong |
key | identifier of the host which will be updated with the next valid host key |
Definition at line 3299 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostKey4().
|
protectedvirtual |
Retrieves next valid host key.
subnet_id | identifier of the subnet to which hosts belong |
key | identifier of the host which will be updated with the next valid host key |
Definition at line 3330 of file cql_host_data_source.cc.
References isc::db::AnyArray::add(), isc::db::CqlExchange::executeSelect(), and isc::dhcp::CqlHostExchange::hashIntoKey().
Referenced by getHostKey6().
|
virtual |
Implementation of CqlHostDataSource::getPage4()
See CqlHostDataSource::getPage4() for parameter details.
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Definition at line 2830 of file cql_host_data_source.cc.
References getHostCollectionPage4(), and isc::dhcp::HostPageSize::page_size_.
Referenced by isc::dhcp::CqlHostDataSource::getPage4().
|
virtual |
Implementation of CqlHostDataSource::getPage4()
See CqlHostDataSource::getPage4() for parameter details.
lower_host_id | Host identifier used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Definition at line 2852 of file cql_host_data_source.cc.
References getHostCollectionPage4(), and isc::dhcp::HostPageSize::page_size_.
|
virtual |
Implementation of CqlHostDataSource::getPage6()
See CqlHostDataSource::getPage6() for parameter details.
subnet_id | identifier of the subnet to which hosts belong |
lower_host_id | Host identifier used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Definition at line 2841 of file cql_host_data_source.cc.
References getHostCollectionPage6(), and isc::dhcp::HostPageSize::page_size_.
Referenced by isc::dhcp::CqlHostDataSource::getPage6().
|
virtual |
Implementation of CqlHostDataSource::getPage6()
See CqlHostDataSource::getPage6() for parameter details.
lower_host_id | Host identifier used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Definition at line 2862 of file cql_host_data_source.cc.
References getHostCollectionPage6(), and isc::dhcp::HostPageSize::page_size_.
|
virtual |
Implementation of CqlHostDataSource::getVersion()
Definition at line 2911 of file cql_host_data_source.cc.
References isc::db::CqlConnection::getVersion().
Referenced by CqlHostDataSourceImpl(), and isc::dhcp::CqlHostDataSource::getVersion().
|
virtual |
Implementation of CqlHostDataSource::add() and del()
See CqlHostDataSource::add() for parameter details.
host | host to be added or deleted |
insert | insert (true) or delete (false) the host |
Definition at line 2538 of file cql_host_data_source.cc.
References insertOrDeleteHostWithReservations().
Referenced by isc::dhcp::CqlHostDataSource::add(), isc::dhcp::CqlHostDataSource::del(), isc::dhcp::CqlHostDataSource::del4(), and isc::dhcp::CqlHostDataSource::del6().
|
protectedvirtual |
Inserts or deletes a single host.
All information is available here. Calls db::CqlExchange::executeMutation().
insert | insert or delete a host |
host | Host object from which options are retrieved and inserted/deleted into/from the Cassandra database |
subnet_id | identifier of the subnet to which the host belongs |
reservation | reservation for the current denormalized table entry |
option_space | option space for the current denormalized table entry's option |
option_descriptor | option descriptor containing information for the current denormalized table entry's option |
Definition at line 3389 of file cql_host_data_source.cc.
References isc::dhcp::CqlHostExchange::createBindForDelete(), isc::dhcp::CqlHostExchange::createBindForMutation(), isc::db::CqlExchange::executeMutation(), isc_throw, and isc::Exception::what().
Referenced by insertOrDeleteHostWithOptions().
|
protectedvirtual |
Adds/deletes any options found in the Host object to/from a separate table entry.
insert | insert or delete a host with options |
host | Host object from which options are retrieved and inserted/deleted into/from the Cassandra database |
reservation | reservation for the current denormalized table entry |
option_spaces | list of option spaces to search for |
cfg_option | option configuration used to match option spaces in order to obtain actual options |
Definition at line 2916 of file cql_host_data_source.cc.
References insertOrDeleteHost().
Referenced by insertOrDeleteHostWithReservations().
|
protectedvirtual |
Adds/deletes any reservations found in the Host object to/from a separate table entry.
insert | insert or deletes a host with reservations |
host | Host object from which reservations are retrieved and inserted/deleted into/from the Cassandra database |
reservation | reservation for the current denormalized table entry |
option_spaces4 | list of option spaces for universe Option::V4 to search in |
cfg_option4 | option configuration for universe Option::V4 used to match option spaces in order to obtain actual options |
option_spaces6 | list of option spaces for universe Option::V6 to search in |
cfg_option6 | option configuration for universe Option::V6 used to match option spaces in order to obtain actual options |
Definition at line 2957 of file cql_host_data_source.cc.
References insertOrDeleteHostWithOptions().
Referenced by insertOrDelete().
|
protectedvirtual |
Merge denormalized table entries that belong to the same host into a single host, one by one.
target_host | host which can contain multiple reservations and options to which other distinct reservations and options are added. |
source_host | host that is being search for new reservations and options that will be merged into the old host. |
Definition at line 3428 of file cql_host_data_source.cc.
Referenced by getHostCollection().