Make the servers-array in Monitor private
This prevents derived classes from modifying the array directly, which would be unsafe.
This commit is contained in:
@ -249,6 +249,8 @@ private:
|
||||
class Monitor
|
||||
{
|
||||
public:
|
||||
using ServerVector = std::vector<MonitorServer*>;
|
||||
|
||||
Monitor(const std::string& name, const std::string& module);
|
||||
virtual ~Monitor();
|
||||
|
||||
@ -301,6 +303,8 @@ public:
|
||||
|
||||
const char* name() const;
|
||||
|
||||
const ServerVector& servers() const;
|
||||
|
||||
/**
|
||||
* Configure the monitor. Called by monitor creation and altering code. Any inheriting classes
|
||||
* should override this with their own configuration processing function. The overriding function
|
||||
@ -396,8 +400,6 @@ public:
|
||||
const std::string m_name; /**< Monitor instance name. */
|
||||
const std::string m_module; /**< Name of the monitor module */
|
||||
|
||||
std::vector<MonitorServer*> m_servers; /**< Monitored servers */
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Stop the monitor. If the monitor uses a polling thread, the thread should be stopped.
|
||||
@ -581,8 +583,9 @@ private:
|
||||
std::atomic_bool m_status_change_pending {false}; /**< Set when admin requests a status change. */
|
||||
uint8_t m_journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */
|
||||
|
||||
MXS_CONFIG_PARAMETER m_parameters; /**< Configuration parameters in text form */
|
||||
Settings m_settings; /**< Base class settings */
|
||||
ServerVector m_servers; /**< Monitored servers */
|
||||
MXS_CONFIG_PARAMETER m_parameters; /**< Configuration parameters in text form */
|
||||
Settings m_settings; /**< Base class settings */
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user