7#ifndef MEMFILE_LEASE_LIMITS_H
8#define MEMFILE_LEASE_LIMITS_H
17#include <unordered_map>
113 addresses_by_class_.clear();
114 pds_by_class_.clear();
124 return (getConstCountMap(ltype).
size());
142 return (ltype ==
Lease::TYPE_PD ? pds_by_class_ : addresses_by_class_);
146 return (ltype ==
Lease::TYPE_PD ? pds_by_class_ : addresses_by_class_);
Defines elements for storing the names of client classes.
Container that maintains counts of leases per class and lease type.
size_t size(const Lease::Type <ype=Lease::TYPE_V4) const
Get the number of entries for a given lease type.
void adjustClassCounts(data::ConstElementPtr classes, int offset, const Lease::Type <ype=Lease::TYPE_V4)
Adjust the count for a list of classes for a lease type by a signed offset.
void addLease(LeasePtr lease)
Increment the counts for all of a lease's classes by one.
void clear()
Remove all entries.
void removeLease(LeasePtr lease)
Decrement the counts for all of a lease's classes by one.
static data::ConstElementPtr getLeaseClientClasses(LeasePtr lease)
Fetches the list of classes from the lease's user-context.
void updateLease(LeasePtr new_lease, LeasePtr old_lease)
Adjust class lease counts given a new and old version of a lease.
void setClassCount(const ClientClass &client_class, size_t count, const Lease::Type <ype=Lease::TYPE_V4)
Sets the lease count for the given class and lease type to a value.
~ClassLeaseCounter()=default
Destructor.
size_t getClassCount(const ClientClass &client_class, const Lease::Type <ype=Lease::TYPE_V4) const
Fetches the lease count for the given class and lease type.
void adjustClassCount(const ClientClass &client_class, int offset, const Lease::Type <ype=Lease::TYPE_V4)
Adjust the count for a given class and lease type by a signed offset.
std::unordered_map< ClientClass, size_t > ClassCountMap
Defines ClassCountMap as an unordered map of counts.
ClassLeaseCounter()=default
Constructor.
boost::shared_ptr< const Element > ConstElementPtr
std::string ClientClass
Defines a single class name.
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Defines the logger used by the top-level component of kea-lfc.
Type
Type of lease or pool.
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)