MXS-1752: Add prototype concatenation router
The router concatenates multiple result sets.
This commit is contained in:
82
server/modules/routing/cat/catsession.hh
Normal file
82
server/modules/routing/cat/catsession.hh
Normal file
@ -0,0 +1,82 @@
|
||||
#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/bsl11.
|
||||
*
|
||||
* Change Date: 2020-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 "cat.hh"
|
||||
|
||||
#include "../readwritesplit/rwbackend.hh"
|
||||
|
||||
class Cat;
|
||||
|
||||
/**
|
||||
* The client session structure used within this router.
|
||||
*/
|
||||
class CatSession: public mxs::RouterSession
|
||||
{
|
||||
CatSession(const CatSession&) = delete;
|
||||
CatSession& operator =(const CatSession&) = delete;
|
||||
public:
|
||||
|
||||
CatSession(MXS_SESSION* session, Cat* router, mxs::SRWBackendList& backends);
|
||||
|
||||
/**
|
||||
* The RouterSession instance will be deleted when a client session
|
||||
* has terminated. Will be called only after @c close() has been called.
|
||||
*/
|
||||
~CatSession();
|
||||
|
||||
/**
|
||||
* Called when a client session has been closed.
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Called when a packet being is routed to the backend. The router should
|
||||
* forward the packet to the appropriate server(s).
|
||||
*
|
||||
* @param pPacket A client packet.
|
||||
*/
|
||||
int32_t routeQuery(GWBUF* pPacket);
|
||||
|
||||
/**
|
||||
* Called when a packet is routed to the client. The router should
|
||||
* forward the packet to the client using `MXS_SESSION_ROUTE_REPLY`.
|
||||
*
|
||||
* @param pPacket A client packet.
|
||||
* @param pBackend The backend the packet is coming from.
|
||||
*/
|
||||
void clientReply(GWBUF* pPacket, DCB* pBackend);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pMessage The error message.
|
||||
* @param pProblem The DCB on which the error occurred.
|
||||
* @param action The context.
|
||||
* @param pSuccess On output, if false, the session will be terminated.
|
||||
*/
|
||||
void handleError(GWBUF* pMessage,
|
||||
DCB* pProblem,
|
||||
mxs_error_action_t action,
|
||||
bool* pSuccess);
|
||||
private:
|
||||
|
||||
MXS_SESSION* m_session;
|
||||
mxs::SRWBackendList m_backends;
|
||||
uint64_t m_completed;
|
||||
uint8_t m_packet_num;
|
||||
mxs::SRWBackendList::iterator m_current;
|
||||
GWBUF* m_query;
|
||||
|
||||
// Skip over unused backend servers
|
||||
void skip_unused();
|
||||
};
|
||||
Reference in New Issue
Block a user