1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-30 07:23:07 +03:00

Added TOI client mode, replced string with const char* in debug calls.

This commit is contained in:
Teemu Ollakka
2018-05-21 16:42:40 +03:00
parent 90f6eb1ecf
commit 646a2b328e
8 changed files with 76 additions and 32 deletions

View File

@ -99,7 +99,9 @@ namespace trrep
/*! Generates write sets for replication by the provider. */
m_replicating,
/*! Applies write sets from the provider. */
m_applier
m_applier,
/*! Client is in total order isolation mode */
m_toi
};
/*!
@ -345,6 +347,7 @@ namespace trrep
const trrep::data&);
friend class client_context_switch;
friend class client_applier_mode;
friend class client_toi_mode;
friend class transaction_context;
/*!
@ -450,12 +453,12 @@ namespace trrep
/*!
* Enter debug synchronization point.
*/
virtual void debug_sync(const std::string&) = 0;
virtual void debug_sync(const char*) = 0;
/*!
*
*/
virtual void debug_suicide(const std::string&) = 0;
virtual void debug_suicide(const char*) = 0;
/*!
* Notify the implementation about an error.
@ -526,6 +529,27 @@ namespace trrep
trrep::client_context& client_;
enum trrep::client_context::mode orig_mode_;
};
class client_toi_mode
{
public:
client_toi_mode(trrep::client_context& client)
: client_(client)
, orig_mode_(client.mode_)
{
client_.mode_ = trrep::client_context::m_toi;
}
~client_toi_mode()
{
assert(client_.mode == trrep::client_context::m_toi);
client_.mode_ = orig_mode_;
}
private:
trrep::client_context& client_;
enum trrep::client_context::mode orig_mode_;
};
}
#endif // TRREP_CLIENT_CONTEXT_HPP

View File

@ -225,34 +225,31 @@ namespace trrep
bool bootstrap);
int disconnect();
/*!
* Virtual method which will be called when the server
* has been joined to the cluster. Must be provided by
* the implementation.
*
* \todo Document overriding.
*/
virtual void on_connect();
/*!
* Virtual method which will be called when a view
* A method which will be called when the server
* has been joined to the cluster
*/
void on_connect();
/*!
* A method which will be called when a view
* notification event has been delivered by the
* provider.
*
* \todo Document overriding.
*
* \params view trrep::view object which holds the new view
* information.
*/
virtual void on_view(const trrep::view& view);
void on_view(const trrep::view& view);
/*!
* Virtual method which will be called when the server
* A method which will be called when the server
* has been synchronized with the cluster.
*
* \todo Document overriding.
* This will have a side effect of changing the Server Context
* state to s_synced.
*/
virtual void on_sync();
void on_sync();
/*!
* Wait until server reaches given state.
@ -312,6 +309,13 @@ namespace trrep
*/
void sst_received(const wsrep_gtid_t& gtid, int error);
/*!
* This method must be called after the server initialization
* has been completed. The call has a side effect of changing
* the Server Context state to s_initialized.
*/
void initialized();
/*!
*
*/

View File

@ -150,7 +150,7 @@ namespace trrep
void remove_fragments();
void clear_fragments();
void cleanup();
void debug_log_state(const std::string&) const;
void debug_log_state(const char*) const;
trrep::provider& provider_;
trrep::client_context& client_context_;