Cleanup server.hh
Simplify type definitions.
This commit is contained in:
@ -44,7 +44,7 @@ typedef enum authenticator_capability
|
|||||||
#define AUTHENTICATOR_MAX_OPTIONS 256
|
#define AUTHENTICATOR_MAX_OPTIONS 256
|
||||||
|
|
||||||
struct DCB;
|
struct DCB;
|
||||||
struct server;
|
struct SERVER;
|
||||||
struct MXS_SESSION;
|
struct MXS_SESSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
MXS_BEGIN_DECLS
|
MXS_BEGIN_DECLS
|
||||||
|
|
||||||
struct server;
|
struct SERVER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buffer properties - used to store properties related to the buffer
|
* Buffer properties - used to store properties related to the buffer
|
||||||
@ -126,7 +126,7 @@ typedef struct gwbuf
|
|||||||
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 */
|
||||||
struct server* server; /*< The target server where the buffer is executed */
|
struct 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 */
|
||||||
|
@ -422,7 +422,7 @@ SERVICE* config_get_service(const MXS_CONFIG_PARAMETER* params, const char* key)
|
|||||||
*
|
*
|
||||||
* @return Pointer to configured server
|
* @return Pointer to configured server
|
||||||
*/
|
*/
|
||||||
struct server* config_get_server(const MXS_CONFIG_PARAMETER* params, const char* key);
|
struct SERVER* config_get_server(const MXS_CONFIG_PARAMETER* params, const char* key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get an array of servers. The caller should free the produced array,
|
* @brief Get an array of servers. The caller should free the produced array,
|
||||||
@ -435,7 +435,7 @@ struct server* config_get_server(const MXS_CONFIG_PARAMETER* params, const char*
|
|||||||
*/
|
*/
|
||||||
int config_get_server_list(const MXS_CONFIG_PARAMETER* params,
|
int config_get_server_list(const MXS_CONFIG_PARAMETER* params,
|
||||||
const char* key,
|
const char* key,
|
||||||
struct server*** output);
|
struct SERVER*** output);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a compiled regular expression and the ovector size of the pattern. The
|
* Get a compiled regular expression and the ovector size of the pattern. The
|
||||||
|
@ -35,7 +35,7 @@ MXS_BEGIN_DECLS
|
|||||||
#define ERRHANDLE
|
#define ERRHANDLE
|
||||||
|
|
||||||
struct MXS_SESSION;
|
struct MXS_SESSION;
|
||||||
struct server;
|
struct SERVER;
|
||||||
|
|
||||||
struct DCB;
|
struct DCB;
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ struct DCB : public MXB_POLL_DATA
|
|||||||
void* authenticator_data = nullptr;/**< The authenticator data for this DCB */
|
void* authenticator_data = nullptr;/**< The authenticator data for this DCB */
|
||||||
DCB_CALLBACK* callbacks = nullptr; /**< The list of callbacks for the DCB */
|
DCB_CALLBACK* callbacks = nullptr; /**< The list of callbacks for the DCB */
|
||||||
int64_t last_read = 0; /**< Last time the DCB received data */
|
int64_t last_read = 0; /**< Last time the DCB received data */
|
||||||
struct server* server = nullptr; /**< The associated backend server */
|
struct SERVER* server = nullptr; /**< The associated backend server */
|
||||||
SSL* ssl = nullptr; /**< SSL struct for connection */
|
SSL* ssl = nullptr; /**< SSL struct for connection */
|
||||||
bool ssl_read_want_read = false;
|
bool ssl_read_want_read = false;
|
||||||
bool ssl_read_want_write = false;
|
bool ssl_read_want_write = false;
|
||||||
@ -241,7 +241,7 @@ void dcb_global_init();
|
|||||||
|
|
||||||
int dcb_write(DCB*, GWBUF*);
|
int dcb_write(DCB*, GWBUF*);
|
||||||
DCB* dcb_alloc(DCB::Role, MXS_SESSION*);
|
DCB* dcb_alloc(DCB::Role, MXS_SESSION*);
|
||||||
DCB* dcb_connect(struct server*, MXS_SESSION*, const char*);
|
DCB* dcb_connect(struct SERVER*, MXS_SESSION*, const char*);
|
||||||
int dcb_read(DCB*, GWBUF**, int);
|
int dcb_read(DCB*, GWBUF**, int);
|
||||||
int dcb_drain_writeq(DCB*);
|
int dcb_drain_writeq(DCB*);
|
||||||
void dcb_close(DCB*);
|
void dcb_close(DCB*);
|
||||||
@ -275,7 +275,7 @@ int dcb_add_callback(DCB*, DCB_REASON, int (*)(DCB*, DCB_REASON, void*), void*);
|
|||||||
int dcb_remove_callback(DCB*, DCB_REASON, int (*)(DCB*, DCB_REASON, void*), void*);
|
int dcb_remove_callback(DCB*, DCB_REASON, int (*)(DCB*, DCB_REASON, void*), void*);
|
||||||
int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */
|
int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */
|
||||||
int dcb_persistent_clean_count(DCB*, int, bool); /* Clean persistent and return count */
|
int dcb_persistent_clean_count(DCB*, int, bool); /* Clean persistent and return count */
|
||||||
void dcb_hangup_foreach(struct server* server);
|
void dcb_hangup_foreach(struct SERVER* server);
|
||||||
uint64_t dcb_get_session_id(DCB* dcb);
|
uint64_t dcb_get_session_id(DCB* dcb);
|
||||||
char* dcb_role_name(DCB*); /* Return the name of a role */
|
char* dcb_role_name(DCB*); /* Return the name of a role */
|
||||||
int dcb_accept_SSL(DCB* dcb);
|
int dcb_accept_SSL(DCB* dcb);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
MXS_BEGIN_DECLS
|
MXS_BEGIN_DECLS
|
||||||
|
|
||||||
struct DCB;
|
struct DCB;
|
||||||
struct server;
|
struct SERVER;
|
||||||
struct MXS_SESSION;
|
struct MXS_SESSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +106,7 @@ typedef struct mxs_protocol
|
|||||||
*
|
*
|
||||||
* @return The opened file descriptor or DCBFD_CLOSED on error
|
* @return The opened file descriptor or DCBFD_CLOSED on error
|
||||||
*/
|
*/
|
||||||
int32_t (* connect)(DCB* dcb, struct server* server, MXS_SESSION* session);
|
int32_t (* connect)(DCB* dcb, struct SERVER* server, MXS_SESSION* session);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free protocol data allocated in the connect handler
|
* Free protocol data allocated in the connect handler
|
||||||
@ -131,7 +131,7 @@ typedef struct mxs_protocol
|
|||||||
*
|
*
|
||||||
* @note Currently the return value is ignored
|
* @note Currently the return value is ignored
|
||||||
*/
|
*/
|
||||||
int32_t (* auth)(DCB* dcb, struct server* server, MXS_SESSION* session, GWBUF* buffer);
|
int32_t (* auth)(DCB* dcb, struct SERVER* server, MXS_SESSION* session, GWBUF* buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the default authenticator module for this protocol
|
* Returns the name of the default authenticator module for this protocol
|
||||||
|
@ -46,21 +46,17 @@ const int MAINTENANCE_FLAG_CHECK = -1;
|
|||||||
// Default replication lag value
|
// Default replication lag value
|
||||||
const int MXS_RLAG_UNDEFINED = -1;
|
const int MXS_RLAG_UNDEFINED = -1;
|
||||||
|
|
||||||
/**
|
/* Custom server parameters. These can be used by modules for e.g. weighting routing decisions. */
|
||||||
* The server parameters used for weighting routing decisions
|
struct SERVER_PARAM
|
||||||
*/
|
|
||||||
typedef struct server_params
|
|
||||||
{
|
{
|
||||||
char* name; /**< Parameter name */
|
char* name; /**< Parameter name */
|
||||||
char* value; /**< Parameter value */
|
char* value; /**< Parameter value */
|
||||||
bool active; /**< Whether the parameter is valid */
|
bool active; /**< Whether the parameter is valid */
|
||||||
struct server_params* next; /**< Next Paramter in the linked list */
|
struct SERVER_PARAM* next; /**< Next Paramter in the linked list */
|
||||||
} SERVER_PARAM;
|
};
|
||||||
|
|
||||||
/**
|
/* Server connection and usage statistics */
|
||||||
* The server statistics structure
|
struct SERVER_STATS
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
{
|
||||||
int n_connections; /**< Number of connections */
|
int n_connections; /**< Number of connections */
|
||||||
int n_current; /**< Current connections */
|
int n_current; /**< Current connections */
|
||||||
@ -69,23 +65,21 @@ typedef struct
|
|||||||
uint64_t n_new_conn; /**< Times the current pool was empty */
|
uint64_t n_new_conn; /**< Times the current pool was empty */
|
||||||
uint64_t n_from_pool; /**< Times when a connection was available from the pool */
|
uint64_t n_from_pool; /**< Times when a connection was available from the pool */
|
||||||
uint64_t packets; /**< Number of packets routed to this server */
|
uint64_t packets; /**< Number of packets routed to this server */
|
||||||
} SERVER_STATS;
|
};
|
||||||
|
|
||||||
/**
|
/* Server version */
|
||||||
* The server version.
|
struct SERVER_VERSION
|
||||||
*/
|
|
||||||
typedef struct server_version
|
|
||||||
{
|
{
|
||||||
uint32_t major;
|
uint32_t major;
|
||||||
uint32_t minor;
|
uint32_t minor;
|
||||||
uint32_t patch;
|
uint32_t patch;
|
||||||
} SERVER_VERSION;
|
};
|
||||||
|
|
||||||
typedef enum
|
enum server_type_t
|
||||||
{
|
{
|
||||||
SERVER_TYPE_MARIADB,
|
SERVER_TYPE_MARIADB,
|
||||||
SERVER_TYPE_MYSQL
|
SERVER_TYPE_MYSQL
|
||||||
} server_type_t;
|
};
|
||||||
|
|
||||||
static inline void server_decode_version(uint64_t version, SERVER_VERSION* server_version)
|
static inline void server_decode_version(uint64_t version, SERVER_VERSION* server_version)
|
||||||
{
|
{
|
||||||
@ -109,7 +103,7 @@ static uint64_t server_encode_version(const SERVER_VERSION* server_version)
|
|||||||
* the name of a protocol module that is loaded to implement the protocol
|
* the name of a protocol module that is loaded to implement the protocol
|
||||||
* between the gateway and the server.
|
* between the gateway and the server.
|
||||||
*/
|
*/
|
||||||
typedef struct server
|
struct SERVER
|
||||||
{
|
{
|
||||||
// Base settings
|
// Base settings
|
||||||
char* name; /**< Server config name */
|
char* name; /**< Server config name */
|
||||||
@ -158,7 +152,7 @@ typedef struct server
|
|||||||
* by rwsplit. TODO: Move to rwsplit */
|
* by rwsplit. TODO: Move to rwsplit */
|
||||||
bool warn_ssl_not_enabled;/**< SSL not used for an SSL enabled server */
|
bool warn_ssl_not_enabled;/**< SSL not used for an SSL enabled server */
|
||||||
MxsDiskSpaceThreshold* disk_space_threshold;/**< Disk space thresholds */
|
MxsDiskSpaceThreshold* disk_space_threshold;/**< Disk space thresholds */
|
||||||
} SERVER;
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status bits in the SERVER->status member, which describes the general state of a server. Although the
|
* Status bits in the SERVER->status member, which describes the general state of a server. Although the
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <maxscale/filter.hh>
|
#include <maxscale/filter.hh>
|
||||||
#include <maxscale/server.hh>
|
#include <maxscale/server.hh>
|
||||||
|
|
||||||
struct server;
|
struct SERVER;
|
||||||
struct mxs_router;
|
struct mxs_router;
|
||||||
struct mxs_router_object;
|
struct mxs_router_object;
|
||||||
struct users;
|
struct users;
|
||||||
|
@ -29,7 +29,7 @@ struct mxs_filter_def;
|
|||||||
struct mxs_filter;
|
struct mxs_filter;
|
||||||
struct mxs_filter_session;
|
struct mxs_filter_session;
|
||||||
struct mxs_router_session;
|
struct mxs_router_session;
|
||||||
struct server;
|
struct SERVER;
|
||||||
class Listener;
|
class Listener;
|
||||||
using SListener = std::shared_ptr<Listener>;
|
using SListener = std::shared_ptr<Listener>;
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ void session_retain_statement(MXS_SESSION* session, GWBUF* buffer);
|
|||||||
* @param final_response True if this was the final server to respond,
|
* @param final_response True if this was the final server to respond,
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
void session_book_server_response(MXS_SESSION* session, struct server* server, bool final_response);
|
void session_book_server_response(MXS_SESSION* session, struct SERVER* server, bool final_response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the server bookkeeping for the current statement.
|
* @brief Reset the server bookkeeping for the current statement.
|
||||||
|
@ -1920,7 +1920,7 @@ static void dcb_call_callback(DCB* dcb, DCB_REASON reason)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dcb_hangup_foreach_worker(MXB_WORKER* worker, struct server* server)
|
static void dcb_hangup_foreach_worker(MXB_WORKER* worker, struct SERVER* server)
|
||||||
{
|
{
|
||||||
RoutingWorker* rworker = static_cast<RoutingWorker*>(worker);
|
RoutingWorker* rworker = static_cast<RoutingWorker*>(worker);
|
||||||
int id = rworker->id();
|
int id = rworker->id();
|
||||||
@ -1940,7 +1940,7 @@ static void dcb_hangup_foreach_worker(MXB_WORKER* worker, struct server* server)
|
|||||||
*
|
*
|
||||||
* @param reason The DCB_REASON that triggers the callback
|
* @param reason The DCB_REASON that triggers the callback
|
||||||
*/
|
*/
|
||||||
void dcb_hangup_foreach(struct server* server)
|
void dcb_hangup_foreach(struct SERVER* server)
|
||||||
{
|
{
|
||||||
intptr_t arg1 = (intptr_t)dcb_hangup_foreach_worker;
|
intptr_t arg1 = (intptr_t)dcb_hangup_foreach_worker;
|
||||||
intptr_t arg2 = (intptr_t)server;
|
intptr_t arg2 = (intptr_t)server;
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct server* server() const
|
struct SERVER* server() const
|
||||||
{
|
{
|
||||||
return (this->m_sInner.get()) ? m_sInner.get()->server : NULL;
|
return (this->m_sInner.get()) ? m_sInner.get()->server : NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user