Rename public types and constants in session.h

Preparing to split session.h into module and core sections.
This commit is contained in:
Esa Korhonen
2017-01-17 15:02:39 +02:00
parent 680401cf8e
commit fb771c8a2e
56 changed files with 241 additions and 241 deletions

View File

@ -69,7 +69,7 @@ typedef void *MXS_FILTER_SESSION;
typedef struct mxs_filter_object
{
MXS_FILTER *(*createInstance)(const char *name, char **options, CONFIG_PARAMETER *params);
MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, SESSION *session);
MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, MXS_SESSION *session);
void (*closeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
void (*freeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
void (*setDownstream)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);

View File

@ -150,10 +150,10 @@ public:
void diagnostics(DCB *pDcb);
protected:
FilterSession(SESSION* pSession);
FilterSession(MXS_SESSION* pSession);
protected:
SESSION* m_pSession; /*< The SESSION this filter session is associated with. */
MXS_SESSION* m_pSession; /*< The SESSION this filter session is associated with. */
Downstream m_down; /*< The downstream component. */
Upstream m_up; /*< The upstream component. */
};
@ -212,7 +212,7 @@ public:
return reinterpret_cast<MXS_FILTER*>(pFilter);
}
static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, SESSION* pSession)
static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, MXS_SESSION* pSession)
{
FilterType* pFilter = reinterpret_cast<FilterType*>(pInstance);
void* pFilterSession;

View File

@ -89,7 +89,7 @@ struct arg_node
bool boolean;
SERVICE *service;
SERVER *server;
SESSION *session;
MXS_SESSION *session;
DCB *dcb;
MXS_MONITOR *monitor;
MXS_FILTER_DEF *filter;

View File

@ -70,7 +70,7 @@ typedef enum error_action
typedef struct router_object
{
ROUTER *(*createInstance)(SERVICE *service, char **options);
void *(*newSession)(ROUTER *instance, SESSION *session);
void *(*newSession)(ROUTER *instance, MXS_SESSION *session);
void (*closeSession)(ROUTER *instance, void *router_session);
void (*freeSession)(ROUTER *instance, void *router_session);
int32_t (*routeQuery)(ROUTER *instance, void *router_session, GWBUF *queue);

View File

@ -69,7 +69,7 @@ typedef enum
SESSION_STATE_TO_BE_FREED, /*< ready to be freed as soon as there are no references */
SESSION_STATE_FREE, /*< for all sessions */
SESSION_STATE_DUMMY /*< dummy session for consistency */
} session_state_t;
} mxs_session_state_t;
typedef enum
{
@ -89,7 +89,7 @@ typedef enum
SESSION_TRX_READ_ONLY = (SESSION_TRX_ACTIVE_BIT | SESSION_TRX_READ_ONLY_BIT),
/*< An explicit READ WRITE transaction is active. */
SESSION_TRX_READ_WRITE = (SESSION_TRX_ACTIVE_BIT | SESSION_TRX_READ_WRITE_BIT)
} session_trx_state_t;
} mxs_session_trx_state_t;
/**
* Convert transaction state to string representation.
@ -97,7 +97,7 @@ typedef enum
* @param state A transaction state.
* @return String representation of the state.
*/
const char* session_trx_state_to_string(session_trx_state_t state);
const char* session_trx_state_to_string(mxs_session_trx_state_t state);
/**
* The downstream element in the filter chain. This may refer to
@ -160,30 +160,30 @@ typedef enum
*/
typedef struct session
{
skygw_chk_t ses_chk_top;
SPINLOCK ses_lock;
session_state_t state; /*< Current descriptor state */
size_t ses_id; /*< Unique session identifier */
int enabled_log_priorities; /*< Bitfield of enabled syslog priorities */
struct dcb *client_dcb; /*< The client connection */
void *router_session; /*< The router instance data */
SESSION_STATS stats; /*< Session statistics */
struct service *service; /*< The service this session is using */
int n_filters; /*< Number of filter sessions */
SESSION_FILTER *filters; /*< The filters in use within this session */
MXS_DOWNSTREAM head; /*< Head of the filter chain */
MXS_UPSTREAM tail; /*< The tail of the filter chain */
int refcount; /*< Reference count on the session */
bool ses_is_child; /*< this is a child session */
session_trx_state_t trx_state; /*< The current transaction state. */
bool autocommit; /*< Whether autocommit is on. */
skygw_chk_t ses_chk_top;
SPINLOCK ses_lock;
mxs_session_state_t state; /*< Current descriptor state */
size_t ses_id; /*< Unique session identifier */
int enabled_log_priorities; /*< Bitfield of enabled syslog priorities */
struct dcb *client_dcb; /*< The client connection */
void *router_session; /*< The router instance data */
SESSION_STATS stats; /*< Session statistics */
struct service *service; /*< The service this session is using */
int n_filters; /*< Number of filter sessions */
SESSION_FILTER *filters; /*< The filters in use within this session */
MXS_DOWNSTREAM head; /*< Head of the filter chain */
MXS_UPSTREAM tail; /*< The tail of the filter chain */
int refcount; /*< Reference count on the session */
bool ses_is_child; /*< this is a child session */
mxs_session_trx_state_t trx_state; /*< The current transaction state. */
bool autocommit; /*< Whether autocommit is on. */
struct
{
GWBUF *buffer; /**< Buffer containing the statement */
const struct server *target; /**< Where the statement was sent */
} stmt; /**< Current statement being executed */
skygw_chk_t ses_chk_tail;
} SESSION;
} MXS_SESSION;
#define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, .ses_lock = SPINLOCK_INIT, \
.stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
@ -196,7 +196,7 @@ typedef struct session
* the incoming data to the first element in the pipeline of filters and
* routers.
*/
#define SESSION_ROUTE_QUERY(sess, buf) \
#define MXS_SESSION_ROUTE_QUERY(sess, buf) \
((sess)->head.routeQuery)((sess)->head.instance, \
(sess)->head.session, (buf))
/**
@ -208,22 +208,22 @@ typedef struct session
((sess)->tail.clientReply)((sess)->tail.instance, \
(sess)->tail.session, (buf))
SESSION *session_alloc(struct service *, struct dcb *);
SESSION *session_set_dummy(struct dcb *);
int session_isvalid(SESSION *);
MXS_SESSION *session_alloc(struct service *, struct dcb *);
MXS_SESSION *session_set_dummy(struct dcb *);
int session_isvalid(MXS_SESSION *);
int session_reply(void *inst, void *session, GWBUF *data);
const char *session_get_remote(const SESSION *);
const char *session_get_user(const SESSION *);
const char *session_get_remote(const MXS_SESSION *);
const char *session_get_user(const MXS_SESSION *);
void printAllSessions();
void printSession(SESSION *);
void printSession(MXS_SESSION *);
void dprintSessionList(DCB *pdcb);
void dprintAllSessions(struct dcb *);
void dprintSession(struct dcb *, SESSION *);
void dprintSession(struct dcb *, MXS_SESSION *);
void dListSessions(struct dcb *);
char *session_state(session_state_t);
bool session_link_dcb(SESSION *, struct dcb *);
void session_enable_log_priority(SESSION* ses, int priority);
void session_disable_log_priority(SESSION* ses, int priority);
char *session_state(mxs_session_state_t);
bool session_link_dcb(MXS_SESSION *, struct dcb *);
void session_enable_log_priority(MXS_SESSION* ses, int priority);
void session_disable_log_priority(MXS_SESSION* ses, int priority);
RESULTSET *sessionGetList(SESSIONLISTFILTER);
/**
@ -246,7 +246,7 @@ RESULTSET *sessionGetList(SESSIONLISTFILTER);
* @param ses The SESSION object.
* @return The transaction state.
*/
session_trx_state_t session_get_trx_state(const SESSION* ses);
mxs_session_trx_state_t session_get_trx_state(const MXS_SESSION* ses);
/**
* Set the transaction state of the session.
@ -258,7 +258,7 @@ session_trx_state_t session_get_trx_state(const SESSION* ses);
*
* @return The previous transaction state.
*/
session_trx_state_t session_set_trx_state(SESSION* ses, session_trx_state_t new_state);
mxs_session_trx_state_t session_set_trx_state(MXS_SESSION* ses, mxs_session_trx_state_t new_state);
/**
* Tells whether an explicit READ ONLY transaction is active.
@ -271,7 +271,7 @@ session_trx_state_t session_set_trx_state(SESSION* ses, session_trx_state_t new_
* @return True if an explicit READ ONLY transaction is active,
* false otherwise.
*/
static inline bool session_trx_is_read_only(const SESSION* ses)
static inline bool session_trx_is_read_only(const MXS_SESSION* ses)
{
return ses->trx_state == SESSION_TRX_READ_ONLY;
}
@ -287,7 +287,7 @@ static inline bool session_trx_is_read_only(const SESSION* ses)
* @return True if an explicit READ WRITE transaction is active,
* false otherwise.
*/
static inline bool session_trx_is_read_write(const SESSION* ses)
static inline bool session_trx_is_read_write(const MXS_SESSION* ses)
{
return ses->trx_state == SESSION_TRX_READ_WRITE;
}
@ -309,7 +309,7 @@ static inline bool session_trx_is_read_write(const SESSION* ses)
*
* @return True if autocommit has been set ON, false otherwise.
*/
static inline bool session_is_autocommit(const SESSION* ses)
static inline bool session_is_autocommit(const MXS_SESSION* ses)
{
return ses->autocommit;
}
@ -324,7 +324,7 @@ static inline bool session_is_autocommit(const SESSION* ses)
*
* @return True if a transaction is active, false otherwise.
*/
static inline bool session_trx_is_active(const SESSION* ses)
static inline bool session_trx_is_active(const MXS_SESSION* ses)
{
return !session_is_autocommit(ses) || (ses->trx_state & SESSION_TRX_ACTIVE_BIT);
}
@ -337,7 +337,7 @@ static inline bool session_trx_is_active(const SESSION* ses)
* @param enable True if autocommit is enabled, false otherwise.
* @return The previous state.
*/
static inline bool session_set_autocommit(SESSION* ses, bool autocommit)
static inline bool session_set_autocommit(MXS_SESSION* ses, bool autocommit)
{
bool prev_autocommit = ses->autocommit;
ses->autocommit = autocommit;
@ -354,7 +354,7 @@ static inline bool session_set_autocommit(SESSION* ses, bool autocommit)
*
* @note The caller must free the session reference by calling session_put_ref
*/
SESSION* session_get_by_id(int id);
MXS_SESSION* session_get_by_id(int id);
/**
* @brief Get a session reference
@ -367,14 +367,14 @@ SESSION* session_get_by_id(int id);
*
* @note The caller must free the session reference by calling session_put_ref
*/
SESSION* session_get_ref(SESSION *sessoin);
MXS_SESSION* session_get_ref(MXS_SESSION *sessoin);
/**
* @brief Release a session reference
*
* @param session Session reference to release
*/
void session_put_ref(SESSION *session);
void session_put_ref(MXS_SESSION *session);
/**
* @brief Store the current statement into session
@ -387,7 +387,7 @@ void session_put_ref(SESSION *session);
* @param server Server where the statement is being executed
* @return True if statement was successfully stored, false if the cloning of @c buf failed.
*/
bool session_store_stmt(SESSION *session, GWBUF *buf, const struct server *server);
bool session_store_stmt(MXS_SESSION *session, GWBUF *buf, const struct server *server);
/**
* @brief Fetch stored statement
@ -399,13 +399,13 @@ bool session_store_stmt(SESSION *session, GWBUF *buf, const struct server *serve
* @param target Pointer where target server is stored
* @return True if a statement was stored
*/
bool session_take_stmt(SESSION *session, GWBUF **buffer, const struct server **target);
bool session_take_stmt(MXS_SESSION *session, GWBUF **buffer, const struct server **target);
/**
* Clear the stored statement
*
* @param session Session to clear
*/
void session_clear_stmt(SESSION *session);
void session_clear_stmt(MXS_SESSION *session);
MXS_END_DECLS