Kea  1.9.9-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:

Public Types

enum  SelectMode { ALL_SUBNETS, SINGLE_SUBNET, SUBNET_RANGE }
 Defines the types of selection criteria supported. More...
 

Public Member Functions

 LeaseStatsQuery ()
 Default constructor The query created will return statistics for all subnets. More...
 
 LeaseStatsQuery (const SubnetID &subnet_id)
 Constructor to query for a single subnet's stats. More...
 
 LeaseStatsQuery (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
 Constructor to query for the stats for a range of subnets. More...
 
virtual ~LeaseStatsQuery ()
 virtual destructor More...
 
SubnetID getFirstSubnetID () const
 Returns the value of first subnet ID specified (or zero) More...
 
SubnetID getLastSubnetID () const
 Returns the value of last subnet ID specified (or zero) More...
 
virtual bool getNextRow (LeaseStatsRow &row)
 Fetches the next row of data. More...
 
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. More...
 
virtual void start ()
 Executes the query. More...
 

Protected Attributes

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

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 128 of file lease_mgr.h.

Member Enumeration Documentation

Defines the types of selection criteria supported.

Enumerator
ALL_SUBNETS 
SINGLE_SUBNET 
SUBNET_RANGE 

Definition at line 131 of file lease_mgr.h.

Constructor & Destructor Documentation

isc::dhcp::LeaseStatsQuery::LeaseStatsQuery ( )

Default constructor The query created will return statistics for all subnets.

Definition at line 161 of file lease_mgr.cc.

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_idid of the subnet for which stats are desired
Exceptions
BadValueif subnet_id given is 0.

Definition at line 165 of file lease_mgr.cc.

References first_subnet_id_, and isc_throw.

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_idfirst subnet in the range of subnets
last_subnet_idlast subnet in the range of subnets
Exceptions
BadValueif either value given is 0 or if last <= first.

Definition at line 174 of file lease_mgr.cc.

References first_subnet_id_, isc_throw, and last_subnet_id_.

virtual isc::dhcp::LeaseStatsQuery::~LeaseStatsQuery ( )
inlinevirtual

virtual destructor

Definition at line 160 of file lease_mgr.h.

Member Function Documentation

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

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

Definition at line 178 of file lease_mgr.h.

References first_subnet_id_.

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

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

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

Definition at line 183 of file lease_mgr.h.

References last_subnet_id_.

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

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

Fetches the next row of data.

Parameters
[out]rowStorage into which the row is fetched
Returns
True if a row was fetched, false if there are no more rows.

Reimplemented in isc::dhcp::CqlLeaseStatsQuery, isc::dhcp::MySqlLeaseStatsQuery, isc::dhcp::PgSqlLeaseStatsQuery, and isc::dhcp::MemfileLeaseStatsQuery.

Definition at line 210 of file lease_mgr.cc.

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 190 of file lease_mgr.h.

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

virtual void isc::dhcp::LeaseStatsQuery::start ( )
inlinevirtual

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::CqlLeaseStatsQuery, isc::dhcp::MySqlLeaseStatsQuery, isc::dhcp::PgSqlLeaseStatsQuery, isc::dhcp::MemfileLeaseStatsQuery6, and isc::dhcp::MemfileLeaseStatsQuery4.

Definition at line 167 of file lease_mgr.h.

Member Data Documentation

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

First (or only) subnet_id in the selection criteria.

Definition at line 192 of file lease_mgr.h.

Referenced by getFirstSubnetID(), LeaseStatsQuery(), and isc::dhcp::CqlLeaseStatsQuery::start().

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

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

Definition at line 199 of file lease_mgr.h.

Referenced by getLastSubnetID(), LeaseStatsQuery(), and isc::dhcp::CqlLeaseStatsQuery::start().


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