Commit 2f7c21ec authored by Marcin Siodelski's avatar Marcin Siodelski

[3534] Better doxygen documentation for CfgMgr.

parent 1822345b
...@@ -373,7 +373,8 @@ CfgMgr::clear() { ...@@ -373,7 +373,8 @@ CfgMgr::clear() {
void void
CfgMgr::commit() { CfgMgr::commit() {
if (!configs_.empty() && configs_.back() != configuration_) { ensureCurrentAllocated();
if (configs_.back()->sequenceEquals(*configuration_)) {
configuration_ = configs_.back(); configuration_ = configs_.back();
} }
} }
......
...@@ -373,10 +373,46 @@ public: ...@@ -373,10 +373,46 @@ public:
/// @return a reference to the DHCP-DDNS manager. /// @return a reference to the DHCP-DDNS manager.
D2ClientMgr& getD2ClientMgr(); D2ClientMgr& getD2ClientMgr();
/// @name Methods managing the collection of configurations.
///
/// The following methods manage the process of preparing a configuration
/// without affecting a currently used configuration and then commiting
/// the configuration to replace current configuration atomically.
/// They also allow for keeping a history of previous configurations so
/// as the @c CfgMgr can revert to the historical configuration when
/// required.
///
/// @todo Migrate all configuration parameters to use the model supported
/// by these functions.
///
//@{
/// @brief Removes current, staging and all previous configurations.
///
/// This function removes all configurations, including current and
/// staging configurations. It creates a new current configuration with
/// default settings.
///
/// This function is exception safe.
void clear(); void clear();
/// @brief Commits the staging configuration.
///
/// The staging configuration becomes current configuration when this
/// function is called.
///
/// This function is exception safe.
void commit(); void commit();
/// @brief Removes staging configuration.
///
/// This function should be called when there is a staging configuration
/// (likely created in the previous configuration attempt) but the entirely
/// new configuration should be created. It removes the existing staging
/// configuration and the next call to @c CfgMgr::getStaging will return a
/// fresh (default) configuration.
///
/// This function is exception safe.
void rollback(); void rollback();
/// @brief Returns the current configuration. /// @brief Returns the current configuration.
...@@ -384,10 +420,31 @@ public: ...@@ -384,10 +420,31 @@ public:
/// @return a pointer to the current configuration. /// @return a pointer to the current configuration.
ConfigurationPtr getConfiguration(); ConfigurationPtr getConfiguration();
/// @brief Returns a pointer to the current configuration.
///
/// This function returns pointer to the current configuration. If the
/// current configuration is not set it will create a default configuration
/// and return it. Current configuration returned is read-only.
///
/// @return Non-null const pointer to the current configuration.
ConstConfigurationPtr getCurrent(); ConstConfigurationPtr getCurrent();
/// @brief Returns a pointer to the staging configuration.
///
/// The staging configuration is used by the configuration parsers to
/// create new configuration. The staging configuration doesn't affect the
/// server's operation until it is committed. The staging configuration
/// is a non-const object which can be modified by the caller.
///
/// Multiple consecutive calls to this function return the same object
/// which can be modified from various places of the code (e.g. various
/// configuration parsers).
///
/// @return non-null pointer to the staging configuration.
ConfigurationPtr getStaging(); ConfigurationPtr getStaging();
//@}
protected: protected:
/// @brief Protected constructor. /// @brief Protected constructor.
...@@ -419,6 +476,11 @@ protected: ...@@ -419,6 +476,11 @@ protected:
private: private:
/// @brief Checks if current configuration is created and creates if needed.
///
/// This private method is called to ensure that the current configuration
/// is created. If current configuration is not set, it creates the
/// default current configuration.
void ensureCurrentAllocated(); void ensureCurrentAllocated();
/// @brief Checks that the IPv4 subnet with the given id already exists. /// @brief Checks that the IPv4 subnet with the given id already exists.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment