MariaDB Monitor: Move additional classes to separate file

Also use stl containers in monitor definition.
This commit is contained in:
Esa Korhonen
2018-02-20 12:55:33 +02:00
parent cb6f70119d
commit ff55106610
5 changed files with 367 additions and 317 deletions

View File

@ -1,6 +1,5 @@
#pragma once
#ifndef _MARIADBMON_H
#define _MARIADBMON_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -15,29 +14,41 @@
*/
/**
* @file mysqlmon.hh - The MySQL monitor
* @file mariadbmon.hh - The MySQL monitor
*/
#include <maxscale/cppdefs.hh>
#include <string>
#include <tr1/unordered_map>
#include <vector>
#include <maxscale/config.h>
#include <maxscale/dcb.h>
#include <maxscale/hashtable.h>
#include <maxscale/monitor.h>
#include <maxscale/thread.h>
using std::string;
#include "utilities.hh"
extern const int PORT_UNKNOWN;
extern const int64_t SERVER_ID_UNKNOWN;
typedef std::tr1::unordered_map<const MXS_MONITORED_SERVER*, MySqlServerInfo> ServerInfoMap;
typedef std::vector<MXS_MONITORED_SERVER*> ServerVector;
// MySQL Monitor module instance
class MYSQL_MONITOR
class MariaDBMonitor
{
private:
MariaDBMonitor(const MariaDBMonitor&);
MariaDBMonitor& operator = (const MariaDBMonitor&);
public:
MariaDBMonitor();
~MariaDBMonitor();
MXS_MONITOR* monitor; /**< Generic monitor object */
THREAD thread; /**< Monitor thread */
int shutdown; /**< Flag to shutdown the monitor thread */
int status; /**< Monitor status */
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
HASHTABLE *server_info; /**< Contains server specific information */
ServerInfoMap server_info; /**< Contains server specific information */
bool warn_set_standalone_master; /**< Log a warning when setting standalone master */
unsigned long id; /**< Monitor ID */
@ -67,13 +78,10 @@ public:
bool auto_failover; /**< If automatic master failover is enabled */
bool auto_rejoin; /**< Attempt to start slave replication on standalone servers or servers
* replicating from the wrong master automatically. */
MXS_MONITORED_SERVER** excluded_servers; /**< Servers banned for master promotion during auto-failover. */
int n_excluded; /**< Number of excluded servers */
ServerVector excluded_servers; /**< Servers banned for master promotion during auto-failover. */
// Other settings
string script; /**< Script to call when state changes occur on servers */
uint64_t events; /**< enabled events */
bool allow_cluster_recovery; /**< Allow failed servers to rejoin the cluster */
};
#endif