Format core sources again
Formatted with nl_func_type_name and related options set to ignore. This keeps the formatting intact for long return types in declarations and definitions.
This commit is contained in:
@ -36,9 +36,9 @@ class Buffer;
|
|||||||
*/
|
*/
|
||||||
struct BUF_PROPERTY
|
struct BUF_PROPERTY
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
char* value;
|
char* value;
|
||||||
BUF_PROPERTY* next;
|
BUF_PROPERTY* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum gwbuf_type_t
|
enum gwbuf_type_t
|
||||||
@ -60,7 +60,7 @@ enum gwbuf_type_t
|
|||||||
#define GWBUF_IS_REPLY_OK(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLY_OK)
|
#define GWBUF_IS_REPLY_OK(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLY_OK)
|
||||||
|
|
||||||
// True if the query is not initiated by the client but an internal replaying mechanism
|
// True if the query is not initiated by the client but an internal replaying mechanism
|
||||||
#define GWBUF_IS_REPLAYED(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLAYED)
|
#define GWBUF_IS_REPLAYED(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLAYED)
|
||||||
|
|
||||||
// Track session state change response
|
// Track session state change response
|
||||||
#define GWBUF_SHOULD_TRACK_STATE(b) ((b)->gwbuf_type & GWBUF_TYPE_TRACK_STATE)
|
#define GWBUF_SHOULD_TRACK_STATE(b) ((b)->gwbuf_type & GWBUF_TYPE_TRACK_STATE)
|
||||||
@ -115,15 +115,15 @@ struct SHARED_BUF
|
|||||||
*/
|
*/
|
||||||
struct GWBUF
|
struct GWBUF
|
||||||
{
|
{
|
||||||
GWBUF* next; /*< Next buffer in a linked chain of buffers */
|
GWBUF* next; /*< Next buffer in a linked chain of buffers */
|
||||||
GWBUF* tail; /*< Last buffer in a linked chain of buffers */
|
GWBUF* tail; /*< Last buffer in a linked chain of buffers */
|
||||||
void* start; /*< Start of the valid data */
|
void* start; /*< Start of the valid data */
|
||||||
void* end; /*< First byte after the valid data */
|
void* end; /*< First byte after the valid data */
|
||||||
SHARED_BUF* sbuf; /*< The shared buffer with the real data */
|
SHARED_BUF* sbuf; /*< The shared buffer with the real data */
|
||||||
HINT* hint; /*< Hint data for this buffer */
|
HINT* hint; /*< Hint data for this buffer */
|
||||||
BUF_PROPERTY* properties; /*< Buffer properties */
|
BUF_PROPERTY* properties; /*< Buffer properties */
|
||||||
SERVER* server; /*< The target server where the buffer is executed */
|
SERVER* server; /*< The target server where the buffer is executed */
|
||||||
uint32_t gwbuf_type; /*< buffer's data type information */
|
uint32_t gwbuf_type; /*< buffer's data type information */
|
||||||
#ifdef SS_DEBUG
|
#ifdef SS_DEBUG
|
||||||
int owner; /*< Owner of the thread, only for debugging */
|
int owner; /*< Owner of the thread, only for debugging */
|
||||||
#endif
|
#endif
|
||||||
|
@ -245,9 +245,7 @@ enum DurationUnit
|
|||||||
DURATION_IN_MILLISECONDS,
|
DURATION_IN_MILLISECONDS,
|
||||||
DURATION_IN_DEFAULT
|
DURATION_IN_DEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -485,10 +483,10 @@ class CONFIG_CONTEXT
|
|||||||
public:
|
public:
|
||||||
CONFIG_CONTEXT(const std::string& section = "");
|
CONFIG_CONTEXT(const std::string& section = "");
|
||||||
|
|
||||||
std::string m_name; /**< The name of the object being configured */
|
std::string m_name; /**< The name of the object being configured */
|
||||||
MXS_CONFIG_PARAMETER m_parameters; /**< The list of parameter values */
|
MXS_CONFIG_PARAMETER m_parameters; /**< The list of parameter values */
|
||||||
bool m_was_persisted; /**< True if this object was persisted */
|
bool m_was_persisted; /**< True if this object was persisted */
|
||||||
CONFIG_CONTEXT* m_next; /**< Next pointer in the linked list */
|
CONFIG_CONTEXT* m_next; /**< Next pointer in the linked list */
|
||||||
|
|
||||||
const char* name() const
|
const char* name() const
|
||||||
{
|
{
|
||||||
@ -514,11 +512,11 @@ struct MXS_CONFIG
|
|||||||
int maxlog; /**< Log to MaxScale's own logs */
|
int maxlog; /**< Log to MaxScale's own logs */
|
||||||
time_t auth_conn_timeout; /**< Connection timeout for the user
|
time_t auth_conn_timeout; /**< Connection timeout for the user
|
||||||
* authentication */
|
* authentication */
|
||||||
time_t auth_read_timeout; /**< Read timeout for the user authentication */
|
time_t auth_read_timeout; /**< Read timeout for the user authentication */
|
||||||
time_t auth_write_timeout; /**< Write timeout for the user authentication */
|
time_t auth_write_timeout; /**< Write timeout for the user authentication */
|
||||||
bool skip_permission_checks; /**< Skip service and monitor permission checks */
|
bool skip_permission_checks; /**< Skip service and monitor permission checks */
|
||||||
int32_t passive; /**< True if MaxScale is in passive mode */
|
int32_t passive; /**< True if MaxScale is in passive mode */
|
||||||
int64_t promoted_at; /**< Time when this Maxscale instance was
|
int64_t promoted_at; /**< Time when this Maxscale instance was
|
||||||
* promoted from a passive to an active */
|
* promoted from a passive to an active */
|
||||||
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
|
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
|
||||||
char* qc_args; /**< Arguments for the query classifier */
|
char* qc_args; /**< Arguments for the query classifier */
|
||||||
|
@ -44,9 +44,9 @@ public:
|
|||||||
FILTER
|
FILTER
|
||||||
};
|
};
|
||||||
|
|
||||||
using ParamsByName = std::map<std::string, Param*>;
|
using ParamsByName = std::map<std::string, Param*>;
|
||||||
using const_iterator = ParamsByName::const_iterator;
|
using const_iterator = ParamsByName::const_iterator;
|
||||||
using value_type = ParamsByName::value_type;
|
using value_type = ParamsByName::value_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -291,7 +291,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(value_type value) const;
|
std::string to_string(value_type value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -320,7 +321,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(value_type value) const;
|
std::string to_string(value_type value) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -403,8 +405,8 @@ private:
|
|||||||
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_COUNT,
|
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_COUNT,
|
||||||
default_value,
|
default_value,
|
||||||
min_value >= 0 ? min_value : 0,
|
min_value >= 0 ? min_value : 0,
|
||||||
max_value <= std::numeric_limits<uint32_t>::max()
|
max_value <= std::numeric_limits<uint32_t>::max() ?
|
||||||
? max_value : std::numeric_limits<uint32_t>::max())
|
max_value : std::numeric_limits<uint32_t>::max())
|
||||||
{
|
{
|
||||||
mxb_assert(min_value >= 0);
|
mxb_assert(min_value >= 0);
|
||||||
mxb_assert(max_value <= std::numeric_limits<uint32_t>::max());
|
mxb_assert(max_value <= std::numeric_limits<uint32_t>::max());
|
||||||
@ -473,10 +475,10 @@ private:
|
|||||||
value_type max_value)
|
value_type max_value)
|
||||||
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_INT,
|
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_INT,
|
||||||
default_value,
|
default_value,
|
||||||
min_value >= std::numeric_limits<int32_t>::min()
|
min_value >= std::numeric_limits<int32_t>::min() ?
|
||||||
? min_value : std::numeric_limits<int32_t>::min(),
|
min_value : std::numeric_limits<int32_t>::min(),
|
||||||
max_value <= std::numeric_limits<int32_t>::max()
|
max_value <= std::numeric_limits<int32_t>::max() ?
|
||||||
? max_value : std::numeric_limits<int32_t>::max())
|
max_value : std::numeric_limits<int32_t>::max())
|
||||||
{
|
{
|
||||||
mxb_assert(min_value >= std::numeric_limits<int32_t>::min());
|
mxb_assert(min_value >= std::numeric_limits<int32_t>::min());
|
||||||
mxb_assert(max_value <= std::numeric_limits<int32_t>::max());
|
mxb_assert(max_value <= std::numeric_limits<int32_t>::max());
|
||||||
@ -517,7 +519,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(const value_type& value) const;
|
std::string to_string(const value_type& value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -572,7 +575,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(value_type value) const;
|
std::string to_string(value_type value) const;
|
||||||
|
|
||||||
void populate(MXS_MODULE_PARAM& param) const;
|
void populate(MXS_MODULE_PARAM& param) const;
|
||||||
@ -601,11 +605,11 @@ public:
|
|||||||
|
|
||||||
enum Options
|
enum Options
|
||||||
{
|
{
|
||||||
X = MXS_MODULE_OPT_PATH_X_OK, // Execute permission required.
|
X = MXS_MODULE_OPT_PATH_X_OK, // Execute permission required.
|
||||||
R = MXS_MODULE_OPT_PATH_R_OK, // Read permission required.
|
R = MXS_MODULE_OPT_PATH_R_OK, // Read permission required.
|
||||||
W = MXS_MODULE_OPT_PATH_W_OK, // Write permission required.
|
W = MXS_MODULE_OPT_PATH_W_OK, // Write permission required.
|
||||||
F = MXS_MODULE_OPT_PATH_F_OK, // File existence required.
|
F = MXS_MODULE_OPT_PATH_F_OK, // File existence required.
|
||||||
C = MXS_MODULE_OPT_PATH_CREAT // Create path if does not exist.
|
C = MXS_MODULE_OPT_PATH_CREAT // Create path if does not exist.
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32_t MASK = X | R | W | F | C;
|
const uint32_t MASK = X | R | W | F | C;
|
||||||
@ -636,7 +640,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(const value_type& value) const;
|
std::string to_string(const value_type& value) const;
|
||||||
|
|
||||||
void populate(MXS_MODULE_PARAM& param) const;
|
void populate(MXS_MODULE_PARAM& param) const;
|
||||||
@ -690,15 +695,16 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(value_type value) const;
|
std::string to_string(value_type value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ParamSize(Specification* pSpecification,
|
ParamSize(Specification* pSpecification,
|
||||||
const char* zName,
|
const char* zName,
|
||||||
const char* zDescription,
|
const char* zDescription,
|
||||||
Kind kind,
|
Kind kind,
|
||||||
value_type default_value)
|
value_type default_value)
|
||||||
: Param(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_SIZE)
|
: Param(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_SIZE)
|
||||||
, m_default_value(default_value)
|
, m_default_value(default_value)
|
||||||
{
|
{
|
||||||
@ -739,7 +745,8 @@ public:
|
|||||||
|
|
||||||
bool set(Type& value, const std::string& value_as_string) const override;
|
bool set(Type& value, const std::string& value_as_string) const override;
|
||||||
|
|
||||||
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const;
|
bool from_string(const std::string& value, value_type* pValue,
|
||||||
|
std::string* pMessage = nullptr) const;
|
||||||
std::string to_string(value_type value) const;
|
std::string to_string(value_type value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -771,9 +778,9 @@ using ParamBitMask = ParamCount;
|
|||||||
class Configuration
|
class Configuration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using ValuesByName = std::map<std::string, Type*>;
|
using ValuesByName = std::map<std::string, Type*>;
|
||||||
using const_iterator = ValuesByName::const_iterator;
|
using const_iterator = ValuesByName::const_iterator;
|
||||||
using value_type = ValuesByName::value_type;
|
using value_type = ValuesByName::value_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -792,7 +799,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return The corresponding @c Value or NULL if @c name is unknown.
|
* @return The corresponding @c Value or NULL if @c name is unknown.
|
||||||
*/
|
*/
|
||||||
Type* find_value(const std::string& name);
|
Type* find_value(const std::string& name);
|
||||||
const Type* find_value(const std::string& name) const;
|
const Type* find_value(const std::string& name) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -818,7 +825,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Const iterator to first parameter.
|
* @return Const iterator to first parameter.
|
||||||
*/
|
*/
|
||||||
const_iterator cbegin() const
|
const_iterator cbegin() const
|
||||||
@ -856,7 +863,7 @@ class Type
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Type(const Type& rhs) = delete;
|
Type(const Type& rhs) = delete;
|
||||||
Type& operator = (const Type&) = delete;
|
Type& operator=(const Type&) = delete;
|
||||||
|
|
||||||
~Type();
|
~Type();
|
||||||
|
|
||||||
@ -921,7 +928,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
This& operator = (const ConcreteType<This, ParamType>& rhs)
|
This& operator=(const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
// Only the value is copied, the parameter and the configuration
|
// Only the value is copied, the parameter and the configuration
|
||||||
// remains the same.
|
// remains the same.
|
||||||
@ -954,43 +961,43 @@ protected:
|
|||||||
* ConcreteType <-> ConcreteType
|
* ConcreteType <-> ConcreteType
|
||||||
*/
|
*/
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator == (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator==(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() == rhs.get();
|
return lhs.get() == rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator != (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator!=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() != rhs.get();
|
return lhs.get() != rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator < (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator<(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() < rhs.get();
|
return lhs.get() < rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator > (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator>(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() > rhs.get();
|
return lhs.get() > rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator <= (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator<=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.get() < rhs.get()) || (lhs == rhs);
|
return (lhs.get() < rhs.get()) || (lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator>=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.get() > rhs.get()) || (lhs == rhs);
|
return (lhs.get() > rhs.get()) || (lhs == rhs);
|
||||||
}
|
}
|
||||||
@ -1001,43 +1008,43 @@ inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
|
|||||||
* ConcreteType <-> ParamType::value_type
|
* ConcreteType <-> ParamType::value_type
|
||||||
*/
|
*/
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator == (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator==(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() == rhs;
|
return lhs.get() == rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator != (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator!=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() != rhs;
|
return lhs.get() != rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator < (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator<(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() < rhs;
|
return lhs.get() < rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator > (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator>(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() > rhs;
|
return lhs.get() > rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator <= (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator<=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.get() < rhs) || (lhs.get() == rhs);
|
return (lhs.get() < rhs) || (lhs.get() == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
|
inline bool operator>=(const ConcreteType<This, ParamType>& lhs,
|
||||||
const typename ParamType::value_type& rhs)
|
const typename ParamType::value_type& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.get() > rhs) || (lhs.get() == rhs);
|
return (lhs.get() > rhs) || (lhs.get() == rhs);
|
||||||
}
|
}
|
||||||
@ -1048,43 +1055,43 @@ inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
|
|||||||
* ParamType::value_type <-> ConcreteType
|
* ParamType::value_type <-> ConcreteType
|
||||||
*/
|
*/
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator == (const typename ParamType::value_type& lhs,
|
inline bool operator==(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs == rhs.get();
|
return lhs == rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator != (const typename ParamType::value_type& lhs,
|
inline bool operator!=(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs != rhs.get();
|
return lhs != rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator < (const typename ParamType::value_type& lhs,
|
inline bool operator<(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs < rhs.get();
|
return lhs < rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator > (const typename ParamType::value_type& lhs,
|
inline bool operator>(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return lhs > rhs.get();
|
return lhs > rhs.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator <= (const typename ParamType::value_type& lhs,
|
inline bool operator<=(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return (lhs < rhs.get()) || (lhs == rhs.get());
|
return (lhs < rhs.get()) || (lhs == rhs.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class This, class ParamType>
|
template<class This, class ParamType>
|
||||||
inline bool operator >= (const typename ParamType::value_type& lhs,
|
inline bool operator>=(const typename ParamType::value_type& lhs,
|
||||||
const ConcreteType<This,ParamType>& rhs)
|
const ConcreteType<This, ParamType>& rhs)
|
||||||
{
|
{
|
||||||
return (lhs > rhs.get()) || (lhs == rhs.get());
|
return (lhs > rhs.get()) || (lhs == rhs.get());
|
||||||
}
|
}
|
||||||
@ -1147,11 +1154,11 @@ class Bool : public ConcreteType<Bool, ParamBool>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Bool(Configuration* pConfiguration, const ParamBool* pParam)
|
Bool(Configuration* pConfiguration, const ParamBool* pParam)
|
||||||
: ConcreteType<Bool,ParamBool>(pConfiguration, pParam)
|
: ConcreteType<Bool, ParamBool>(pConfiguration, pParam)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool () const
|
explicit operator bool() const
|
||||||
{
|
{
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
@ -1176,18 +1183,18 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template<class T>
|
* template<class T>
|
||||||
inline bool operator < (const Duration<T>& lhs, const Duration<T>& rhs)
|
* inline bool operator < (const Duration<T>& lhs, const Duration<T>& rhs)
|
||||||
{
|
* {
|
||||||
return lhs.get() < rhs.get();
|
* return lhs.get() < rhs.get();
|
||||||
}
|
* }
|
||||||
|
*
|
||||||
template<class T>
|
* template<class T>
|
||||||
inline bool operator > (const Duration<T>& lhs, const Duration<T>& rhs)
|
* inline bool operator > (const Duration<T>& lhs, const Duration<T>& rhs)
|
||||||
{
|
* {
|
||||||
return lhs.get() > rhs.get();
|
* return lhs.get() > rhs.get();
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum
|
* Enum
|
||||||
@ -1230,13 +1237,13 @@ public:
|
|||||||
class Size : public ConcreteType<Size, ParamSize>
|
class Size : public ConcreteType<Size, ParamSize>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Size(Configuration* pConfiguration, const ParamSize* pParam)
|
Size(Configuration* pConfiguration, const ParamSize* pParam)
|
||||||
: ConcreteType(pConfiguration, pParam)
|
: ConcreteType(pConfiguration, pParam)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Size::value_type operator / (const Size& lhs, Size::value_type rhs)
|
inline Size::value_type operator/(const Size& lhs, Size::value_type rhs)
|
||||||
{
|
{
|
||||||
return lhs.get() / rhs;
|
return lhs.get() / rhs;
|
||||||
}
|
}
|
||||||
@ -1380,7 +1387,7 @@ ParamEnum<T>::ParamEnum(Specification* pSpecification,
|
|||||||
m_enum_values.emplace_back(x);
|
m_enum_values.emplace_back(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
MXS_ENUM_VALUE end { NULL };
|
MXS_ENUM_VALUE end {NULL};
|
||||||
m_enum_values.emplace_back(end);
|
m_enum_values.emplace_back(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,7 +1453,7 @@ bool ParamEnum<T>::from_string(const std::string& value_as_string,
|
|||||||
std::string* pMessage) const
|
std::string* pMessage) const
|
||||||
{
|
{
|
||||||
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
|
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
|
||||||
[value_as_string](const std::pair<T,const char*>& elem) {
|
[value_as_string](const std::pair<T, const char*>& elem) {
|
||||||
return value_as_string == elem.second;
|
return value_as_string == elem.second;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1487,7 +1494,7 @@ template<class T>
|
|||||||
std::string ParamEnum<T>::to_string(value_type value) const
|
std::string ParamEnum<T>::to_string(value_type value) const
|
||||||
{
|
{
|
||||||
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
|
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
|
||||||
[value] (const std::pair<T, const char*>& entry) {
|
[value](const std::pair<T, const char*>& entry) {
|
||||||
return entry.first == value;
|
return entry.first == value;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1501,6 +1508,4 @@ void ParamEnum<T>::populate(MXS_MODULE_PARAM& param) const
|
|||||||
|
|
||||||
param.accepted_values = &m_enum_values[0];
|
param.accepted_values = &m_enum_values[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,8 +207,8 @@ struct DCB : public MXB_POLL_DATA
|
|||||||
DCB* next = nullptr; /**< Next DCB in owning thread's list */
|
DCB* next = nullptr; /**< Next DCB in owning thread's list */
|
||||||
DCB* tail = nullptr; /**< Last DCB in owning thread's list */
|
DCB* tail = nullptr; /**< Last DCB in owning thread's list */
|
||||||
} thread;
|
} thread;
|
||||||
uint32_t n_close = 0; /** How many times dcb_close has been called. */
|
uint32_t n_close = 0; /** How many times dcb_close has been called. */
|
||||||
uint64_t m_uid; /**< Unique identifier for this DCB */
|
uint64_t m_uid; /**< Unique identifier for this DCB */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
void add_task(const std::string& name, TASKFN func, void* pData, int frequency);
|
void add_task(const std::string& name, TASKFN func, void* pData, int frequency);
|
||||||
void remove_task(const std::string& name);
|
void remove_task(const std::string& name);
|
||||||
|
|
||||||
void show_tasks(DCB* pDcb) const;
|
void show_tasks(DCB* pDcb) const;
|
||||||
json_t* tasks_to_json(const char* zhost) const;
|
json_t* tasks_to_json(const char* zhost) const;
|
||||||
|
|
||||||
static int64_t ticks();
|
static int64_t ticks();
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
, nextdue(time(0) + frequency)
|
, nextdue(time(0) + frequency)
|
||||||
, id(0)
|
, id(0)
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
TASKFN func;
|
TASKFN func;
|
||||||
@ -85,10 +85,9 @@ private:
|
|||||||
uint32_t id;
|
uint32_t id;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool call_task(Worker::Call::action_t action, Task* pTask);
|
bool call_task(Worker::Call::action_t action, Task* pTask);
|
||||||
static bool inc_ticks(Worker::Call::action_t action);
|
static bool inc_ticks(Worker::Call::action_t action);
|
||||||
|
|
||||||
std::map<std::string, Task> m_tasks_by_name;
|
std::map<std::string, Task> m_tasks_by_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -158,26 +158,26 @@ public:
|
|||||||
class ConnectionSettings
|
class ConnectionSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string username; /**< Monitor username */
|
std::string username; /**< Monitor username */
|
||||||
std::string password; /**< Monitor password */
|
std::string password; /**< Monitor password */
|
||||||
int connect_timeout {1}; /**< Connect timeout in seconds for mysql_real_connect */
|
int connect_timeout {1};/**< Connect timeout in seconds for mysql_real_connect */
|
||||||
int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server.
|
int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server.
|
||||||
* There are retries and the total effective timeout value is two
|
* There are retries and the total effective timeout value is two
|
||||||
* times the option value. */
|
* times the option value. */
|
||||||
int read_timeout {1}; /**< Timeout in seconds to read from the server. There are retries
|
int read_timeout {1}; /**< Timeout in seconds to read from the server. There are retries
|
||||||
* and the total effective timeout value is three times the
|
* and the total effective timeout value is three times the
|
||||||
* option value. */
|
* option value. */
|
||||||
int connect_attempts {1}; /**< How many times a connection is attempted */
|
int connect_attempts {1}; /**< How many times a connection is attempted */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintenance mode request constants.
|
* Maintenance mode request constants.
|
||||||
*/
|
*/
|
||||||
static const int NO_CHANGE = 0;
|
static const int NO_CHANGE = 0;
|
||||||
static const int MAINT_OFF = 1;
|
static const int MAINT_OFF = 1;
|
||||||
static const int MAINT_ON = 2;
|
static const int MAINT_ON = 2;
|
||||||
static const int BEING_DRAINED_OFF = 3;
|
static const int BEING_DRAINED_OFF = 3;
|
||||||
static const int BEING_DRAINED_ON = 4;
|
static const int BEING_DRAINED_ON = 4;
|
||||||
|
|
||||||
MonitorServer(SERVER* server, const SERVER::DiskSpaceLimits& monitor_limits);
|
MonitorServer(SERVER* server, const SERVER::DiskSpaceLimits& monitor_limits);
|
||||||
|
|
||||||
@ -255,20 +255,20 @@ public:
|
|||||||
*/
|
*/
|
||||||
void update_disk_space_status();
|
void update_disk_space_status();
|
||||||
|
|
||||||
SERVER* server = nullptr; /**< The server being monitored */
|
SERVER* server = nullptr; /**< The server being monitored */
|
||||||
MYSQL* con = nullptr; /**< The MySQL connection */
|
MYSQL* con = nullptr; /**< The MySQL connection */
|
||||||
bool log_version_err = true;
|
bool log_version_err = true;
|
||||||
int mon_err_count = 0;
|
int mon_err_count = 0;
|
||||||
|
|
||||||
uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */
|
uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */
|
||||||
uint64_t pending_status = 0; /**< Status during current monitor loop */
|
uint64_t pending_status = 0; /**< Status during current monitor loop */
|
||||||
|
|
||||||
int status_request = NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the
|
int status_request = NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the
|
||||||
* server? */
|
* server? */
|
||||||
private:
|
private:
|
||||||
const SERVER::DiskSpaceLimits& monitor_limits; /**< Monitor-level disk-space limits */
|
const SERVER::DiskSpaceLimits& monitor_limits; /**< Monitor-level disk-space limits */
|
||||||
|
|
||||||
bool ok_to_check_disk_space {true}; /**< Set to false if check fails */
|
bool ok_to_check_disk_space {true}; /**< Set to false if check fails */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,7 +281,7 @@ public:
|
|||||||
virtual ~Monitor();
|
virtual ~Monitor();
|
||||||
|
|
||||||
static const int STATUS_FLAG_NOCHECK = 0;
|
static const int STATUS_FLAG_NOCHECK = 0;
|
||||||
static const int STATUS_FLAG_CHECK = -1;
|
static const int STATUS_FLAG_CHECK = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ping or connect to a database. If connection does not exist or ping fails, a new connection
|
* Ping or connect to a database. If connection does not exist or ping fails, a new connection
|
||||||
@ -419,11 +419,11 @@ public:
|
|||||||
/** Set when admin requests a maintenance status change. */
|
/** Set when admin requests a maintenance status change. */
|
||||||
int check_status_flag = STATUS_FLAG_NOCHECK;
|
int check_status_flag = STATUS_FLAG_NOCHECK;
|
||||||
|
|
||||||
uint64_t m_ticks {0}; /**< Number of performed monitoring intervals */
|
uint64_t m_ticks {0}; /**< Number of performed monitoring intervals */
|
||||||
uint8_t m_journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */
|
uint8_t m_journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */
|
||||||
|
|
||||||
MXS_CONFIG_PARAMETER parameters; /**< Configuration parameters */
|
MXS_CONFIG_PARAMETER parameters; /**< Configuration parameters */
|
||||||
std::vector<MonitorServer*> m_servers; /**< Monitored servers */
|
std::vector<MonitorServer*> m_servers; /**< Monitored servers */
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -536,15 +536,15 @@ protected:
|
|||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int64_t interval {0}; /**< Monitor interval in milliseconds */
|
int64_t interval {0}; /**< Monitor interval in milliseconds */
|
||||||
|
|
||||||
std::string script; /**< Script triggered by events */
|
std::string script; /**< Script triggered by events */
|
||||||
int script_timeout {0}; /**< Timeout in seconds for the monitor scripts */
|
int script_timeout {0}; /**< Timeout in seconds for the monitor scripts */
|
||||||
uint64_t events {0}; /**< Bitfield of events which trigger the script */
|
uint64_t events {0}; /**< Bitfield of events which trigger the script */
|
||||||
|
|
||||||
time_t journal_max_age {0}; /**< Maximum age of journal file */
|
time_t journal_max_age {0}; /**< Maximum age of journal file */
|
||||||
|
|
||||||
SERVER::DiskSpaceLimits disk_space_limits; /**< Disk space thresholds */
|
SERVER::DiskSpaceLimits disk_space_limits; /**< Disk space thresholds */
|
||||||
|
|
||||||
// How often should a disk space check be made at most. Negative values imply disabling.
|
// How often should a disk space check be made at most. Negative values imply disabling.
|
||||||
maxbase::Duration disk_space_check_interval {-1};
|
maxbase::Duration disk_space_check_interval {-1};
|
||||||
@ -580,7 +580,7 @@ private:
|
|||||||
int launch_command(MonitorServer* ptr, EXTERNCMD* cmd);
|
int launch_command(MonitorServer* ptr, EXTERNCMD* cmd);
|
||||||
|
|
||||||
FILE* open_data_file(Monitor* monitor, char* path);
|
FILE* open_data_file(Monitor* monitor, char* path);
|
||||||
int get_data_file_path(char* path) const;
|
int get_data_file_path(char* path) const;
|
||||||
|
|
||||||
mxb::StopWatch m_disk_space_checked; /**< When was disk space checked the last time */
|
mxb::StopWatch m_disk_space_checked; /**< When was disk space checked the last time */
|
||||||
};
|
};
|
||||||
@ -806,7 +806,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void post_tick();
|
virtual void post_tick();
|
||||||
|
|
||||||
MonitorServer* m_master {nullptr}; /**< Master server */
|
MonitorServer* m_master {nullptr}; /**< Master server */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -836,7 +836,6 @@ private:
|
|||||||
|
|
||||||
void pre_loop() final;
|
void pre_loop() final;
|
||||||
void post_loop() final;
|
void post_loop() final;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,6 @@ namespace maxscale
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query,
|
std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query,
|
||||||
std::string* errmsg_out = NULL);
|
std::string* errmsg_out = NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MXS_END_DECLS
|
MXS_END_DECLS
|
||||||
|
@ -67,7 +67,8 @@ struct CloserTraits<pcre2_match_data*>
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
template<> class default_delete<pcre2_code>
|
template<>
|
||||||
|
class default_delete<pcre2_code>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator()(pcre2_code* p)
|
void operator()(pcre2_code* p)
|
||||||
@ -78,6 +79,4 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ struct MXS_PROTOCOL
|
|||||||
*
|
*
|
||||||
* @return The name of the default authenticator
|
* @return The name of the default authenticator
|
||||||
*/
|
*/
|
||||||
char* (*auth_default)();
|
char* (* auth_default)();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle connection limits
|
* Handle connection limits
|
||||||
|
@ -34,8 +34,8 @@ enum qc_init_kind_t
|
|||||||
*/
|
*/
|
||||||
enum qc_option_t
|
enum qc_option_t
|
||||||
{
|
{
|
||||||
QC_OPTION_STRING_ARG_AS_FIELD = (1 << 0), /*< Report a string argument to a function as a field. */
|
QC_OPTION_STRING_ARG_AS_FIELD = (1 << 0), /*< Report a string argument to a function as a field. */
|
||||||
QC_OPTION_STRING_AS_FIELD = (1 << 1), /*< Report strings as fields. */
|
QC_OPTION_STRING_AS_FIELD = (1 << 1), /*< Report strings as fields. */
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32_t QC_OPTION_MASK = QC_OPTION_STRING_ARG_AS_FIELD | QC_OPTION_STRING_AS_FIELD;
|
const uint32_t QC_OPTION_MASK = QC_OPTION_STRING_ARG_AS_FIELD | QC_OPTION_STRING_AS_FIELD;
|
||||||
@ -144,16 +144,16 @@ enum qc_parse_result_t
|
|||||||
*/
|
*/
|
||||||
typedef enum qc_field_context
|
typedef enum qc_field_context
|
||||||
{
|
{
|
||||||
QC_FIELD_UNION = 1, /** The field appears on the right hand side in a UNION. */
|
QC_FIELD_UNION = 1, /** The field appears on the right hand side in a UNION. */
|
||||||
QC_FIELD_SUBQUERY = 2 /** The field appears in a subquery. */
|
QC_FIELD_SUBQUERY = 2 /** The field appears in a subquery. */
|
||||||
} qc_field_context_t;
|
} qc_field_context_t;
|
||||||
|
|
||||||
struct QC_FIELD_INFO
|
struct QC_FIELD_INFO
|
||||||
{
|
{
|
||||||
char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */
|
char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */
|
||||||
char* table; /** Present if the field is of the form "a.b", NULL otherwise. */
|
char* table; /** Present if the field is of the form "a.b", NULL otherwise. */
|
||||||
char* column; /** Always present. */
|
char* column; /** Always present. */
|
||||||
uint32_t context; /** The context in which the field appears. */
|
uint32_t context; /** The context in which the field appears. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,7 +453,7 @@ struct QUERY_CLASSIFIER
|
|||||||
*
|
*
|
||||||
* @return The same info that was provided as argument.
|
* @return The same info that was provided as argument.
|
||||||
*/
|
*/
|
||||||
QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO * info);
|
QC_STMT_INFO* (* qc_info_dup)(QC_STMT_INFO* info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes a dupped info object. After the info object has been closed, it must
|
* Closes a dupped info object. After the info object has been closed, it must
|
||||||
@ -486,7 +486,7 @@ struct QUERY_CLASSIFIER
|
|||||||
*
|
*
|
||||||
* @return The result of the provided info.
|
* @return The result of the provided info.
|
||||||
*/
|
*/
|
||||||
QC_STMT_RESULT (*qc_get_result_from_info)(const QC_STMT_INFO* info);
|
QC_STMT_RESULT (* qc_get_result_from_info)(const QC_STMT_INFO* info);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -531,8 +531,8 @@ struct QC_CACHE_STATS
|
|||||||
*/
|
*/
|
||||||
bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
|
bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
|
||||||
qc_sql_mode_t sql_mode,
|
qc_sql_mode_t sql_mode,
|
||||||
const char* plugin_name,
|
const char* plugin_name,
|
||||||
const char* plugin_args);
|
const char* plugin_args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and setups the default query classifier, and performs
|
* Loads and setups the default query classifier, and performs
|
||||||
@ -554,8 +554,8 @@ bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
|
|||||||
*/
|
*/
|
||||||
bool qc_init(const QC_CACHE_PROPERTIES* cache_properties,
|
bool qc_init(const QC_CACHE_PROPERTIES* cache_properties,
|
||||||
qc_sql_mode_t sql_mode,
|
qc_sql_mode_t sql_mode,
|
||||||
const char* plugin_name,
|
const char* plugin_name,
|
||||||
const char* plugin_args);
|
const char* plugin_args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs thread and process finalization.
|
* Performs thread and process finalization.
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
RouteInfo();
|
RouteInfo();
|
||||||
RouteInfo(uint32_t target,
|
RouteInfo(uint32_t target,
|
||||||
uint8_t command,
|
uint8_t command,
|
||||||
uint32_t type_mask,
|
uint32_t type_mask,
|
||||||
uint32_t stmt_id);
|
uint32_t stmt_id);
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool query_type_is_read_only(uint32_t qtype) const;
|
bool query_type_is_read_only(uint32_t qtype) const;
|
||||||
|
|
||||||
void process_routing_hints(HINT* pHints, uint32_t* target);
|
void process_routing_hints(HINT* pHints, uint32_t* target);
|
||||||
uint32_t get_route_target(uint8_t command, uint32_t qtype);
|
uint32_t get_route_target(uint8_t command, uint32_t qtype);
|
||||||
|
|
||||||
MXS_SESSION* session() const
|
MXS_SESSION* session() const
|
||||||
|
@ -172,7 +172,7 @@ typedef struct mxs_router_object
|
|||||||
void (* clientReply)(MXS_ROUTER* instance,
|
void (* clientReply)(MXS_ROUTER* instance,
|
||||||
MXS_ROUTER_SESSION* router_session,
|
MXS_ROUTER_SESSION* router_session,
|
||||||
GWBUF* queue,
|
GWBUF* queue,
|
||||||
DCB* backend_dcb);
|
DCB* backend_dcb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Called when a backend DCB has failed
|
* @brief Called when a backend DCB has failed
|
||||||
@ -188,7 +188,7 @@ typedef struct mxs_router_object
|
|||||||
void (* handleError)(MXS_ROUTER* instance,
|
void (* handleError)(MXS_ROUTER* instance,
|
||||||
MXS_ROUTER_SESSION* router_session,
|
MXS_ROUTER_SESSION* router_session,
|
||||||
GWBUF* errmsgbuf,
|
GWBUF* errmsgbuf,
|
||||||
DCB* backend_dcb,
|
DCB* backend_dcb,
|
||||||
mxs_error_action_t action,
|
mxs_error_action_t action,
|
||||||
bool* succp);
|
bool* succp);
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ public:
|
|||||||
* @param pSuccess On output, if false, the session will be terminated.
|
* @param pSuccess On output, if false, the session will be terminated.
|
||||||
*/
|
*/
|
||||||
void handleError(GWBUF* pMessage,
|
void handleError(GWBUF* pMessage,
|
||||||
DCB* pProblem,
|
DCB* pProblem,
|
||||||
mxs_error_action_t action,
|
mxs_error_action_t action,
|
||||||
bool* pSuccess);
|
bool* pSuccess);
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ public:
|
|||||||
static void handleError(MXS_ROUTER* pInstance,
|
static void handleError(MXS_ROUTER* pInstance,
|
||||||
MXS_ROUTER_SESSION* pData,
|
MXS_ROUTER_SESSION* pData,
|
||||||
GWBUF* pMessage,
|
GWBUF* pMessage,
|
||||||
DCB* pProblem,
|
DCB* pProblem,
|
||||||
mxs_error_action_t action,
|
mxs_error_action_t action,
|
||||||
bool* pSuccess)
|
bool* pSuccess)
|
||||||
{
|
{
|
||||||
|
@ -655,10 +655,11 @@ private:
|
|||||||
static uint32_t epoll_instance_handler(MXB_POLL_DATA* data, MXB_WORKER* worker, uint32_t events);
|
static uint32_t epoll_instance_handler(MXB_POLL_DATA* data, MXB_WORKER* worker, uint32_t events);
|
||||||
uint32_t handle_epoll_events(uint32_t events);
|
uint32_t handle_epoll_events(uint32_t events);
|
||||||
|
|
||||||
static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */
|
static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */
|
||||||
static maxbase::TimePoint s_watchdog_next_check; /*< Next time to notify systemd. */
|
static maxbase::TimePoint s_watchdog_next_check;/*< Next time to notify systemd. */
|
||||||
std::atomic<bool> m_alive; /*< Set to true in epoll_tick(), false on notification. */
|
std::atomic<bool> m_alive; /*< Set to true in epoll_tick(), false on
|
||||||
WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */
|
* notification. */
|
||||||
|
WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */
|
||||||
};
|
};
|
||||||
|
|
||||||
using WatchdogWorkaround = RoutingWorker::WatchdogWorkaround;
|
using WatchdogWorkaround = RoutingWorker::WatchdogWorkaround;
|
||||||
|
@ -202,7 +202,7 @@ public:
|
|||||||
// Misc fields
|
// Misc fields
|
||||||
bool master_err_is_logged = false; /**< If node failed, this indicates whether it is logged. Only
|
bool master_err_is_logged = false; /**< If node failed, this indicates whether it is logged. Only
|
||||||
* used by rwsplit. TODO: Move to rwsplit */
|
* used by rwsplit. TODO: Move to rwsplit */
|
||||||
bool warn_ssl_not_enabled = true; /**< SSL not used for an SSL enabled server */
|
bool warn_ssl_not_enabled = true; /**< SSL not used for an SSL enabled server */
|
||||||
RLagState rlag_state = RLagState::NONE; /**< Is replication lag above or under limit? Used by rwsplit. */
|
RLagState rlag_state = RLagState::NONE; /**< Is replication lag above or under limit? Used by rwsplit. */
|
||||||
|
|
||||||
virtual ~SERVER() = default;
|
virtual ~SERVER() = default;
|
||||||
@ -520,13 +520,13 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
SERVER()
|
SERVER()
|
||||||
: m_response_time(maxbase::EMAverage {0.04, 0.35, 500})
|
: m_response_time(maxbase::EMAverage {0.04, 0.35, 500})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static const int DEFAULT_CHARSET = 0x08; /**< The latin1 charset */
|
static const int DEFAULT_CHARSET = 0x08; /**< The latin1 charset */
|
||||||
maxbase::EMAverage m_response_time; /**< Response time calculations for this server */
|
maxbase::EMAverage m_response_time; /**< Response time calculations for this server */
|
||||||
std::mutex m_average_write_mutex; /**< Protects response time from concurrent writing */
|
std::mutex m_average_write_mutex; /**< Protects response time from concurrent writing */
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace maxscale
|
namespace maxscale
|
||||||
@ -550,5 +550,4 @@ bool server_set_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
|
|||||||
* @param errmsg_out Error output
|
* @param errmsg_out Error output
|
||||||
*/
|
*/
|
||||||
bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
|
bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
bool localhost_match_wildcard_host; /**< Match localhost against wildcard
|
bool localhost_match_wildcard_host; /**< Match localhost against wildcard
|
||||||
* */
|
* */
|
||||||
MXS_CONFIG_PARAMETER svc_config_param; /**< list of config params and values */
|
MXS_CONFIG_PARAMETER svc_config_param; /**< list of config params and values */
|
||||||
int svc_config_version; /**< Version number of configuration
|
int svc_config_version; /**< Version number of configuration
|
||||||
* */
|
* */
|
||||||
bool svc_do_shutdown; /**< tells the service to exit loops
|
bool svc_do_shutdown; /**< tells the service to exit loops
|
||||||
* etc. */
|
* etc. */
|
||||||
@ -155,8 +155,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
SERVICE(const std::string& name,
|
SERVICE(const std::string& name,
|
||||||
const std::string& router_name)
|
const std::string& router_name)
|
||||||
: m_name(name) /** Service name. */
|
: m_name(name)
|
||||||
, m_router_name(router_name) /** Router module. */
|
, m_router_name(router_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ uint64_t session_get_current_id();
|
|||||||
* @return True, if the variable could be added, false otherwise.
|
* @return True, if the variable could be added, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool session_add_variable(MXS_SESSION* session,
|
bool session_add_variable(MXS_SESSION* session,
|
||||||
const char* name,
|
const char* name,
|
||||||
session_variable_handler_t handler,
|
session_variable_handler_t handler,
|
||||||
void* context);
|
void* context);
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ bool session_add_variable(MXS_SESSION* session,
|
|||||||
* @return True, if the variable existed, false otherwise.
|
* @return True, if the variable existed, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool session_remove_variable(MXS_SESSION* session,
|
bool session_remove_variable(MXS_SESSION* session,
|
||||||
const char* name,
|
const char* name,
|
||||||
void** context);
|
void** context);
|
||||||
/**
|
/**
|
||||||
* @brief Set value of maxscale session variable.
|
* @brief Set value of maxscale session variable.
|
||||||
@ -542,10 +542,10 @@ bool session_remove_variable(MXS_SESSION* session,
|
|||||||
* incoming statements.
|
* incoming statements.
|
||||||
*/
|
*/
|
||||||
char* session_set_variable_value(MXS_SESSION* session,
|
char* session_set_variable_value(MXS_SESSION* session,
|
||||||
const char* name_begin,
|
const char* name_begin,
|
||||||
const char* name_end,
|
const char* name_end,
|
||||||
const char* value_begin,
|
const char* value_begin,
|
||||||
const char* value_end);
|
const char* value_end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specify how many statements each session should retain for
|
* @brief Specify how many statements each session should retain for
|
||||||
|
@ -312,7 +312,8 @@ template<typename T>
|
|||||||
class EqualPointees : public std::unary_function<T, bool>
|
class EqualPointees : public std::unary_function<T, bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EqualPointees(const T& lhs) : m_ppLhs(&lhs)
|
EqualPointees(const T& lhs)
|
||||||
|
: m_ppLhs(&lhs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
bool operator()(const T& pRhs)
|
bool operator()(const T& pRhs)
|
||||||
|
@ -60,7 +60,7 @@ bool runtime_create_server(const char* name,
|
|||||||
const char* port,
|
const char* port,
|
||||||
const char* protocol,
|
const char* protocol,
|
||||||
const char* authenticator,
|
const char* authenticator,
|
||||||
bool external = true);
|
bool external = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy a server
|
* @brief Destroy a server
|
||||||
|
@ -50,7 +50,7 @@ SFilterDef filter_alloc(const char* name, const char* module, MXS_CONFIG_PA
|
|||||||
MXS_DOWNSTREAM* filter_apply(const SFilterDef& filter_def, MXS_SESSION* session, MXS_DOWNSTREAM* downstream);
|
MXS_DOWNSTREAM* filter_apply(const SFilterDef& filter_def, MXS_SESSION* session, MXS_DOWNSTREAM* downstream);
|
||||||
void filter_free(const SFilterDef& filter);
|
void filter_free(const SFilterDef& filter);
|
||||||
int filter_standard_parameter(const char* name);
|
int filter_standard_parameter(const char* name);
|
||||||
MXS_UPSTREAM* filter_upstream(const SFilterDef& filter_def,
|
MXS_UPSTREAM* filter_upstream(const SFilterDef& filter_def,
|
||||||
MXS_FILTER_SESSION* fsession,
|
MXS_FILTER_SESSION* fsession,
|
||||||
MXS_UPSTREAM* upstream);
|
MXS_UPSTREAM* upstream);
|
||||||
|
|
||||||
|
@ -26,23 +26,23 @@ static const MXS_ENUM_VALUE mxs_monitor_event_default_enum = {"all", ~0ULL};
|
|||||||
static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] =
|
static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] =
|
||||||
{
|
{
|
||||||
mxs_monitor_event_default_enum,
|
mxs_monitor_event_default_enum,
|
||||||
{"master_down", MASTER_DOWN_EVENT},
|
{"master_down", MASTER_DOWN_EVENT },
|
||||||
{"master_up", MASTER_UP_EVENT},
|
{"master_up", MASTER_UP_EVENT },
|
||||||
{"slave_down", SLAVE_DOWN_EVENT},
|
{"slave_down", SLAVE_DOWN_EVENT },
|
||||||
{"slave_up", SLAVE_UP_EVENT},
|
{"slave_up", SLAVE_UP_EVENT },
|
||||||
{"server_down", SERVER_DOWN_EVENT},
|
{"server_down", SERVER_DOWN_EVENT },
|
||||||
{"server_up", SERVER_UP_EVENT},
|
{"server_up", SERVER_UP_EVENT },
|
||||||
{"synced_down", SYNCED_DOWN_EVENT},
|
{"synced_down", SYNCED_DOWN_EVENT },
|
||||||
{"synced_up", SYNCED_UP_EVENT},
|
{"synced_up", SYNCED_UP_EVENT },
|
||||||
{"donor_down", DONOR_DOWN_EVENT},
|
{"donor_down", DONOR_DOWN_EVENT },
|
||||||
{"donor_up", DONOR_UP_EVENT},
|
{"donor_up", DONOR_UP_EVENT },
|
||||||
{"lost_master", LOST_MASTER_EVENT},
|
{"lost_master", LOST_MASTER_EVENT },
|
||||||
{"lost_slave", LOST_SLAVE_EVENT},
|
{"lost_slave", LOST_SLAVE_EVENT },
|
||||||
{"lost_synced", LOST_SYNCED_EVENT},
|
{"lost_synced", LOST_SYNCED_EVENT },
|
||||||
{"lost_donor", LOST_DONOR_EVENT},
|
{"lost_donor", LOST_DONOR_EVENT },
|
||||||
{"new_master", NEW_MASTER_EVENT},
|
{"new_master", NEW_MASTER_EVENT },
|
||||||
{"new_slave", NEW_SLAVE_EVENT},
|
{"new_slave", NEW_SLAVE_EVENT },
|
||||||
{"new_synced", NEW_SYNCED_EVENT},
|
{"new_synced", NEW_SYNCED_EVENT },
|
||||||
{"new_donor", NEW_DONOR_EVENT},
|
{"new_donor", NEW_DONOR_EVENT },
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,7 @@ class MonitorStop
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MonitorStop(mxs::Monitor* monitor)
|
MonitorStop(mxs::Monitor* monitor)
|
||||||
: m_monitor(monitor->state() == MONITOR_STATE_RUNNING ? monitor : nullptr)
|
: m_monitor(monitor->state() == MONITOR_STATE_RUNNING ? monitor : nullptr)
|
||||||
{
|
{
|
||||||
if (m_monitor)
|
if (m_monitor)
|
||||||
{
|
{
|
||||||
@ -168,4 +168,4 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mxs::Monitor* m_monitor;
|
mxs::Monitor* m_monitor;
|
||||||
};
|
};
|
||||||
|
@ -109,7 +109,7 @@ public:
|
|||||||
mutable std::mutex lock;
|
mutable std::mutex lock;
|
||||||
|
|
||||||
// TODO: Make this private.
|
// TODO: Make this private.
|
||||||
mxs::Monitor* m_monitor { nullptr }; /**< A possibly associated monitor */
|
mxs::Monitor* m_monitor {nullptr}; /**< A possibly associated monitor */
|
||||||
|
|
||||||
bool uses_cluster() const
|
bool uses_cluster() const
|
||||||
{
|
{
|
||||||
|
@ -1229,7 +1229,7 @@ void Session::dump_statements() const
|
|||||||
const QueryInfo& info = *i;
|
const QueryInfo& info = *i;
|
||||||
GWBUF* pBuffer = info.query().get();
|
GWBUF* pBuffer = info.query().get();
|
||||||
timespec ts = info.time_completed();
|
timespec ts = info.time_completed();
|
||||||
struct tm *tm = localtime(&ts.tv_sec);
|
struct tm* tm = localtime(&ts.tv_sec);
|
||||||
char timestamp[20];
|
char timestamp[20];
|
||||||
strftime(timestamp, 20, "%Y-%m-%d %H:%M:%S", tm);
|
strftime(timestamp, 20, "%Y-%m-%d %H:%M:%S", tm);
|
||||||
|
|
||||||
|
@ -35,16 +35,16 @@ int test_validity()
|
|||||||
|
|
||||||
MXS_MODULE_PARAM params[] =
|
MXS_MODULE_PARAM params[] =
|
||||||
{
|
{
|
||||||
{"p1", MXS_MODULE_PARAM_INT, "-123" },
|
{"p1", MXS_MODULE_PARAM_INT, "-123" },
|
||||||
{"p2", MXS_MODULE_PARAM_COUNT, "123" },
|
{"p2", MXS_MODULE_PARAM_COUNT, "123" },
|
||||||
{"p3", MXS_MODULE_PARAM_BOOL, "true" },
|
{"p3", MXS_MODULE_PARAM_BOOL, "true" },
|
||||||
{"p4", MXS_MODULE_PARAM_STRING, "default" },
|
{"p4", MXS_MODULE_PARAM_STRING, "default" },
|
||||||
{"p5", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_NONE, enum_values},
|
{"p5", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_NONE, enum_values},
|
||||||
{"p6", MXS_MODULE_PARAM_PATH, "/tmp", MXS_MODULE_OPT_PATH_F_OK},
|
{"p6", MXS_MODULE_PARAM_PATH, "/tmp", MXS_MODULE_OPT_PATH_F_OK},
|
||||||
{"p7", MXS_MODULE_PARAM_SERVICE, "my-service" },
|
{"p7", MXS_MODULE_PARAM_SERVICE, "my-service" },
|
||||||
{"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values},
|
{"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values},
|
||||||
{"p9", MXS_MODULE_PARAM_DURATION, "4711s" },
|
{"p9", MXS_MODULE_PARAM_DURATION, "4711s" },
|
||||||
{"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S },
|
{"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S},
|
||||||
{MXS_END_MODULE_PARAMS}
|
{MXS_END_MODULE_PARAMS}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
inline ostream& operator << (ostream& out, const std::chrono::seconds& x)
|
inline ostream& operator<<(ostream& out, const std::chrono::seconds& x)
|
||||||
{
|
{
|
||||||
out << x.count();
|
out << x.count();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x)
|
inline ostream& operator<<(ostream& out, const std::chrono::milliseconds& x)
|
||||||
{
|
{
|
||||||
out << x.count();
|
out << x.count();
|
||||||
return out;
|
return out;
|
||||||
@ -37,19 +37,19 @@ inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x)
|
|||||||
config::Specification specification("test_module", config::Specification::FILTER);
|
config::Specification specification("test_module", config::Specification::FILTER);
|
||||||
|
|
||||||
config::ParamBool
|
config::ParamBool
|
||||||
param_bool(&specification,
|
param_bool(&specification,
|
||||||
"boolean_parameter",
|
"boolean_parameter",
|
||||||
"Specifies whether something is enabled.");
|
"Specifies whether something is enabled.");
|
||||||
|
|
||||||
config::ParamCount
|
config::ParamCount
|
||||||
param_count(&specification,
|
param_count(&specification,
|
||||||
"count_parameter",
|
"count_parameter",
|
||||||
"Specifies the cardinality of something.");
|
"Specifies the cardinality of something.");
|
||||||
|
|
||||||
config::ParamInteger
|
config::ParamInteger
|
||||||
param_integer(&specification,
|
param_integer(&specification,
|
||||||
"integer_parameter",
|
"integer_parameter",
|
||||||
"Specifies a number.");
|
"Specifies a number.");
|
||||||
|
|
||||||
config::ParamDuration<std::chrono::seconds>
|
config::ParamDuration<std::chrono::seconds>
|
||||||
param_duration_1(&specification,
|
param_duration_1(&specification,
|
||||||
@ -73,26 +73,26 @@ config::ParamEnum<Enum>
|
|||||||
param_enum(&specification,
|
param_enum(&specification,
|
||||||
"enum_parameter",
|
"enum_parameter",
|
||||||
"Specifies a range of values.",
|
"Specifies a range of values.",
|
||||||
{
|
{
|
||||||
{ ENUM_ONE, "one" },
|
{ENUM_ONE, "one"},
|
||||||
{ ENUM_TWO, "two" }
|
{ENUM_TWO, "two"}
|
||||||
});
|
});
|
||||||
|
|
||||||
config::ParamPath
|
config::ParamPath
|
||||||
param_path(&specification,
|
param_path(&specification,
|
||||||
"path_parameter",
|
"path_parameter",
|
||||||
"Specifies the path of something.",
|
"Specifies the path of something.",
|
||||||
config::ParamPath::F);
|
config::ParamPath::F);
|
||||||
|
|
||||||
config::ParamSize
|
config::ParamSize
|
||||||
param_size(&specification,
|
param_size(&specification,
|
||||||
"size_parameter",
|
"size_parameter",
|
||||||
"Specifies the size of something.");
|
"Specifies the size of something.");
|
||||||
|
|
||||||
config::ParamString
|
config::ParamString
|
||||||
param_string(&specification,
|
param_string(&specification,
|
||||||
"string_parameter",
|
"string_parameter",
|
||||||
"Specifies the name of something.");
|
"Specifies the name of something.");
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct TestEntry
|
struct TestEntry
|
||||||
@ -102,7 +102,7 @@ struct TestEntry
|
|||||||
T value;
|
T value;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define elements_in_array(x) (sizeof(x)/sizeof(x[0]))
|
#define elements_in_array(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
int test(T& value, const TestEntry<typename T::value_type>* pEntries, int nEntries)
|
int test(T& value, const TestEntry<typename T::value_type>* pEntries, int nEntries)
|
||||||
@ -151,17 +151,17 @@ int test_bool(config::Bool& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Bool::value_type> entries[] =
|
static const TestEntry<config::Bool::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "1", true, true },
|
{"1", true, true },
|
||||||
{ "0", true, false },
|
{"0", true, false},
|
||||||
{ "true", true, true },
|
{"true", true, true },
|
||||||
{ "false", true, false },
|
{"false", true, false},
|
||||||
{ "on", true, true },
|
{"on", true, true },
|
||||||
{ "off", true, false },
|
{"off", true, false},
|
||||||
|
|
||||||
{ "2", false },
|
{"2", false},
|
||||||
{ "truth", false },
|
{"truth", false},
|
||||||
{ "%&", false },
|
{"%&", false},
|
||||||
{ "-1", false },
|
{"-1", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -171,13 +171,13 @@ int test_count(config::Count& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Count::value_type> entries[] =
|
static const TestEntry<config::Count::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "1", true, 1 },
|
{"1", true, 1 },
|
||||||
{ "9999", true, 9999 },
|
{"9999", true, 9999},
|
||||||
{ "0", true, 0 },
|
{"0", true, 0 },
|
||||||
|
|
||||||
{ "0x45", false },
|
{"0x45", false},
|
||||||
{ "blah", false },
|
{"blah", false},
|
||||||
{ "-1", false },
|
{"-1", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -187,16 +187,16 @@ int test_duration(config::Duration<std::chrono::seconds>& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Duration<std::chrono::seconds>::value_type> entries[] =
|
static const TestEntry<config::Duration<std::chrono::seconds>::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "1", true, std::chrono::seconds { 1 } },
|
{"1", true, std::chrono::seconds {1 }},
|
||||||
{ "1ms", true, std::chrono::seconds { 0 } },
|
{"1ms", true, std::chrono::seconds {0 }},
|
||||||
{ "1s", true, std::chrono::seconds { 1 } },
|
{"1s", true, std::chrono::seconds {1 }},
|
||||||
{ "1m", true, std::chrono::seconds { 60 } },
|
{"1m", true, std::chrono::seconds {60 }},
|
||||||
{ "1h", true, std::chrono::seconds { 3600 } },
|
{"1h", true, std::chrono::seconds {3600}},
|
||||||
|
|
||||||
{ "1x", false },
|
{"1x", false},
|
||||||
{ "a", false },
|
{"a", false},
|
||||||
{ "-", false },
|
{"-", false},
|
||||||
{ "second", false }
|
{"second", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -206,16 +206,16 @@ int test_duration(config::Duration<std::chrono::milliseconds>& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Duration<std::chrono::milliseconds>::value_type> entries[] =
|
static const TestEntry<config::Duration<std::chrono::milliseconds>::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "1", true, std::chrono::milliseconds { 1 } },
|
{"1", true, std::chrono::milliseconds {1 }},
|
||||||
{ "1ms", true, std::chrono::milliseconds { 1 } },
|
{"1ms", true, std::chrono::milliseconds {1 }},
|
||||||
{ "1s", true, std::chrono::milliseconds { 1000 } },
|
{"1s", true, std::chrono::milliseconds {1000 }},
|
||||||
{ "1m", true, std::chrono::milliseconds { 60000 } },
|
{"1m", true, std::chrono::milliseconds {60000 }},
|
||||||
{ "1h", true, std::chrono::milliseconds { 3600000 } },
|
{"1h", true, std::chrono::milliseconds {3600000}},
|
||||||
|
|
||||||
{ "1x", false },
|
{"1x", false},
|
||||||
{ "a", false },
|
{"a", false},
|
||||||
{ "-", false },
|
{"-", false},
|
||||||
{ "second", false }
|
{"second", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -225,12 +225,12 @@ int test_enum(config::Enum<Enum>& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<Enum> entries[] =
|
static const TestEntry<Enum> entries[] =
|
||||||
{
|
{
|
||||||
{ "one", true, ENUM_ONE },
|
{"one", true, ENUM_ONE},
|
||||||
{ "two", true, ENUM_TWO },
|
{"two", true, ENUM_TWO},
|
||||||
|
|
||||||
{ "blah", false },
|
{"blah", false},
|
||||||
{ "1", false },
|
{"1", false},
|
||||||
{ "ones", false }
|
{"ones", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -243,8 +243,8 @@ int test_path(config::Path& value)
|
|||||||
|
|
||||||
static const TestEntry<config::Path::value_type> entries[] =
|
static const TestEntry<config::Path::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{strpath, true, strpath},
|
{strpath, true, strpath},
|
||||||
{"/tmp", true, "/tmp"},
|
{"/tmp", true, "/tmp" },
|
||||||
|
|
||||||
{"non-existent", false}
|
{"non-existent", false}
|
||||||
};
|
};
|
||||||
@ -256,11 +256,11 @@ int test_size(config::Size& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Size::value_type> entries[] =
|
static const TestEntry<config::Size::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "0", true, 0 },
|
{"0", true, 0 },
|
||||||
{ "100", true, 100 },
|
{"100", true, 100},
|
||||||
|
|
||||||
{ "-100", false },
|
{"-100", false},
|
||||||
{ "0x100", false },
|
{"0x100", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -270,13 +270,13 @@ int test_string(config::String& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::String::value_type> entries[] =
|
static const TestEntry<config::String::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "blah", true, "blah" },
|
{"blah", true, "blah" },
|
||||||
{ "\"blah\"", true, "blah" },
|
{"\"blah\"", true, "blah" },
|
||||||
{ "'blah'", true, "blah" },
|
{"'blah'", true, "blah" },
|
||||||
{ "123", true, "123" },
|
{"123", true, "123" },
|
||||||
{ "`blah`", true, "`blah`" },
|
{"`blah`", true, "`blah`"},
|
||||||
|
|
||||||
{ "'blah\"", false }
|
{"'blah\"", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -286,15 +286,15 @@ int test_integer(config::Integer& value)
|
|||||||
{
|
{
|
||||||
static const TestEntry<config::Integer::value_type> entries[] =
|
static const TestEntry<config::Integer::value_type> entries[] =
|
||||||
{
|
{
|
||||||
{ "0", true, 0 },
|
{"0", true, 0 },
|
||||||
{ "-1", true, -1 },
|
{"-1", true, -1 },
|
||||||
{ "1", true, 1 },
|
{"1", true, 1 },
|
||||||
{ "-2147483648", true, -2147483648 },
|
{"-2147483648", true, -2147483648},
|
||||||
{ "2147483647", true, 2147483647 },
|
{"2147483647", true, 2147483647 },
|
||||||
|
|
||||||
{ "-2147483649", false },
|
{"-2147483649", false},
|
||||||
{ "2147483648", false },
|
{"2147483648", false},
|
||||||
{ "0x10" , false },
|
{"0x10", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
return test(value, entries, elements_in_array(entries));
|
return test(value, entries, elements_in_array(entries));
|
||||||
@ -304,9 +304,9 @@ int main()
|
|||||||
{
|
{
|
||||||
mxb::Log log;
|
mxb::Log log;
|
||||||
|
|
||||||
for_each(specification.cbegin(), specification.cend(),[](const config::Specification::value_type& p) {
|
for_each(specification.cbegin(), specification.cend(), [](const config::Specification::value_type& p) {
|
||||||
cout << p.second->documentation() << endl;
|
cout << p.second->documentation() << endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ namespace
|
|||||||
{
|
{
|
||||||
|
|
||||||
MXS_CONFIG_PARAMETER empty;
|
MXS_CONFIG_PARAMETER empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* test1 Filter creation, finding and deletion
|
* test1 Filter creation, finding and deletion
|
||||||
|
@ -26,29 +26,29 @@ namespace
|
|||||||
std::atomic<int> n_oneshot;
|
std::atomic<int> n_oneshot;
|
||||||
std::atomic<int> n_repeating;
|
std::atomic<int> n_repeating;
|
||||||
|
|
||||||
const char* ZONESHOT_NAME = "OneShot";
|
const char* ZONESHOT_NAME = "OneShot";
|
||||||
const char* ZREPEATING_NAME = "Repeating";
|
const char* ZREPEATING_NAME = "Repeating";
|
||||||
|
|
||||||
bool oneshot(void*)
|
bool oneshot(void*)
|
||||||
{
|
{
|
||||||
++n_oneshot;
|
++n_oneshot;
|
||||||
return false; // Remove from housekeeper.
|
return false; // Remove from housekeeper.
|
||||||
}
|
}
|
||||||
|
|
||||||
bool repeating(void*)
|
bool repeating(void*)
|
||||||
{
|
{
|
||||||
++n_repeating;
|
++n_repeating;
|
||||||
return true; // Continue calling.
|
return true; // Continue calling.
|
||||||
}
|
}
|
||||||
|
|
||||||
int test()
|
int test()
|
||||||
{
|
{
|
||||||
int rc = EXIT_SUCCESS;
|
int rc = EXIT_SUCCESS;
|
||||||
|
|
||||||
hktask_add(ZONESHOT_NAME, oneshot, nullptr, 1); // Call oneshot, once per second.
|
hktask_add(ZONESHOT_NAME, oneshot, nullptr, 1); // Call oneshot, once per second.
|
||||||
hktask_add(ZREPEATING_NAME, repeating, nullptr, 1); // Call repeating, once per second.
|
hktask_add(ZREPEATING_NAME, repeating, nullptr, 1); // Call repeating, once per second.
|
||||||
|
|
||||||
sleep(4); // Should get 1 oneshot call and ~4 repeating calls.
|
sleep(4); // Should get 1 oneshot call and ~4 repeating calls.
|
||||||
|
|
||||||
hktask_remove(ZREPEATING_NAME);
|
hktask_remove(ZREPEATING_NAME);
|
||||||
|
|
||||||
@ -84,7 +84,6 @@ int test()
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
@ -72,7 +72,6 @@ int test_checksums()
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
@ -40,7 +40,7 @@ void preload_module(const char* name, const char* path, const char* type)
|
|||||||
set_libdir(MXS_STRDUP(old_libdir.c_str()));
|
set_libdir(MXS_STRDUP(old_libdir.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_test_env(char* __attribute((unused)) path = nullptr, uint32_t init_type = QC_INIT_BOTH)
|
void init_test_env(char* __attribute((unused))path = nullptr, uint32_t init_type = QC_INIT_BOTH)
|
||||||
{
|
{
|
||||||
config_get_global_options()->n_threads = 1;
|
config_get_global_options()->n_threads = 1;
|
||||||
|
|
||||||
|
@ -1055,11 +1055,11 @@ nl_constr_init_args = add # ignore/add/remove/force
|
|||||||
nl_enum_own_lines = ignore # ignore/add/remove/force
|
nl_enum_own_lines = ignore # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove newline between return type and function name in a function definition.
|
# Add or remove newline between return type and function name in a function definition.
|
||||||
nl_func_type_name = remove # ignore/add/remove/force
|
nl_func_type_name = ignore # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove newline between return type and function name inside a class {}
|
# Add or remove newline between return type and function name inside a class {}
|
||||||
# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
|
# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
|
||||||
nl_func_type_name_class = remove # ignore/add/remove/force
|
nl_func_type_name_class = ignore # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove newline between class specification and '::' in 'void A::f() { }'
|
# Add or remove newline between class specification and '::' in 'void A::f() { }'
|
||||||
# Only appears in separate member implementation (does not appear with in-line implmementation).
|
# Only appears in separate member implementation (does not appear with in-line implmementation).
|
||||||
@ -1070,7 +1070,7 @@ nl_func_class_scope = remove # ignore/add/remove/force
|
|||||||
nl_func_scope_name = remove # ignore/add/remove/force
|
nl_func_scope_name = remove # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove newline between return type and function name in a prototype.
|
# Add or remove newline between return type and function name in a prototype.
|
||||||
nl_func_proto_type_name = remove # ignore/add/remove/force
|
nl_func_proto_type_name = ignore # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove newline between a function name and the opening '(' in the declaration.
|
# Add or remove newline between a function name and the opening '(' in the declaration.
|
||||||
nl_func_paren = remove # ignore/add/remove/force
|
nl_func_paren = remove # ignore/add/remove/force
|
||||||
|
Reference in New Issue
Block a user