]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2448] make class counter methods virtual in LeaseMgr
authorAndrei Pavel <andrei@isc.org>
Mon, 4 Jul 2022 18:34:01 +0000 (21:34 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 7 Jul 2022 11:48:20 +0000 (11:48 +0000)
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

index 80716b6d2c0047bfe5aa6363e7fb7ca49ed9932b..3ddf47476dedc313d76d21ccada981fe277ab36a 100644 (file)
@@ -792,6 +792,8 @@ public:
         return (io_service_);
     }
 
+    // -- The following are memfile only, but defined in the base LeaseMgr for convenience. --
+
     /// @brief Returns the class lease count for a given class and lease type.
     ///
     /// @param client_class client class for which the count is desired
@@ -802,6 +804,15 @@ public:
     virtual size_t getClassLeaseCount(const ClientClass& client_class,
                                       const Lease::Type& ltype = Lease::TYPE_V4) const = 0;
 
+    /// @brief Recount the leases per class for V4 leases.
+    virtual void recountClassLeases4() = 0;
+
+    /// @brief Recount the leases per class for V6 leases.
+    virtual void recountClassLeases6() = 0;
+
+    /// @brief Clears the class-lease count map.
+    virtual void clearClassLeaseCounts() = 0;
+
 private:
     /// The IOService object, used for all ASIO operations.
     static isc::asiolink::IOServicePtr io_service_;
index 4298c19626ab06a5deb291f183e7e73d12c3ea07..749d358296aeaf29070d2c928763589075ce597b 100644 (file)
@@ -1256,7 +1256,7 @@ public:
     /// user-context.
     ///
     /// Must be called from a thread-safe context.
-    void recountClassLeases4();
+    void recountClassLeases4() override;
 
     /// @brief Recount the leases per class for V6 leases.
     ///
@@ -1265,12 +1265,12 @@ public:
     /// user-context.
     ///
     /// Must be called from a thread-safe context.
-    void recountClassLeases6();
+    void recountClassLeases6() override;
 
     /// @brief Clears the class-lease count map.
     ///
     /// Must be called from a thread-safe context.
-    void clearClassLeaseCounts();
+    void clearClassLeaseCounts() override;
 };
 
 }  // namespace dhcp
index 179ab7a3d7ee83718f0bca09d2220ce7eb53a02c..dfdb097f5b6e6dde0178117262bb22dc5ff86a93 100644 (file)
@@ -3195,6 +3195,21 @@ MySqlLeaseMgr::getClassLeaseCount(const ClientClass& client_class,
     return count;
 }
 
+void
+MySqlLeaseMgr::recountClassLeases4() {
+    isc_throw(NotImplemented, "MySqlLeaseMgr::recountClassLeases4() not implemented");
+}
+
+void
+MySqlLeaseMgr::recountClassLeases6() {
+    isc_throw(NotImplemented, "MySqlLeaseMgr::recountClassLeases6() not implemented");
+}
+
+void
+MySqlLeaseMgr::clearClassLeaseCounts() {
+    isc_throw(NotImplemented, "MySqlLeaseMgr::clearClassLeaseCounts() not implemented");
+}
+
 LeaseStatsQueryPtr
 MySqlLeaseMgr::startLeaseStatsQuery4() {
     // Get a context
index 962aac6a736aed01febabe091a319800f98141c0..046512d3ac6f1a45a7d719b42cf007ecaeff90e9 100644 (file)
@@ -988,6 +988,15 @@ private:
     virtual size_t getClassLeaseCount(const ClientClass& client_class,
                                       const Lease::Type& ltype = Lease::TYPE_V4) const override;
 
+    /// @brief Recount the leases per class for V4 leases.
+    void recountClassLeases4() override;
+
+    /// @brief Recount the leases per class for V6 leases.
+    void recountClassLeases6() override;
+
+    /// @brief Clears the class-lease count map.
+    void clearClassLeaseCounts() override;
+
     /// @brief Check Error and Throw Exception
     ///
     /// This method invokes @ref MySqlConnection::checkError.
index bc3c102e0f1d24dfede37c9dcc748253c4a22626..3701d9a811a83bd51d8b22e626d0e87be9c5f778 100644 (file)
@@ -2398,6 +2398,21 @@ PgSqlLeaseMgr::getClassLeaseCount(const ClientClass& client_class,
     return count;
 }
 
+void
+PgSqlLeaseMgr::recountClassLeases4() {
+    isc_throw(NotImplemented, "PgSqlLeaseMgr::recountClassLeases4() not implemented");
+}
+
+void
+PgSqlLeaseMgr::recountClassLeases6() {
+    isc_throw(NotImplemented, "PgSqlLeaseMgr::recountClassLeases6() not implemented");
+}
+
+void
+PgSqlLeaseMgr::clearClassLeaseCounts() {
+    isc_throw(NotImplemented, "PgSqlLeaseMgr::clearClassLeaseCounts() not implemented");
+}
+
 LeaseStatsQueryPtr
 PgSqlLeaseMgr::startLeaseStatsQuery4() {
     // Get a context
index 5329baa732bb1d543fb52da2989500be78bcc878..fc22207e640e7cd07be69e7cdefb1ba2ae317ff0 100644 (file)
@@ -962,6 +962,15 @@ private:
     virtual size_t getClassLeaseCount(const ClientClass& client_class,
                                       const Lease::Type& ltype = Lease::TYPE_V4) const override;
 
+    /// @brief Recount the leases per class for V4 leases.
+    void recountClassLeases4() override;
+
+    /// @brief Recount the leases per class for V6 leases.
+    void recountClassLeases6() override;
+
+    /// @brief Clears the class-lease count map.
+    void clearClassLeaseCounts() override;
+
     /// @brief Context RAII Allocator.
     class PgSqlLeaseContextAlloc {
     public:
index 08ea901d9ca0ee1272a23cdbdf00f0b7cb111680..6475de001fcf03a6667924e0d2ef3c5019b8527c 100644 (file)
@@ -379,6 +379,21 @@ public:
         isc_throw(NotImplemented, "ConcreteLeaseMgr::getClassLeaseCount() not implemented");
     }
 
+    /// @brief Pretends to recount the leases per class for V4 leases.
+    void recountClassLeases4() override {
+        isc_throw(NotImplemented, "ConcreteLeaseMgr::recountClassLeases4() not implemented");
+    }
+
+    /// @brief Pretends to recount the leases per class for V6 leases.
+    void recountClassLeases6() override {
+        isc_throw(NotImplemented, "ConcreteLeaseMgr::recountClassLeases6() not implemented");
+    }
+
+    /// @brief Pretends to clear the class-lease count map.
+    void clearClassLeaseCounts() override {
+        isc_throw(NotImplemented, "ConcreteLeaseMgr::clearClassLeaseCounts() not implemented");
+    }
+
     /// @brief Returns backend type.
     ///
     /// Returns the type of the backend (e.g. "mysql", "memfile" etc.)