MXS-2008 Add maxbase/poll.[h|hh]
Remove maxscale/poll_core.h
This commit is contained in:
@ -17,14 +17,14 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/protocol.h>
|
||||
#include <maxscale/authenticator.h>
|
||||
#include <maxscale/ssl.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/poll_core.h>
|
||||
#include <netinet/in.h>
|
||||
#include <maxbase/poll.h>
|
||||
#include <maxscale/authenticator.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/protocol.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/ssl.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
@ -144,7 +144,7 @@ typedef enum
|
||||
*/
|
||||
typedef struct dcb
|
||||
{
|
||||
MXS_POLL_DATA poll;
|
||||
MXB_POLL_DATA poll;
|
||||
bool dcb_errhandle_called; /*< this can be called only once */
|
||||
dcb_role_t dcb_role;
|
||||
int fd; /**< The descriptor */
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <maxscale/poll_core.hh>
|
||||
#include <maxbase/poll.hh>
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
@ -107,7 +107,7 @@ public:
|
||||
* The class @c MessageQueue provides a cross thread message queue implemented
|
||||
* on top of a pipe.
|
||||
*/
|
||||
class MessageQueue : private MxsPollData
|
||||
class MessageQueue : private mxb::PollData
|
||||
{
|
||||
MessageQueue(const MessageQueue&);
|
||||
MessageQueue& operator = (const MessageQueue&);
|
||||
@ -195,7 +195,7 @@ private:
|
||||
|
||||
uint32_t handle_poll_events(Worker* pWorker, uint32_t events);
|
||||
|
||||
static uint32_t poll_handler(MXS_POLL_DATA* pData, void* worker, uint32_t events);
|
||||
static uint32_t poll_handler(MXB_POLL_DATA* pData, void* worker, uint32_t events);
|
||||
|
||||
private:
|
||||
Handler& m_handler;
|
||||
|
@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2022-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file poll_basic.h The Descriptor Control Block
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum mxs_poll_action
|
||||
{
|
||||
MXS_POLL_NOP = 0x00,
|
||||
MXS_POLL_ACCEPT = 0x01,
|
||||
MXS_POLL_READ = 0x02,
|
||||
MXS_POLL_WRITE = 0x04,
|
||||
MXS_POLL_HUP = 0x08,
|
||||
MXS_POLL_ERROR = 0x10,
|
||||
} mxs_poll_action_t;
|
||||
|
||||
struct mxs_poll_data;
|
||||
|
||||
/**
|
||||
* Pointer to function that knows how to handle events for a particular
|
||||
* 'struct mxs_poll_data' structure.
|
||||
*
|
||||
* @param data The `mxs_poll_data` instance that contained this function pointer.
|
||||
* @param worker The worker.
|
||||
* @param events The epoll events.
|
||||
*
|
||||
* @return A combination of mxs_poll_action_t enumeration values.
|
||||
*/
|
||||
// TODO: Change worker to mxs::Worker once this is C++-ified.
|
||||
typedef uint32_t (*mxs_poll_handler_t)(struct mxs_poll_data* data, void* worker, uint32_t events);
|
||||
|
||||
typedef struct mxs_poll_data
|
||||
{
|
||||
mxs_poll_handler_t handler; /*< Handler for this particular kind of mxs_poll_data. */
|
||||
void* owner; /*< Owning worker. */
|
||||
} MXS_POLL_DATA;
|
||||
|
||||
MXS_END_DECLS
|
@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2022-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <maxscale/poll_core.h>
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
|
||||
struct MxsPollData : MXS_POLL_DATA
|
||||
{
|
||||
MxsPollData()
|
||||
{
|
||||
handler = NULL;
|
||||
owner = nullptr;
|
||||
}
|
||||
|
||||
MxsPollData(mxs_poll_handler_t h)
|
||||
{
|
||||
handler = h;
|
||||
owner = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -16,12 +16,13 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include <maxbase/poll.h>
|
||||
#include <maxscale/buffer.hh>
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
|
||||
/** A DCB-like client abstraction which ignores responses */
|
||||
class LocalClient: public MXS_POLL_DATA
|
||||
class LocalClient: public MXB_POLL_DATA
|
||||
{
|
||||
LocalClient(const LocalClient&);
|
||||
LocalClient& operator=(const LocalClient&);
|
||||
@ -59,7 +60,7 @@ public:
|
||||
private:
|
||||
static LocalClient* create(MYSQL_session* session, MySQLProtocol* proto, const char* ip, uint64_t port);
|
||||
LocalClient(MYSQL_session* session, MySQLProtocol* proto, int fd);
|
||||
static uint32_t poll_handler(struct mxs_poll_data* data, void* worker, uint32_t events);
|
||||
static uint32_t poll_handler(MXB_POLL_DATA* data, void* worker, uint32_t events);
|
||||
void process(uint32_t events);
|
||||
GWBUF* read_complete_packet();
|
||||
void drain_queue();
|
||||
|
@ -13,12 +13,11 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxbase/poll.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct mxs_worker
|
||||
{
|
||||
} MXS_WORKER;
|
||||
typedef MXB_WORKER MXS_WORKER;
|
||||
|
||||
enum mxs_worker_msg_id
|
||||
{
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
#include <maxbase/atomic.h>
|
||||
#include <maxbase/semaphore.hh>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/messagequeue.hh>
|
||||
#include <maxscale/worker.h>
|
||||
#include <maxscale/workertask.hh>
|
||||
|
||||
#include "messagequeue.hh"
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
|
||||
@ -431,7 +431,7 @@ private:
|
||||
* too many WorkerTimer instances. In order to be used, a WorkerTimer
|
||||
* needs a Worker instance in whose context the timer is triggered.
|
||||
*/
|
||||
class WorkerTimer : private MXS_POLL_DATA
|
||||
class WorkerTimer : private MXB_POLL_DATA
|
||||
{
|
||||
WorkerTimer(const WorkerTimer&) = delete;
|
||||
WorkerTimer& operator = (const WorkerTimer&) = delete;
|
||||
@ -471,7 +471,7 @@ protected:
|
||||
private:
|
||||
uint32_t handle(Worker* pWorker, uint32_t events);
|
||||
|
||||
static uint32_t handler(MXS_POLL_DATA* pThis, void* pWorker, uint32_t events);
|
||||
static uint32_t handler(MXB_POLL_DATA* pThis, void* pWorker, uint32_t events);
|
||||
|
||||
private:
|
||||
int m_fd; /**< The timerfd descriptor. */
|
||||
@ -654,7 +654,7 @@ public:
|
||||
*
|
||||
* @return True, if the descriptor could be added, false otherwise.
|
||||
*/
|
||||
bool add_fd(int fd, uint32_t events, MXS_POLL_DATA* pData);
|
||||
bool add_fd(int fd, uint32_t events, MXB_POLL_DATA* pData);
|
||||
|
||||
/**
|
||||
* Remove a file descriptor from the worker's epoll instance.
|
||||
|
Reference in New Issue
Block a user