summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/pgsql_lease_mgr.h
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2022-06-29 19:56:45 +0200
committerAndrei Pavel <andrei@isc.org>2022-06-30 14:31:05 +0200
commit6ca773c9ae9c6813ea00fb1237d3817e812b3cde (patch)
tree9606d1f71050f9bb428902fd5a62771d9f2e16f3 /src/lib/dhcpsrv/pgsql_lease_mgr.h
parent[#2445] add ChangeLog entry (diff)
downloadkea-6ca773c9ae9c6813ea00fb1237d3817e812b3cde.tar.xz
kea-6ca773c9ae9c6813ea00fb1237d3817e812b3cde.zip
[#2445] add getClassLeaseCount() for MySQL and PostgreSQL
Diffstat (limited to 'src/lib/dhcpsrv/pgsql_lease_mgr.h')
-rw-r--r--src/lib/dhcpsrv/pgsql_lease_mgr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.h b/src/lib/dhcpsrv/pgsql_lease_mgr.h
index 81d831cc84..5329baa732 100644
--- a/src/lib/dhcpsrv/pgsql_lease_mgr.h
+++ b/src/lib/dhcpsrv/pgsql_lease_mgr.h
@@ -702,6 +702,8 @@ public:
CHECK_LEASE4_LIMITS, // Check if allocated IPv4 leases are inside the set limits.
CHECK_LEASE6_LIMITS, // Check if allocated IPv6 leases are inside the set limits.
IS_JSON_SUPPORTED, // Checks if JSON support is enabled in the database.
+ GET_LEASE4_COUNT_BY_CLASS, // Fetches the IPv4 lease count for a given class.
+ GET_LEASE6_COUNT_BY_CLASS, // Fetches the IPv6 lease count for given class and lease type.
NUM_STATEMENTS // Number of statements
};
@@ -950,6 +952,16 @@ private:
/// @return true if there is JSON support, false otherwise
bool isJsonSupported() const override;
+ /// @brief Returns the class lease count for a given class and lease type.
+ ///
+ /// @param client_class client class for which the count is desired
+ /// @param ltype type of lease for which the count is desired. Defaults to
+ /// Lease::TYPE_V4.
+ ///
+ /// @return number of leases
+ virtual size_t getClassLeaseCount(const ClientClass& client_class,
+ const Lease::Type& ltype = Lease::TYPE_V4) const override;
+
/// @brief Context RAII Allocator.
class PgSqlLeaseContextAlloc {
public: