Kea  1.9.9-git
isc::dhcp::LFCSetup Class Reference

Represents a configuration for Lease File Cleanup. More...

Public Member Functions

 LFCSetup (asiolink::IntervalTimer::Callback callback)
 Constructor. More...
 
 ~LFCSetup ()
 Destructor. More...
 
void execute ()
 Spawns a new process. More...
 
int getExitStatus () const
 Returns exit code of the last completed cleanup. More...
 
bool isRunning () const
 Checks if the lease file cleanup is in progress. More...
 
void setup (const uint32_t lfc_interval, const boost::shared_ptr< CSVLeaseFile4 > &lease_file4, const boost::shared_ptr< CSVLeaseFile6 > &lease_file6, bool run_once_now=false)
 Sets the new configuration for the Lease File Cleanup. More...
 

Detailed Description

Represents a configuration for Lease File Cleanup.

This class is solely used by the Memfile_LeaseMgr as a configuration information storage for Lease File Cleanup. Internally, it creates the interval timer and assigns a callback function (pointer to which is passed in the constructor), which will be called at the specified intervals to perform the cleanup. It is also responsible for creating and maintaining the object which is used to spawn the new process which executes the kea-lfc program.

This functionality is enclosed in a separate class so as the implementation details are not exposed in the Memfile_LeaseMgr header file and to maintain a single place with the LFC configuration, instead of multiple members and functions scattered in the Memfile_LeaseMgr class.

Definition at line 60 of file memfile_lease_mgr.cc.

Constructor & Destructor Documentation

isc::dhcp::LFCSetup::LFCSetup ( asiolink::IntervalTimer::Callback  callback)

Constructor.

Assigns a pointer to the function triggered to perform the cleanup. This pointer should point to the appropriate method of the Memfile_LeaseMgr class.

Parameters
callbackA pointer to the callback function.

Definition at line 123 of file memfile_lease_mgr.cc.

isc::dhcp::LFCSetup::~LFCSetup ( )

Member Function Documentation

void isc::dhcp::LFCSetup::execute ( )
int isc::dhcp::LFCSetup::getExitStatus ( ) const

Returns exit code of the last completed cleanup.

Definition at line 245 of file memfile_lease_mgr.cc.

References isc_throw.

bool isc::dhcp::LFCSetup::isRunning ( ) const

Checks if the lease file cleanup is in progress.

Returns
true if the lease file cleanup is being executed.

Definition at line 240 of file memfile_lease_mgr.cc.

void isc::dhcp::LFCSetup::setup ( const uint32_t  lfc_interval,
const boost::shared_ptr< CSVLeaseFile4 > &  lease_file4,
const boost::shared_ptr< CSVLeaseFile6 > &  lease_file6,
bool  run_once_now = false 
)

Sets the new configuration for the Lease File Cleanup.

Parameters
lfc_intervalAn interval in seconds at which the cleanup should be performed.
lease_file4A pointer to the DHCPv4 lease file to be cleaned up or NULL. If this is NULL, the lease_file6 must be non-null.
lease_file6A pointer to the DHCPv6 lease file to be cleaned up or NULL. If this is NULL, the lease_file4 must be non-null.
run_once_nowA flag that causes LFC to be invoked immediately, regardless of the value of lfc_interval. This is primarily used to cause lease file schema upgrades upon startup.

Definition at line 152 of file memfile_lease_mgr.cc.

References isc::dhcp::Memfile_LeaseMgr::appendSuffix(), isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MEMFILE_LFC_SETUP, isc::dhcp::Memfile_LeaseMgr::FILE_FINISH, isc::dhcp::Memfile_LeaseMgr::FILE_INPUT, isc::dhcp::Memfile_LeaseMgr::FILE_OUTPUT, isc::dhcp::Memfile_LeaseMgr::FILE_PID, isc::dhcp::Memfile_LeaseMgr::FILE_PREVIOUS, isc::dhcp::LeaseMgr::getIOService(), LOG_INFO, and isc::asiolink::IntervalTimer::REPEATING.

+ Here is the call graph for this function:


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