Browse Source

[2140] LeaseMgr minor tweaks, ChangeLog updated.

Tomek Mrugalski 12 years ago
parent
commit
df196f7609
2 changed files with 39 additions and 16 deletions
  1. 6 0
      ChangeLog
  2. 33 16
      src/lib/dhcp/lease_mgr.h

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+4XX.	[func]		tomek
+	libdhcp++: An abstract API for lease database has been
+	implemented. It offers a common interface to all concrete
+	database backends.
+	(Trac #2140, git TBD)
+
 bind10-devel-20120816 released on August 16, 2012
 
 467.	[bug]		jelte

+ 33 - 16
src/lib/dhcp/lease_mgr.h

@@ -21,6 +21,37 @@
 #include <dhcp/option.h>
 #include <dhcp/duid.h>
 
+/// @file dhcp/lease_mgr.h
+/// @brief An abstract API for lease database
+///
+/// This file contains declarations of Lease4, Lease6 and LeaseMgr classes.
+/// They are essential components of the interface to any database backend.
+/// Each concrete database backend (e.g. MySQL) will define a class derived
+/// from LeaseMgr class.
+///
+/// Failover considerations:
+/// There are no intermediate plans to implement DHCPv4 failover
+/// (draft-ietf-dhc-failover-12.txt). Currently (Oct. 2012) the DHCPv6 failover
+/// is being defined in DHC WG in IETF (draft-ietf-dhcpv6-failover-requirements,
+/// draft-ietf-dhcpv6-dailover-design), but the work is not advanced enough
+/// for implementation plans yet. v4 failover requires additional parameters
+/// to be kept with a lease. It is likely that v6 failover will require similar
+/// fields. Such implementation will require database schema extension.
+/// We have designed a way to expand/upgrade schemas during upgrades: a database
+/// schema is versioned and sanity checks about required version will be done
+/// upon start and/or upgrade. With this mechanism in place, we can add new
+/// fields to the database. In particular we can use that capability to
+/// introduce failover related fields.
+///
+/// However, there is another approach that can be reliably used to provide
+/// failover, even without the actual failover protocol implemented. As the
+/// first backend will use MySQL, we will be able to use Multi-Master capability
+/// offered by MySQL and use two separatate Kea instances connecting to the
+/// same database.
+///
+/// Nevertheless, we hope to have failover protocol eventually implemented in
+/// the Kea.
+
 namespace isc {
 namespace dhcp {
 
@@ -102,12 +133,6 @@ struct Lease4 {
     /// @brief did we update PTR record for this lease?
     bool fqdn_rev_;
 
-    /// @brief additional options stored with this lease
-    ///
-    /// This field is currently not used.
-    /// @todo We need a way to store options in the databased.
-    Option::OptionCollection options_;
-
     /// @brief Lease comments.
     ///
     /// Currently not used. It may be used for keeping comments made by the
@@ -220,13 +245,6 @@ struct Lease6 {
     /// @brief did we update PTR record for this lease?
     bool fqdn_rev_;
 
-    /// @brief additional options stored with this lease
-    ///
-    /// That field is currently not used. We may keep extra options assigned
-    /// for leasequery and possibly other purposes.
-    /// @todo We need a way to store options in the databased.
-    Option::OptionCollection options_;
-
     /// @brief Lease comments
     ///
     /// This field is currently not used.
@@ -328,7 +346,7 @@ public:
     /// @param subnet_id identifier of the subnet that lease must belong to
     ///
     /// @return a pointer to the lease (or NULL if a lease is not found)
-    virtual Lease4Ptr getLease4(const HWAddr& hwaddr, 
+    virtual Lease4Ptr getLease4(const HWAddr& hwaddr,
                                 SubnetID subnet_id) const = 0;
 
     /// @brief Returns existing IPv4 lease for specified client-id
@@ -377,7 +395,7 @@ public:
     /// @param iaid IA identifier
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Collection getLease6(const DUID& duid, 
+    virtual Lease6Collection getLease6(const DUID& duid,
                                        uint32_t iaid) const = 0;
 
     /// @brief Returns existing IPv6 lease for a given DUID+IA combination
@@ -457,7 +475,6 @@ protected:
     std::map<std::string, std::string> parameters_;
 };
 
-
 }; // end of isc::dhcp namespace
 
 }; // end of isc namespace