Kea
1.9.9-git
|
Abstract Lease Manager. More...
#include <lease_mgr.h>
Public Member Functions | |
LeaseMgr () | |
Constructor. More... | |
virtual | ~LeaseMgr () |
Destructor. More... | |
virtual bool | addLease (const Lease4Ptr &lease)=0 |
Adds an IPv4 lease. More... | |
virtual bool | addLease (const Lease6Ptr &lease)=0 |
Adds an IPv6 lease. More... | |
virtual void | commit ()=0 |
Commit Transactions. More... | |
virtual uint64_t | deleteExpiredReclaimedLeases4 (const uint32_t secs)=0 |
Deletes all expired and reclaimed DHCPv4 leases. More... | |
virtual uint64_t | deleteExpiredReclaimedLeases6 (const uint32_t secs)=0 |
Deletes all expired and reclaimed DHCPv6 leases. More... | |
virtual bool | deleteLease (const Lease4Ptr &lease)=0 |
Deletes an IPv4 lease. More... | |
virtual bool | deleteLease (const Lease6Ptr &lease)=0 |
Deletes an IPv6 lease. More... | |
virtual std::string | getDescription () const =0 |
Returns description of the backend. More... | |
virtual void | getExpiredLeases4 (Lease4Collection &expired_leases, const size_t max_leases) const =0 |
Returns a collection of expired DHCPv4 leases. More... | |
virtual void | getExpiredLeases6 (Lease6Collection &expired_leases, const size_t max_leases) const =0 |
Returns a collection of expired DHCPv6 leases. More... | |
virtual Lease4Ptr | getLease4 (const isc::asiolink::IOAddress &addr) const =0 |
Returns an IPv4 lease for specified IPv4 address. More... | |
virtual Lease4Collection | getLease4 (const isc::dhcp::HWAddr &hwaddr) const =0 |
Returns existing IPv4 leases for specified hardware address. More... | |
virtual Lease4Ptr | getLease4 (const isc::dhcp::HWAddr &hwaddr, SubnetID subnet_id) const =0 |
Returns existing IPv4 leases for specified hardware address and a subnet. More... | |
virtual Lease4Collection | getLease4 (const ClientId &clientid) const =0 |
Returns existing IPv4 lease for specified client-id. More... | |
virtual Lease4Ptr | getLease4 (const ClientId &clientid, SubnetID subnet_id) const =0 |
Returns existing IPv4 lease for specified client-id. More... | |
virtual Lease6Ptr | getLease6 (Lease::Type type, const isc::asiolink::IOAddress &addr) const =0 |
Returns existing IPv6 lease for a given IPv6 address. More... | |
Lease6Ptr | getLease6 (Lease::Type type, const DUID &duid, uint32_t iaid, SubnetID subnet_id) const |
returns zero or one IPv6 lease for a given duid+iaid+subnet_id More... | |
virtual Lease4Collection | getLeases4 (SubnetID subnet_id) const =0 |
Returns all IPv4 leases for the particular subnet identifier. More... | |
virtual Lease4Collection | getLeases4 (const std::string &hostname) const =0 |
Returns all IPv4 leases for the particular hostname. More... | |
virtual Lease4Collection | getLeases4 () const =0 |
Returns all IPv4 leases. More... | |
virtual Lease4Collection | getLeases4 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const =0 |
Returns range of IPv4 leases using paging. More... | |
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid) const =0 |
Returns existing IPv6 leases for a given DUID+IA combination. More... | |
virtual Lease6Collection | getLeases6 (Lease::Type type, const DUID &duid, uint32_t iaid, SubnetID subnet_id) const =0 |
Returns existing IPv6 lease for a given DUID+IA combination. More... | |
virtual Lease6Collection | getLeases6 (SubnetID subnet_id) const =0 |
Returns all IPv6 leases for the particular subnet identifier. More... | |
virtual Lease6Collection | getLeases6 (const std::string &hostname) const =0 |
Returns all IPv6 leases for the particular hostname. More... | |
virtual Lease6Collection | getLeases6 () const =0 |
Returns all IPv6 leases. More... | |
virtual Lease6Collection | getLeases6 (const DUID &duid) const =0 |
Returns collection of leases for matching DUID. More... | |
virtual Lease6Collection | getLeases6 (const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) const =0 |
Returns range of IPv6 leases using paging. More... | |
virtual std::string | getName () const =0 |
Returns backend name. More... | |
virtual std::string | getType () const =0 |
Return backend type. More... | |
virtual VersionPair | getVersion () const =0 |
Returns backend version. More... | |
void | recountLeaseStats4 () |
Recalculates per-subnet and global stats for IPv4 leases. More... | |
void | recountLeaseStats6 () |
Recalculates per-subnet and global stats for IPv6 leases. More... | |
virtual void | rollback ()=0 |
Rollback Transactions. More... | |
virtual LeaseStatsQueryPtr | startLeaseStatsQuery4 () |
Creates and runs the IPv4 lease stats query for all subnets. More... | |
virtual LeaseStatsQueryPtr | startLeaseStatsQuery6 () |
Creates and runs the IPv6 lease stats query for all subnets. More... | |
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery4 (const SubnetID &subnet_id) |
Creates and runs the IPv4 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetLeaseStatsQuery6 (const SubnetID &subnet_id) |
Creates and runs the IPv6 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery4 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) |
Creates and runs the IPv4 lease stats query for a single subnet. More... | |
virtual LeaseStatsQueryPtr | startSubnetRangeLeaseStatsQuery6 (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) |
Creates and runs the IPv6 lease stats query for a single subnet. More... | |
virtual void | updateLease4 (const Lease4Ptr &lease4)=0 |
Updates IPv4 lease. More... | |
virtual void | updateLease6 (const Lease6Ptr &lease6)=0 |
Updates IPv6 lease. More... | |
virtual size_t | wipeLeases4 (const SubnetID &subnet_id)=0 |
Virtual method which removes specified leases. More... | |
virtual size_t | wipeLeases6 (const SubnetID &subnet_id)=0 |
Virtual method which removes specified leases. More... | |
Static Public Member Functions | |
static std::string | getDBVersion () |
Class method to return extended version info This class method must be redeclared and redefined in derived classes. More... | |
static isc::asiolink::IOServicePtr & | getIOService () |
Returns pointer to the IO service. More... | |
static void | setIOService (const isc::asiolink::IOServicePtr &io_service) |
Sets IO service to be used by the Lease Manager. More... | |
Abstract Lease Manager.
This is an abstract API for lease database backends. It provides unified interface to all backends. As this is an abstract class, it should not be used directly, but rather specialized derived class should be used instead.
This class throws no exceptions. However, methods in concrete implementations of this class may throw exceptions: see the documentation of those classes for details.
Definition at line 222 of file lease_mgr.h.
|
inline |
Constructor.
Definition at line 226 of file lease_mgr.h.
|
inlinevirtual |
Destructor.
Definition at line 230 of file lease_mgr.h.
|
pure virtual |
Adds an IPv4 lease.
The lease may be modified due to sanity checks setting (see LeaseSanityChecks in CfgConsistency) before being inserted. For performance reasons, the sanity checks do not make a copy, but rather modify lease in place if needed.
lease | lease to be added |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by isc::dhcp::bench::GenericLeaseMgrBenchmark::benchInsertLeases4(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchInsertLeases6(), and isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler().
|
pure virtual |
Adds an IPv6 lease.
The lease may be modified due to sanity checks setting (see LeaseSanityChecks in CfgConsistency) before being inserted. For performance reasons, the sanity checks do not make a copy, but rather modify lease in place if needed.
lease | lease to be added |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Commit Transactions.
Commits all pending database operations. On databases that don't support transactions, this is a no-op.
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Deletes all expired and reclaimed DHCPv4 leases.
secs | Number of seconds since expiration of leases before they can be removed. Leases which have expired later than this time will not be deleted. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::dhcp::AllocEngine::deleteExpiredReclaimedLeases4().
|
pure virtual |
Deletes all expired and reclaimed DHCPv6 leases.
secs | Number of seconds since expiration of leases before they can be removed. Leases which have expired later than this time will not be deleted. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::dhcp::AllocEngine::deleteExpiredReclaimedLeases6().
|
pure virtual |
Deletes an IPv4 lease.
lease | IPv4 lease to be deleted. |
isc::dhcp::DbOperationError | An operation on the open database has failed. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::dhcp::Dhcpv4Srv::processRelease(), isc::dhcp::Dhcpv6Srv::releaseIA_NA(), and isc::dhcp::Dhcpv6Srv::releaseIA_PD().
|
pure virtual |
Deletes an IPv6 lease.
lease | IPv6 lease to be deleted. |
isc::db::DbOperationError | An operation on the open database has failed. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
|
static |
Class method to return extended version info This class method must be redeclared and redefined in derived classes.
Definition at line 354 of file lease_mgr.cc.
References isc_throw.
|
pure virtual |
Returns description of the backend.
This description may be multiline text that describes the backend.
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns a collection of expired DHCPv4 leases.
This method returns at most max_leases
expired leases. The leases returned haven't been reclaimed, i.e. the database query must exclude reclaimed leases from the results returned.
[out] | expired_leases | A container to which expired leases returned by the database backend are added. |
max_leases | A maximum number of leases to be returned. If this value is set to 0, all expired (but not reclaimed) leases are returned. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetExpiredLeases4(), and isc::dhcp::AllocEngine::reclaimExpiredLeases4().
|
pure virtual |
Returns a collection of expired DHCPv6 leases.
This method returns at most max_leases
expired leases. The leases returned haven't been reclaimed, i.e. the database query must exclude reclaimed leases from the results returned.
[out] | expired_leases | A container to which expired leases returned by the database backend are added. |
max_leases | A maximum number of leases to be returned. If this value is set to 0, all expired (but not reclaimed) leases are returned. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetExpiredLeases6(), and isc::dhcp::AllocEngine::reclaimExpiredLeases6().
|
inlinestatic |
Returns pointer to the IO service.
Definition at line 758 of file lease_mgr.h.
Referenced by isc::dhcp::PgSqlLeaseMgr::createContext(), isc::dhcp::MySqlLeaseMgr::createContext(), and isc::dhcp::LFCSetup::setup().
|
pure virtual |
Returns an IPv4 lease for specified IPv4 address.
This method return a lease that is associated with a given address. For other query types (by hardware addr, by client-id) there can be several leases in different subnets (e.g. for mobile clients that got address in different subnets). However, for a single address there can be only one lease, so this method returns a pointer to a single lease, not a container of leases.
addr | address of the searched lease |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease4_address(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease4_clientid(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease4_clientid_subnetid(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease4_hwaddr(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease4_hwaddr_subnetid(), isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByClientIdHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHwAddressHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::dhcp::Dhcpv4Srv::processDecline(), and isc::dhcp::Dhcpv4Srv::processRelease().
|
pure virtual |
Returns existing IPv4 leases for specified hardware address.
Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.
hwaddr | hardware address of the client |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns existing IPv4 leases for specified hardware address and a subnet.
There can be at most one lease for a given HW address in a single pool, so this method will either return a single lease or NULL.
hwaddr | hardware address of the client |
subnet_id | identifier of the subnet that lease must belong to |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns existing IPv4 lease for specified client-id.
Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.
clientid | client identifier |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns existing IPv4 lease for specified client-id.
There can be at most one lease for a given client-id in a single pool, so this method will either return a single lease or NULL.
clientid | client identifier |
subnet_id | identifier of the subnet that lease must belong to |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns existing IPv6 lease for a given IPv6 address.
For a given address, we assume that there will be only one lease. The assumption here is that there will not be site or link-local addresses used, so there is no way of having address duplication.
type | specifies lease type: (NA, TA or PD) |
addr | address of the searched lease |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease6_type_address(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease6_type_duid_iaid_subnetid(), isc::dhcp::Dhcpv6Srv::declineIA(), isc::lease_cmds::LeaseCmdsImpl::getIPv6LeaseForDelete(), isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::dhcp::Dhcpv6Srv::releaseIA_NA(), and isc::dhcp::Dhcpv6Srv::releaseIA_PD().
Lease6Ptr isc::dhcp::LeaseMgr::getLease6 | ( | Lease::Type | type, |
const DUID & | duid, | ||
uint32_t | iaid, | ||
SubnetID | subnet_id | ||
) | const |
returns zero or one IPv6 lease for a given duid+iaid+subnet_id
This function is mostly intended to be used in unit-tests during the transition from single to multi address per IA. It may also be used in other cases where at most one lease is expected in the database.
It is a wrapper around getLeases6(), which returns a collection of leases. That collection can be converted into a single pointer if there are no leases (NULL pointer) or one lease (use that single lease). If there are more leases in the collection, the function will throw MultipleRecords exception.
Note: This method is not virtual on purpose. It is common for all backends.
type | specifies lease type: (NA, TA or PD) |
duid | client DUID |
iaid | IA identifier |
subnet_id | subnet id of the subnet the lease belongs to |
MultipleRecords | if there is more than one lease matching |
Definition at line 50 of file lease_mgr.cc.
References getLeases6(), isc_throw, and isc::dhcp::DUID::toText().
|
pure virtual |
Returns all IPv4 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), and isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler().
|
pure virtual |
Returns all IPv4 leases for the particular hostname.
hostname | hostname in lower case. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns all IPv4 leases.
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns range of IPv4 leases using paging.
This method implements paged browsing of the lease database. The first parameter specifies a page size. The second parameter is optional and specifies the starting address of the range. This address is excluded from the returned range. The IPv4 zero address (default) denotes that the first page should be returned. There is no guarantee about the order of returned leases.
The typical usage of this method is as follows:
lower_bound_address | IPv4 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns existing IPv6 leases for a given DUID+IA combination.
Although in the usual case there will be only one lease, for mobile clients or clients with multiple static/fixed/reserved leases there can be more than one. Thus return type is a container, not a single pointer.
type | specifies lease type: (NA, TA or PD) |
duid | client DUID |
iaid | IA identifier |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchGetLease6_type_duid_iaid(), isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByDuidHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler(), and isc::dhcp::AllocEngine::renewLeases6().
|
pure virtual |
Returns existing IPv6 lease for a given DUID+IA combination.
There may be more than one address, temp. address or prefix for specified duid/iaid/subnet-id tuple.
type | specifies lease type: (NA, TA or PD) |
duid | client DUID |
iaid | IA identifier |
subnet_id | subnet id of the subnet the lease belongs to |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns all IPv6 leases for the particular subnet identifier.
subnet_id | subnet identifier. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns all IPv6 leases for the particular hostname.
hostname | hostname in lower case. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns all IPv6 leases.
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
Referenced by getLease6().
|
pure virtual |
Returns collection of leases for matching DUID.
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::Memfile_LeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns range of IPv6 leases using paging.
This method implements paged browsing of the lease database. The first parameter specifies a page size. The second parameter is optional and specifies the starting address of the range. This address is excluded from the returned range. The IPv6 zero address (default) denotes that the first page should be returned. There is no guarantee about the order of returned leases.
The typical usage of this method is as follows:
lower_bound_address | IPv6 address used as lower bound for the returned range. |
page_size | maximum size of the page returned. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
|
pure virtual |
Returns backend name.
If the backend is a database, this is the name of the database or the file. Otherwise it is just the same as the type.
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Return backend type.
Returns the type of the backend (e.g. "mysql", "memfile" etc.)
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
pure virtual |
Returns backend version.
and then check that: B>=A and B=C (it is ok to have newer backend, as it should be backward compatible) Also if B>C, some database upgrade procedure may be triggered
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
void isc::dhcp::LeaseMgr::recountLeaseStats4 | ( | ) |
Recalculates per-subnet and global stats for IPv4 leases.
This method recalculates the following statistics: per-subnet:
It invokes the virtual method, startLeaseStatsQuery4(), which returns an instance of an LeaseStatsQuery. The query query contains a "result set" where each row is an LeaseStatRow that contains a subnet id, a lease type (currently always TYPE_NA), a lease state, and the number of leases of that type, in that state and is ordered by subnet id. The method iterates over the result set rows, setting the appropriate statistic per subnet and adding to the appropriate global statistic.
NULL means not backend does not support recounting.
Definition at line 67 of file lease_mgr.cc.
References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseStatsRow::lease_state_, startLeaseStatsQuery4(), isc::dhcp::LeaseStatsRow::state_count_, isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, and isc::dhcp::LeaseStatsRow::subnet_id_.
void isc::dhcp::LeaseMgr::recountLeaseStats6 | ( | ) |
Recalculates per-subnet and global stats for IPv6 leases.
This method recalculates the following statistics: per-subnet:
It invokes the virtual method, startLeaseStatsQuery6(), which returns an instance of an LeaseStatsQuery. The query contains a "result set" where each row is an LeaseStatRow that contains a subnet id, a lease type, a lease state, and the number of leases of that type, in that state and is ordered by subnet id. The method iterates over the result set rows, setting the appropriate statistic per subnet and adding to the appropriate global statistic.
NULL means not backend does not support recounting.
Definition at line 215 of file lease_mgr.cc.
References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseStatsRow::lease_state_, isc::dhcp::LeaseStatsRow::lease_type_, startLeaseStatsQuery6(), isc::dhcp::LeaseStatsRow::state_count_, isc::dhcp::Lease::STATE_DECLINED, isc::dhcp::Lease::STATE_DEFAULT, isc::dhcp::LeaseStatsRow::subnet_id_, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.
|
pure virtual |
Rollback Transactions.
Rolls back all pending database operations. On databases that don't support transactions, this is a no-op.
Implemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
|
inlinestatic |
Sets IO service to be used by the Lease Manager.
io_service | IOService object, used for all ASIO operations. |
Definition at line 753 of file lease_mgr.h.
Referenced by isc::dhcp::ControlledDhcpv4Srv::ControlledDhcpv4Srv(), isc::dhcp::ControlledDhcpv6Srv::ControlledDhcpv6Srv(), isc::dhcp::ControlledDhcpv4Srv::~ControlledDhcpv4Srv(), and isc::dhcp::ControlledDhcpv6Srv::~ControlledDhcpv6Srv().
|
virtual |
Creates and runs the IPv4 lease stats query for all subnets.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for all subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 194 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4(), and recountLeaseStats4().
|
virtual |
Creates and runs the IPv6 lease stats query for all subnets.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for all subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 338 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6(), and recountLeaseStats6().
|
virtual |
Creates and runs the IPv4 lease stats query for a single subnet.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for a single subnet. Each row of the result set is an LeaseStatRow.
subnet_id | id of the subnet for which stats are desired |
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 199 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4().
|
virtual |
Creates and runs the IPv6 lease stats query for a single subnet.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for a single subnet. Each row of the result set is an LeaseStatRow.
subnet_id | id of the subnet for which stats are desired |
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 343 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6().
|
virtual |
Creates and runs the IPv4 lease stats query for a single subnet.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv4 lease statistical data for an inclusive range of subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 204 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet4().
|
virtual |
Creates and runs the IPv6 lease stats query for a single subnet.
LeaseMgr derivations implement this method such that it creates and returns an instance of an LeaseStatsQuery whose result set has been populated with up to date IPv6 lease statistical data for an inclusive range of subnets. Each row of the result set is an LeaseStatRow which ordered ascending by subnet ID.
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Reimplemented in isc::dhcp::Memfile_LeaseMgr, isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, and isc::dhcp::CqlLeaseMgr.
Definition at line 348 of file lease_mgr.cc.
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::makeResultSet6().
|
pure virtual |
Updates IPv4 lease.
lease4 | The lease to be updated. |
If no such lease is present, an exception will be thrown.
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate4(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchUpdateLeases4(), isc::dhcp::Dhcpv4Srv::declineLease(), and isc::dhcp::Dhcpv4Srv::postAllocateNameUpdate().
|
pure virtual |
Updates IPv6 lease.
lease6 | The lease to be updated. |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::addOrUpdate6(), isc::dhcp::bench::GenericLeaseMgrBenchmark::benchUpdateLeases6(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), and isc::dhcp::Dhcpv6Srv::declineLease().
|
pure virtual |
Virtual method which removes specified leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet (or 0 for all subnets) |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler().
|
pure virtual |
Virtual method which removes specified leases.
This rather dangerous method is able to remove all leases from specified subnet.
subnet_id | identifier of the subnet (or 0 for all subnets) |
Implemented in isc::dhcp::MySqlLeaseMgr, isc::dhcp::PgSqlLeaseMgr, isc::dhcp::CqlLeaseMgr, and isc::dhcp::Memfile_LeaseMgr.
Referenced by isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler().