MXS-1625 Move routing target bits to QueryClassifier
This commit is contained in:
@ -52,6 +52,31 @@ public:
|
|||||||
TARGET_RLAG_MAX = 0x10
|
TARGET_RLAG_MAX = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool target_is_master(uint32_t t)
|
||||||
|
{
|
||||||
|
return (t & TARGET_MASTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool target_is_slave(uint32_t t)
|
||||||
|
{
|
||||||
|
return (t & TARGET_SLAVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool target_is_named_server(uint32_t t)
|
||||||
|
{
|
||||||
|
return (t & TARGET_NAMED_SERVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool target_is_all(uint32_t t)
|
||||||
|
{
|
||||||
|
return (t & TARGET_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool target_is_rlag_max(uint32_t t)
|
||||||
|
{
|
||||||
|
return (t & TARGET_RLAG_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
enum current_target_t
|
enum current_target_t
|
||||||
{
|
{
|
||||||
CURRENT_TARGET_UNDEFINED, /**< Current target has not been set. */
|
CURRENT_TARGET_UNDEFINED, /**< Current target has not been set. */
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#include <maxscale/dcb.h>
|
#include <maxscale/dcb.h>
|
||||||
#include <maxscale/hashtable.h>
|
#include <maxscale/hashtable.h>
|
||||||
#include <maxscale/log_manager.h>
|
#include <maxscale/log_manager.h>
|
||||||
|
#include <maxscale/queryclassifier.hh>
|
||||||
#include <maxscale/router.hh>
|
#include <maxscale/router.hh>
|
||||||
#include <maxscale/service.h>
|
#include <maxscale/service.h>
|
||||||
#include <maxscale/session_command.hh>
|
#include <maxscale/session_command.hh>
|
||||||
@ -50,15 +51,7 @@ enum connection_type
|
|||||||
SLAVE
|
SLAVE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum route_target_t
|
typedef uint32_t route_target_t;
|
||||||
{
|
|
||||||
TARGET_UNDEFINED = 0x00,
|
|
||||||
TARGET_MASTER = 0x01,
|
|
||||||
TARGET_SLAVE = 0x02,
|
|
||||||
TARGET_NAMED_SERVER = 0x04,
|
|
||||||
TARGET_ALL = 0x08,
|
|
||||||
TARGET_RLAG_MAX = 0x10
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This criteria is used when backends are chosen for a router session's use.
|
* This criteria is used when backends are chosen for a router session's use.
|
||||||
@ -113,11 +106,6 @@ static const MXS_ENUM_VALUE master_failure_mode_values[] =
|
|||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TARGET_IS_MASTER(t) (t & TARGET_MASTER)
|
|
||||||
#define TARGET_IS_SLAVE(t) (t & TARGET_SLAVE)
|
|
||||||
#define TARGET_IS_NAMED_SERVER(t) (t & TARGET_NAMED_SERVER)
|
|
||||||
#define TARGET_IS_ALL(t) (t & TARGET_ALL)
|
|
||||||
#define TARGET_IS_RLAG_MAX(t) (t & TARGET_RLAG_MAX)
|
|
||||||
#define BREF_IS_NOT_USED(s) ((s)->bref_state & ~BREF_IN_USE)
|
#define BREF_IS_NOT_USED(s) ((s)->bref_state & ~BREF_IN_USE)
|
||||||
#define BREF_IS_IN_USE(s) ((s)->bref_state & BREF_IN_USE)
|
#define BREF_IS_IN_USE(s) ((s)->bref_state & BREF_IN_USE)
|
||||||
#define BREF_IS_WAITING_RESULT(s) ((s)->bref_num_result_wait > 0)
|
#define BREF_IS_WAITING_RESULT(s) ((s)->bref_num_result_wait > 0)
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
using namespace maxscale;
|
using namespace maxscale;
|
||||||
|
|
||||||
RouteInfo::RouteInfo(RWSplitSession* rses, GWBUF* buffer)
|
RouteInfo::RouteInfo(RWSplitSession* rses, GWBUF* buffer)
|
||||||
: target(TARGET_UNDEFINED)
|
: target(RWSplitSession::TARGET_UNDEFINED)
|
||||||
, command(0xff)
|
, command(0xff)
|
||||||
, type(QUERY_TYPE_UNKNOWN)
|
, type(QUERY_TYPE_UNKNOWN)
|
||||||
, stmt_id(0)
|
, stmt_id(0)
|
||||||
|
|||||||
@ -23,6 +23,12 @@
|
|||||||
#include <maxscale/modutil.h>
|
#include <maxscale/modutil.h>
|
||||||
#include <maxscale/queryclassifier.hh>
|
#include <maxscale/queryclassifier.hh>
|
||||||
|
|
||||||
|
#define TARGET_IS_MASTER(t) maxscale::QueryClassifier::target_is_master(t)
|
||||||
|
#define TARGET_IS_SLAVE(t) maxscale::QueryClassifier::target_is_slave(t)
|
||||||
|
#define TARGET_IS_NAMED_SERVER(t) maxscale::QueryClassifier::target_is_named_server(t)
|
||||||
|
#define TARGET_IS_ALL(t) maxscale::QueryClassifier::target_is_all(t)
|
||||||
|
#define TARGET_IS_RLAG_MAX(t) maxscale::QueryClassifier::target_is_rlag_max(t)
|
||||||
|
|
||||||
typedef std::map<uint32_t, uint32_t> ClientHandleMap; /** External ID to internal ID */
|
typedef std::map<uint32_t, uint32_t> ClientHandleMap; /** External ID to internal ID */
|
||||||
|
|
||||||
typedef std::tr1::unordered_set<std::string> TableSet;
|
typedef std::tr1::unordered_set<std::string> TableSet;
|
||||||
@ -44,6 +50,16 @@ class RWSplitSession: public mxs::RouterSession,
|
|||||||
RWSplitSession& operator=(const RWSplitSession&) = delete;
|
RWSplitSession& operator=(const RWSplitSession&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TARGET_UNDEFINED = maxscale::QueryClassifier::TARGET_UNDEFINED,
|
||||||
|
TARGET_MASTER = maxscale::QueryClassifier::TARGET_MASTER,
|
||||||
|
TARGET_SLAVE = maxscale::QueryClassifier::TARGET_SLAVE,
|
||||||
|
TARGET_NAMED_SERVER = maxscale::QueryClassifier::TARGET_NAMED_SERVER,
|
||||||
|
TARGET_ALL = maxscale::QueryClassifier::TARGET_ALL,
|
||||||
|
TARGET_RLAG_MAX = maxscale::QueryClassifier::TARGET_RLAG_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
virtual ~RWSplitSession()
|
virtual ~RWSplitSession()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user