mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Added initial interface definition for server service.
This commit is contained in:
97
include/wsrep/server_service.hpp
Normal file
97
include/wsrep/server_service.hpp
Normal file
@ -0,0 +1,97 @@
|
||||
//
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
/** @file server_service.hpp
|
||||
*
|
||||
* An abstract interface for a DBMS server services.
|
||||
* The interface will define methods which will be called from
|
||||
* the wsrep-lib.
|
||||
*/
|
||||
|
||||
namespace wsrep
|
||||
{
|
||||
class client_state;
|
||||
class server_service
|
||||
{
|
||||
/**
|
||||
* Create client state instance which acts only locally, i.e. does
|
||||
* not participate in replication. However, local client
|
||||
* state may execute transactions which require ordering,
|
||||
* as when modifying local SR fragment storage requires
|
||||
* strict commit ordering.
|
||||
*
|
||||
* @return Pointer to Client State.
|
||||
*/
|
||||
virtual wsrep::client_state* local_client_state() = 0;
|
||||
|
||||
/**
|
||||
* Create an applier state for streaming transaction applying.
|
||||
*
|
||||
* @return Pointer to streaming applier client state.
|
||||
*/
|
||||
virtual wsrep::client_state* streaming_applier_client_state() = 0;
|
||||
|
||||
/**
|
||||
* Release a client state allocated by either local_client_state()
|
||||
* or streaming_applier_client_state().
|
||||
*/
|
||||
virtual void release_client_state(wsrep::client_state*) = 0;
|
||||
|
||||
/**
|
||||
* Perform a background rollback for a transaction.
|
||||
*/
|
||||
virtual void background_rollback(wsrep::client_state&) = 0;
|
||||
|
||||
/**
|
||||
* Log a dummy write set. A dummy write set is usually either
|
||||
* a remotely generated write set which failed certification in
|
||||
* provider and had a GTID assigned or a streaming replication
|
||||
* rollback write set. If the DBMS implements logging for
|
||||
* applied transactions, logging dummy write sets which do not
|
||||
* commit any transaction is neeeded to keep the GTID sequence
|
||||
* continuous in the server.
|
||||
*/
|
||||
virtual void log_dummy_write_set(wsrep::client_state& client_state,
|
||||
const wsrep::ws_meta& ws_meta) = 0;
|
||||
|
||||
/**
|
||||
* Log a cluster view change event.
|
||||
*/
|
||||
virtual void log_view(wsrep::client_state&, const wsrep::view&) = 0;
|
||||
|
||||
/**
|
||||
* Determine if the configured SST method requires SST to be
|
||||
* performed before DBMS storage engine initialization.
|
||||
*
|
||||
* @return True if the SST must happen before storage engine init,
|
||||
* otherwise false.
|
||||
*/
|
||||
virtual bool sst_before_init() const = 0;
|
||||
|
||||
/**
|
||||
* Return SST request which provides the donor server enough
|
||||
* information how to donate the snapshot.
|
||||
*
|
||||
* @return A string containing a SST request.
|
||||
*/
|
||||
virtual std::string sst_request() = 0;
|
||||
|
||||
/**
|
||||
* Start a SST process.
|
||||
*
|
||||
* @param sst_request A string containing the SST request from
|
||||
* the joiner
|
||||
* @param gtid A GTID denoting the current replication position
|
||||
* @param bypass Boolean bypass flag.
|
||||
*
|
||||
* @return Zero if the SST transfer was succesfully started,
|
||||
* non-zero otherwise.
|
||||
*/
|
||||
virtual int start_sst(const std::string& sst_request,
|
||||
const wsrep::gtid& gtid,
|
||||
bool bypass) = 0;
|
||||
|
||||
|
||||
};
|
||||
}
|
@ -203,10 +203,6 @@ namespace wsrep
|
||||
|
||||
/**
|
||||
* Create applier context for streaming transaction.
|
||||
*
|
||||
* @param server_id Server id of the origin of the SR transaction.
|
||||
* @param transaction_id Transaction ID of the SR transaction on the
|
||||
* origin server.
|
||||
*/
|
||||
virtual client_state* streaming_applier_client_state() = 0;
|
||||
|
||||
@ -247,6 +243,8 @@ namespace wsrep
|
||||
* @return Reference to provider
|
||||
*
|
||||
* @throw wsrep::runtime_error if provider has not been loaded
|
||||
*
|
||||
* @todo This should not be virtual.
|
||||
*/
|
||||
virtual wsrep::provider& provider() const
|
||||
{
|
||||
@ -382,16 +380,34 @@ namespace wsrep
|
||||
*
|
||||
* @return True if the statement is allowed for streaming
|
||||
* replication, false otherwise.
|
||||
*
|
||||
* @todo Move to client service interface.
|
||||
*/
|
||||
virtual bool statement_allowed_for_streaming(
|
||||
const wsrep::client_state& client_state,
|
||||
const wsrep::transaction& transaction) const;
|
||||
|
||||
/**
|
||||
* Set server wide wsrep debug logging level.
|
||||
*
|
||||
* Log levels are
|
||||
* - 0 - No debug logging.
|
||||
* - 1..n - Debug logging with increasing verbosity.
|
||||
*/
|
||||
void debug_log_level(int level) { debug_log_level_ = level; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
int debug_log_level() const { return debug_log_level_; }
|
||||
|
||||
/**
|
||||
* @todo Set filter for debug logging.
|
||||
*/
|
||||
void debug_log_filter(const std::string&);
|
||||
|
||||
protected:
|
||||
/** Server Context constructor
|
||||
/** Server state constructor
|
||||
*
|
||||
* @param mutex Mutex provided by the DBMS implementation.
|
||||
* @param name Human Readable Server Name.
|
||||
|
Reference in New Issue
Block a user