| Kea 3.0.2-git

isc::dhcp::LeaseStatsQuery Class Reference

Base class for fulfilling a statistical lease data query. More...

`#include <lease_mgr.h>`

Inheritance diagram for isc::dhcp::LeaseStatsQuery:
[legend]

## Public Types
enum | SelectMode { ALL_SUBNETS , SINGLE_SUBNET , SUBNET_RANGE , ALL_SUBNET_POOLS }
| Defines the types of selection criteria supported. More...

## Public Member Functions
| LeaseStatsQuery (const SelectMode &select_mode=ALL_SUBNETS)
| Constructor to query statistics for all subnets.
| LeaseStatsQuery (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
| Constructor to query for the stats for a range of subnets.
| LeaseStatsQuery (const SubnetID &subnet_id)
| Constructor to query for a single subnet's stats.
virtual | ~LeaseStatsQuery ()
| virtual destructor
SubnetID | getFirstSubnetID () const
| Returns the value of first subnet ID specified (or zero).
SubnetID | getLastSubnetID () const
| Returns the value of last subnet ID specified (or zero).
virtual bool | getNextRow (LeaseStatsRow &row)
| Fetches the next row of data.
SelectMode | getSelectMode () const
| Returns the selection criteria mode The value returned is based upon the constructor variant used and it indicates which query variant will be executed.
virtual void | start ()
| Executes the query.

## Protected Attributes
SubnetID | first_subnet_id_
| First (or only) subnet_id in the selection criteria.
SubnetID | last_subnet_id_
| Last subnet_id in the selection criteria when a range is given.

## Detailed Description

Base class for fulfilling a statistical lease data query.

LeaseMgr derivations implement this class such that it provides up to date statistical lease data organized as rows of LeaseStatsRow instances. The rows must be accessible in ascending order by subnet id.

Definition at line 149 of file lease_mgr.h.

## Member Enumeration Documentation

## ◆ SelectMode

enum isc::dhcp::LeaseStatsQuery::SelectMode

Defines the types of selection criteria supported.

Enumerator
ALL_SUBNETS |
SINGLE_SUBNET |
SUBNET_RANGE |
ALL_SUBNET_POOLS |

Definition at line 152 of file lease_mgr.h.

## Constructor & Destructor Documentation

## ◆ LeaseStatsQuery() [1/3]

isc::dhcp::LeaseStatsQuery::LeaseStatsQuery | ( | const SelectMode & | select_mode = ALL_SUBNETS | ) |

Constructor to query statistics for all subnets.

The query created will return statistics for all subnets

Parameters

  select_mode | The selection criteria which is either ALL_SUBNETS or ALL_SUBNET_POOLS

Definition at line 220 of file lease_mgr.cc.

References ALL_SUBNET_POOLS, ALL_SUBNETS, first_subnet_id_, isc_throw, and last_subnet_id_.

Referenced by isc::dhcp::MemfileLeaseStatsQuery::MemfileLeaseStatsQuery(), isc::dhcp::MemfileLeaseStatsQuery::MemfileLeaseStatsQuery(), and isc::dhcp::MemfileLeaseStatsQuery::MemfileLeaseStatsQuery().

## ◆ LeaseStatsQuery() [2/3]

isc::dhcp::LeaseStatsQuery::LeaseStatsQuery | ( | const SubnetID & | subnet_id | ) |

Constructor to query for a single subnet's stats.

The query created will return statistics for a single subnet

Parameters

  subnet_id | id of the subnet for which stats are desired

Exceptions

  BadValue | if subnet_id given is 0.

Definition at line 227 of file lease_mgr.cc.

References first_subnet_id_, isc_throw, last_subnet_id_, and SINGLE_SUBNET.

## ◆ LeaseStatsQuery() [3/3]

isc::dhcp::LeaseStatsQuery::LeaseStatsQuery | ( | const SubnetID & | first_subnet_id,
|  | const SubnetID & | last_subnet_id )

Constructor to query for the stats for a range of subnets.

The query created will return statistics for the inclusive range of subnets described by first and last subnet IDs.

Parameters

  first_subnet_id | first subnet in the range of subnets
  last_subnet_id | last subnet in the range of subnets

Exceptions

  BadValue | if either value given is 0 or if last <= first.

Definition at line 236 of file lease_mgr.cc.

References first_subnet_id_, isc_throw, last_subnet_id_, and SUBNET_RANGE.

## ◆ ~LeaseStatsQuery()

virtual isc::dhcp::LeaseStatsQuery::~LeaseStatsQuery | ( |  | ) |
| inline virtual

virtual destructor

Definition at line 186 of file lease_mgr.h.

## Member Function Documentation

## ◆ getFirstSubnetID()

SubnetID isc::dhcp::LeaseStatsQuery::getFirstSubnetID | ( |  | ) | const
| inline

Returns the value of first subnet ID specified (or zero).

Definition at line 204 of file lease_mgr.h.

References first_subnet_id_.

## ◆ getLastSubnetID()

SubnetID isc::dhcp::LeaseStatsQuery::getLastSubnetID | ( |  | ) | const
| inline

Returns the value of last subnet ID specified (or zero).

Definition at line 209 of file lease_mgr.h.

References last_subnet_id_.

## ◆ getNextRow()

bool isc::dhcp::LeaseStatsQuery::getNextRow | ( | LeaseStatsRow & | row | ) |
| virtual

Fetches the next row of data.

Parameters

  [out] | row | Storage into which the row is fetched

Returns
  True if a row was fetched, false if there are no more rows.

Reimplemented in isc::dhcp::MemfileLeaseStatsQuery.

Definition at line 277 of file lease_mgr.cc.

## ◆ getSelectMode()

SelectMode isc::dhcp::LeaseStatsQuery::getSelectMode | ( |  | ) | const
| inline

Returns the selection criteria mode The value returned is based upon the constructor variant used and it indicates which query variant will be executed.

Definition at line 216 of file lease_mgr.h.

Referenced by isc::dhcp::MemfileLeaseStatsQuery4::start(), and isc::dhcp::MemfileLeaseStatsQuery6::start().

## ◆ start()

virtual void isc::dhcp::LeaseStatsQuery::start | ( |  | ) |
| inline virtual

Executes the query.

This method should conduct whatever steps are required to calculate the lease statistical data by examining the lease data and making that results available row by row.

Reimplemented in isc::dhcp::MemfileLeaseStatsQuery4, and isc::dhcp::MemfileLeaseStatsQuery6.

Definition at line 193 of file lease_mgr.h.

## Member Data Documentation

## ◆ first_subnet_id_

SubnetID isc::dhcp::LeaseStatsQuery::first_subnet_id_
| protected

First (or only) subnet_id in the selection criteria.

Definition at line 222 of file lease_mgr.h.

Referenced by LeaseStatsQuery(), LeaseStatsQuery(), LeaseStatsQuery(), and getFirstSubnetID().

## ◆ last_subnet_id_

SubnetID isc::dhcp::LeaseStatsQuery::last_subnet_id_
| protected

Last subnet_id in the selection criteria when a range is given.

Definition at line 225 of file lease_mgr.h.

Referenced by LeaseStatsQuery(), LeaseStatsQuery(), LeaseStatsQuery(), and getLastSubnetID().

The documentation for this class was generated from the following files:

- lease_mgr.h
- lease_mgr.cc