mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Changed project name to wsrep-lib.
This commit is contained in:
@ -35,8 +35,8 @@
|
||||
* drives the transaction.
|
||||
*/
|
||||
|
||||
#ifndef TRREP_CLIENT_CONTEXT_HPP
|
||||
#define TRREP_CLIENT_CONTEXT_HPP
|
||||
#ifndef WSREP_CLIENT_CONTEXT_HPP
|
||||
#define WSREP_CLIENT_CONTEXT_HPP
|
||||
|
||||
#include "server_context.hpp"
|
||||
#include "transaction_context.hpp"
|
||||
@ -44,7 +44,7 @@
|
||||
#include "lock.hpp"
|
||||
#include "data.hpp"
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class server_context;
|
||||
class provider;
|
||||
@ -206,7 +206,7 @@ namespace trrep
|
||||
assert(state_ == s_exec);
|
||||
return transaction_.start_transaction();
|
||||
}
|
||||
int start_transaction(const trrep::transaction_id& id)
|
||||
int start_transaction(const wsrep::transaction_id& id)
|
||||
{
|
||||
assert(state_ == s_exec);
|
||||
return transaction_.start_transaction(id);
|
||||
@ -220,13 +220,13 @@ namespace trrep
|
||||
return transaction_.start_transaction(wsh, meta, flags);
|
||||
}
|
||||
|
||||
int append_key(const trrep::key& key)
|
||||
int append_key(const wsrep::key& key)
|
||||
{
|
||||
assert(state_ == s_exec);
|
||||
return transaction_.append_key(key);
|
||||
}
|
||||
|
||||
int append_data(const trrep::data& data)
|
||||
int append_data(const wsrep::data& data)
|
||||
{
|
||||
assert(state_ == s_exec);
|
||||
return transaction_.append_data(data);
|
||||
@ -271,7 +271,7 @@ namespace trrep
|
||||
return transaction_.after_rollback();
|
||||
}
|
||||
|
||||
int bf_abort(trrep::unique_lock<trrep::mutex>& lock,
|
||||
int bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
|
||||
wsrep_seqno_t bf_seqno)
|
||||
{
|
||||
return transaction_.bf_abort(lock, bf_seqno);
|
||||
@ -281,14 +281,14 @@ namespace trrep
|
||||
*
|
||||
* \return Reference to the client mutex.
|
||||
*/
|
||||
trrep::mutex& mutex() { return mutex_; }
|
||||
wsrep::mutex& mutex() { return mutex_; }
|
||||
|
||||
/*!
|
||||
* Get server context associated the the client session.
|
||||
*
|
||||
* \return Reference to server context.
|
||||
*/
|
||||
trrep::server_context& server_context() const
|
||||
wsrep::server_context& server_context() const
|
||||
{ return server_context_; }
|
||||
|
||||
/*!
|
||||
@ -296,10 +296,10 @@ namespace trrep
|
||||
* with the client context.
|
||||
*
|
||||
* \return Reference to the provider.
|
||||
* \throw trrep::runtime_error if no providers are associated
|
||||
* \throw wsrep::runtime_error if no providers are associated
|
||||
* with the client context.
|
||||
*/
|
||||
trrep::provider& provider() const;
|
||||
wsrep::provider& provider() const;
|
||||
|
||||
/*!
|
||||
* Get Client identifier.
|
||||
@ -317,7 +317,7 @@ namespace trrep
|
||||
*/
|
||||
enum mode mode() const { return mode_; }
|
||||
|
||||
const trrep::transaction_context& transaction() const
|
||||
const wsrep::transaction_context& transaction() const
|
||||
{
|
||||
return transaction_;
|
||||
}
|
||||
@ -331,10 +331,10 @@ namespace trrep
|
||||
|
||||
void reset_error()
|
||||
{
|
||||
current_error_ = trrep::e_success;
|
||||
current_error_ = wsrep::e_success;
|
||||
}
|
||||
|
||||
enum trrep::client_error current_error() const
|
||||
enum wsrep::client_error current_error() const
|
||||
{
|
||||
return current_error_;
|
||||
}
|
||||
@ -343,8 +343,8 @@ namespace trrep
|
||||
* Client context constuctor. This is protected so that it
|
||||
* can be called from derived class constructors only.
|
||||
*/
|
||||
client_context(trrep::mutex& mutex,
|
||||
trrep::server_context& server_context,
|
||||
client_context(wsrep::mutex& mutex,
|
||||
wsrep::server_context& server_context,
|
||||
const client_id& id,
|
||||
enum mode mode)
|
||||
: mutex_(mutex)
|
||||
@ -355,7 +355,7 @@ namespace trrep
|
||||
, transaction_(*this)
|
||||
, allow_dirty_reads_()
|
||||
, debug_log_level_(0)
|
||||
, current_error_(trrep::e_success)
|
||||
, current_error_(wsrep::e_success)
|
||||
{ }
|
||||
|
||||
private:
|
||||
@ -366,7 +366,7 @@ namespace trrep
|
||||
* Friend declarations
|
||||
*/
|
||||
friend int server_context::on_apply(client_context&,
|
||||
const trrep::data&);
|
||||
const wsrep::data&);
|
||||
friend class client_context_switch;
|
||||
friend class client_applier_mode;
|
||||
friend class client_toi_mode;
|
||||
@ -384,7 +384,7 @@ namespace trrep
|
||||
/*!
|
||||
* Set client state.
|
||||
*/
|
||||
void state(trrep::unique_lock<trrep::mutex>& lock, enum state state);
|
||||
void state(wsrep::unique_lock<wsrep::mutex>& lock, enum state state);
|
||||
|
||||
/*!
|
||||
* Virtual method to return true if the client operates
|
||||
@ -398,8 +398,8 @@ namespace trrep
|
||||
/*!
|
||||
* Append SR fragment to the transaction.
|
||||
*/
|
||||
virtual int append_fragment(trrep::transaction_context&,
|
||||
uint32_t, const trrep::data&)
|
||||
virtual int append_fragment(wsrep::transaction_context&,
|
||||
uint32_t, const wsrep::data&)
|
||||
{ return 0; }
|
||||
|
||||
|
||||
@ -409,7 +409,7 @@ namespace trrep
|
||||
*
|
||||
* \return Zero on success, non-zero on applying failure.
|
||||
*/
|
||||
virtual int apply(const trrep::data& data) = 0;
|
||||
virtual int apply(const wsrep::data& data) = 0;
|
||||
|
||||
/*!
|
||||
* Virtual method which will be called
|
||||
@ -433,21 +433,21 @@ namespace trrep
|
||||
* Notify a implementation that the client is about
|
||||
* to replay the transaction.
|
||||
*/
|
||||
virtual void will_replay(trrep::transaction_context&) = 0;
|
||||
virtual void will_replay(wsrep::transaction_context&) = 0;
|
||||
|
||||
/*!
|
||||
* Replay the transaction.
|
||||
*/
|
||||
virtual int replay(trrep::transaction_context& tc) = 0;
|
||||
virtual int replay(wsrep::transaction_context& tc) = 0;
|
||||
|
||||
|
||||
/*!
|
||||
* Wait until all of the replaying transactions have been committed.
|
||||
*/
|
||||
virtual void wait_for_replayers(trrep::unique_lock<trrep::mutex>&) const = 0;
|
||||
virtual void wait_for_replayers(wsrep::unique_lock<wsrep::mutex>&) const = 0;
|
||||
|
||||
virtual int prepare_data_for_replication(
|
||||
const trrep::transaction_context&, trrep::data& data)
|
||||
const wsrep::transaction_context&, wsrep::data& data)
|
||||
{
|
||||
static const char buf[1] = { 1 };
|
||||
data.assign(buf, 1);
|
||||
@ -484,27 +484,27 @@ namespace trrep
|
||||
/*!
|
||||
* Notify the implementation about an error.
|
||||
*/
|
||||
virtual void on_error(enum trrep::client_error error) = 0;
|
||||
virtual void on_error(enum wsrep::client_error error) = 0;
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
void override_error(enum trrep::client_error error)
|
||||
void override_error(enum wsrep::client_error error)
|
||||
{
|
||||
if (current_error_ != trrep::e_success &&
|
||||
error == trrep::e_success)
|
||||
if (current_error_ != wsrep::e_success &&
|
||||
error == wsrep::e_success)
|
||||
{
|
||||
throw trrep::runtime_error("Overriding error with success");
|
||||
throw wsrep::runtime_error("Overriding error with success");
|
||||
}
|
||||
current_error_ = error;
|
||||
}
|
||||
|
||||
trrep::mutex& mutex_;
|
||||
trrep::server_context& server_context_;
|
||||
wsrep::mutex& mutex_;
|
||||
wsrep::server_context& server_context_;
|
||||
client_id id_;
|
||||
enum mode mode_;
|
||||
enum state state_;
|
||||
protected:
|
||||
trrep::transaction_context transaction_;
|
||||
wsrep::transaction_context transaction_;
|
||||
private:
|
||||
/*!
|
||||
* \todo This boolean should be converted to better read isolation
|
||||
@ -512,15 +512,15 @@ namespace trrep
|
||||
*/
|
||||
bool allow_dirty_reads_;
|
||||
int debug_log_level_;
|
||||
trrep::client_error current_error_;
|
||||
wsrep::client_error current_error_;
|
||||
};
|
||||
|
||||
|
||||
class client_context_switch
|
||||
{
|
||||
public:
|
||||
client_context_switch(trrep::client_context& orig_context,
|
||||
trrep::client_context& current_context)
|
||||
client_context_switch(wsrep::client_context& orig_context,
|
||||
wsrep::client_context& current_context)
|
||||
: orig_context_(orig_context)
|
||||
, current_context_(current_context)
|
||||
{
|
||||
@ -538,41 +538,41 @@ namespace trrep
|
||||
class client_applier_mode
|
||||
{
|
||||
public:
|
||||
client_applier_mode(trrep::client_context& client)
|
||||
client_applier_mode(wsrep::client_context& client)
|
||||
: client_(client)
|
||||
, orig_mode_(client.mode_)
|
||||
{
|
||||
client_.mode_ = trrep::client_context::m_applier;
|
||||
client_.mode_ = wsrep::client_context::m_applier;
|
||||
}
|
||||
~client_applier_mode()
|
||||
{
|
||||
client_.mode_ = orig_mode_;
|
||||
}
|
||||
private:
|
||||
trrep::client_context& client_;
|
||||
enum trrep::client_context::mode orig_mode_;
|
||||
wsrep::client_context& client_;
|
||||
enum wsrep::client_context::mode orig_mode_;
|
||||
};
|
||||
|
||||
class client_toi_mode
|
||||
{
|
||||
public:
|
||||
client_toi_mode(trrep::client_context& client)
|
||||
client_toi_mode(wsrep::client_context& client)
|
||||
: client_(client)
|
||||
, orig_mode_(client.mode_)
|
||||
{
|
||||
client_.mode_ = trrep::client_context::m_toi;
|
||||
client_.mode_ = wsrep::client_context::m_toi;
|
||||
}
|
||||
~client_toi_mode()
|
||||
{
|
||||
assert(client_.mode() == trrep::client_context::m_toi);
|
||||
assert(client_.mode() == wsrep::client_context::m_toi);
|
||||
client_.mode_ = orig_mode_;
|
||||
}
|
||||
private:
|
||||
trrep::client_context& client_;
|
||||
enum trrep::client_context::mode orig_mode_;
|
||||
wsrep::client_context& client_;
|
||||
enum wsrep::client_context::mode orig_mode_;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // TRREP_CLIENT_CONTEXT_HPP
|
||||
#endif // WSREP_CLIENT_CONTEXT_HPP
|
@ -8,9 +8,9 @@
|
||||
* Compiler specific options.
|
||||
*/
|
||||
|
||||
#define TRREP_UNUSED __attribute__((unused))
|
||||
#define WSREP_UNUSED __attribute__((unused))
|
||||
#if __cplusplus >= 201103L
|
||||
#define TRREP_OVERRIDE override
|
||||
#define WSREP_OVERRIDE override
|
||||
#else
|
||||
#define TRREP_OVERRIDE
|
||||
#define WSREP_OVERRIDE
|
||||
#endif // __cplusplus >= 201103L
|
@ -2,14 +2,14 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_CONDITION_VARIABLE_HPP
|
||||
#define TRREP_CONDITION_VARIABLE_HPP
|
||||
#ifndef WSREP_CONDITION_VARIABLE_HPP
|
||||
#define WSREP_CONDITION_VARIABLE_HPP
|
||||
|
||||
#include "lock.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class condition_variable
|
||||
{
|
||||
@ -18,7 +18,7 @@ namespace trrep
|
||||
virtual ~condition_variable() { }
|
||||
virtual void notify_one() = 0;
|
||||
virtual void notify_all() = 0;
|
||||
virtual void wait(trrep::unique_lock<trrep::mutex>& lock) = 0;
|
||||
virtual void wait(wsrep::unique_lock<wsrep::mutex>& lock) = 0;
|
||||
private:
|
||||
condition_variable(const condition_variable&);
|
||||
condition_variable& operator=(const condition_variable&);
|
||||
@ -33,7 +33,7 @@ namespace trrep
|
||||
{
|
||||
if (pthread_cond_init(&cond_, 0))
|
||||
{
|
||||
throw trrep::runtime_error("Failed to initialized condvar");
|
||||
throw wsrep::runtime_error("Failed to initialized condvar");
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,13 +54,13 @@ namespace trrep
|
||||
(void)pthread_cond_broadcast(&cond_);
|
||||
}
|
||||
|
||||
void wait(trrep::unique_lock<trrep::mutex>& lock)
|
||||
void wait(wsrep::unique_lock<wsrep::mutex>& lock)
|
||||
{
|
||||
if (pthread_cond_wait(
|
||||
&cond_,
|
||||
reinterpret_cast<pthread_mutex_t*>(lock.mutex().native())))
|
||||
{
|
||||
throw trrep::runtime_error("Cond wait failed");
|
||||
throw wsrep::runtime_error("Cond wait failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,4 +70,4 @@ namespace trrep
|
||||
|
||||
}
|
||||
|
||||
#endif // TRREP_CONDITION_VARIABLE_HPP
|
||||
#endif // WSREP_CONDITION_VARIABLE_HPP
|
@ -2,10 +2,10 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_DATA_HPP
|
||||
#define TRREP_DATA_HPP
|
||||
#ifndef WSREP_DATA_HPP
|
||||
#define WSREP_DATA_HPP
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class data
|
||||
{
|
||||
@ -33,4 +33,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_DATA_HPP
|
||||
#endif // WSREP_DATA_HPP
|
@ -2,13 +2,13 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_EXCEPTION_HPP
|
||||
#define TRREP_EXCEPTION_HPP
|
||||
#ifndef WSREP_EXCEPTION_HPP
|
||||
#define WSREP_EXCEPTION_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class runtime_error : public std::runtime_error
|
||||
{
|
||||
@ -33,4 +33,4 @@ namespace trrep
|
||||
}
|
||||
|
||||
|
||||
#endif // TRREP_EXCEPTION_HPP
|
||||
#endif // WSREP_EXCEPTION_HPP
|
@ -2,12 +2,12 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_KEY_HPP
|
||||
#define TRREP_KEY_HPP
|
||||
#ifndef WSREP_KEY_HPP
|
||||
#define WSREP_KEY_HPP
|
||||
|
||||
#include "exception.hpp"
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class key
|
||||
{
|
||||
@ -24,7 +24,7 @@ namespace trrep
|
||||
{
|
||||
if (key_.key_parts_num == 3)
|
||||
{
|
||||
throw trrep::runtime_error("key parts exceed maximum of 3");
|
||||
throw wsrep::runtime_error("key parts exceed maximum of 3");
|
||||
}
|
||||
key_parts_[key_.key_parts_num].ptr = ptr;
|
||||
key_parts_[key_.key_parts_num].len = len;
|
||||
@ -38,4 +38,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_KEY_HPP
|
||||
#endif // WSREP_KEY_HPP
|
@ -2,14 +2,14 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_LOCK_HPP
|
||||
#define TRREP_LOCK_HPP
|
||||
#ifndef WSREP_LOCK_HPP
|
||||
#define WSREP_LOCK_HPP
|
||||
|
||||
#include "mutex.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
template <class M>
|
||||
class unique_lock
|
||||
@ -58,4 +58,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_LOCK_HPP
|
||||
#endif // WSREP_LOCK_HPP
|
@ -2,8 +2,8 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_LOGGER_HPP
|
||||
#define TRREP_LOGGER_HPP
|
||||
#ifndef WSREP_LOGGER_HPP
|
||||
#define WSREP_LOGGER_HPP
|
||||
|
||||
#include "mutex.hpp"
|
||||
#include "lock.hpp"
|
||||
@ -11,7 +11,7 @@
|
||||
#include <iosfwd>
|
||||
#include <sstream>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class log
|
||||
{
|
||||
@ -22,7 +22,7 @@ namespace trrep
|
||||
{ }
|
||||
~log()
|
||||
{
|
||||
trrep::unique_lock<trrep::mutex> lock(mutex_);
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
os_ << prefix_ << ": " << oss_.str() << "\n";
|
||||
}
|
||||
template <typename T>
|
||||
@ -33,7 +33,7 @@ namespace trrep
|
||||
private:
|
||||
const std::string prefix_;
|
||||
std::ostringstream oss_;
|
||||
static trrep::mutex& mutex_;
|
||||
static wsrep::mutex& mutex_;
|
||||
static std::ostream& os_;
|
||||
};
|
||||
|
||||
@ -46,4 +46,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_LOGGER_HPP
|
||||
#endif // WSREP_LOGGER_HPP
|
@ -2,14 +2,14 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_MUTEX_HPP
|
||||
#define TRREP_MUTEX_HPP
|
||||
#ifndef WSREP_MUTEX_HPP
|
||||
#define WSREP_MUTEX_HPP
|
||||
|
||||
#include "exception.hpp"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
//!
|
||||
//!
|
||||
@ -29,23 +29,23 @@ namespace trrep
|
||||
};
|
||||
|
||||
// Default pthread implementation
|
||||
class default_mutex : public trrep::mutex
|
||||
class default_mutex : public wsrep::mutex
|
||||
{
|
||||
public:
|
||||
default_mutex()
|
||||
: trrep::mutex(),
|
||||
: wsrep::mutex(),
|
||||
mutex_()
|
||||
{
|
||||
if (pthread_mutex_init(&mutex_, 0))
|
||||
{
|
||||
throw trrep::runtime_error("mutex init failed");
|
||||
throw wsrep::runtime_error("mutex init failed");
|
||||
}
|
||||
}
|
||||
~default_mutex()
|
||||
{
|
||||
if (pthread_mutex_destroy(&mutex_))
|
||||
{
|
||||
throw trrep::runtime_error("mutex destroy failed");
|
||||
throw wsrep::runtime_error("mutex destroy failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ namespace trrep
|
||||
{
|
||||
if (pthread_mutex_lock(&mutex_))
|
||||
{
|
||||
throw trrep::runtime_error("mutex lock failed");
|
||||
throw wsrep::runtime_error("mutex lock failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace trrep
|
||||
{
|
||||
if (pthread_mutex_unlock(&mutex_))
|
||||
{
|
||||
throw trrep::runtime_error("mutex unlock failed");
|
||||
throw wsrep::runtime_error("mutex unlock failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,4 +74,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_MUTEX_HPP
|
||||
#endif // WSREP_MUTEX_HPP
|
@ -2,8 +2,8 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_PROVIDER_HPP
|
||||
#define TRREP_PROVIDER_HPP
|
||||
#ifndef WSREP_PROVIDER_HPP
|
||||
#define WSREP_PROVIDER_HPP
|
||||
|
||||
// #include "provider_impl.hpp"
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
// Abstract interface for provider implementations
|
||||
class provider
|
||||
@ -96,4 +96,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_PROVIDER_HPP
|
||||
#endif // WSREP_PROVIDER_HPP
|
@ -7,7 +7,7 @@
|
||||
* Server Context Abstraction
|
||||
* ==========================
|
||||
*
|
||||
* This file defines an interface for TRRep Server Context.
|
||||
* This file defines an interface for WSREP Server Context.
|
||||
* The Server Context will encapsulate server identification,
|
||||
* server state and server capabilities. The class also
|
||||
* defines an interface for manipulating server state, applying
|
||||
@ -58,8 +58,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRREP_SERVER_CONTEXT_HPP
|
||||
#define TRREP_SERVER_CONTEXT_HPP
|
||||
#ifndef WSREP_SERVER_CONTEXT_HPP
|
||||
#define WSREP_SERVER_CONTEXT_HPP
|
||||
|
||||
#include "exception.hpp"
|
||||
#include "mutex.hpp"
|
||||
@ -69,7 +69,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
// Forward declarations
|
||||
class provider;
|
||||
@ -208,13 +208,13 @@ namespace trrep
|
||||
*
|
||||
* \return Reference to provider
|
||||
*
|
||||
* \throw trrep::runtime_error if provider has not been loaded
|
||||
* \throw wsrep::runtime_error if provider has not been loaded
|
||||
*/
|
||||
virtual trrep::provider& provider() const
|
||||
virtual wsrep::provider& provider() const
|
||||
{
|
||||
if (provider_ == 0)
|
||||
{
|
||||
throw trrep::runtime_error("provider not loaded");
|
||||
throw wsrep::runtime_error("provider not loaded");
|
||||
}
|
||||
return *provider_;
|
||||
}
|
||||
@ -237,10 +237,10 @@ namespace trrep
|
||||
* notification event has been delivered by the
|
||||
* provider.
|
||||
*
|
||||
* \params view trrep::view object which holds the new view
|
||||
* \params view wsrep::view object which holds the new view
|
||||
* information.
|
||||
*/
|
||||
void on_view(const trrep::view& view);
|
||||
void on_view(const wsrep::view& view);
|
||||
|
||||
/*!
|
||||
* A method which will be called when the server
|
||||
@ -254,7 +254,7 @@ namespace trrep
|
||||
/*!
|
||||
* Wait until server reaches given state.
|
||||
*/
|
||||
void wait_until_state(trrep::server_context::state) const;
|
||||
void wait_until_state(wsrep::server_context::state) const;
|
||||
|
||||
/*!
|
||||
* Virtual method to return true if the configured SST
|
||||
@ -275,7 +275,7 @@ namespace trrep
|
||||
* Virtual method which will be called on *donor* when the
|
||||
* SST request has been delivered by the provider.
|
||||
* This method should initiate SST transfer or throw
|
||||
* a trrep::runtime_error
|
||||
* a wsrep::runtime_error
|
||||
* if the SST transfer cannot be initiated. If the SST request
|
||||
* initiation is succesful, the server remains in s_donor
|
||||
* state until the SST is over or fails. The \param bypass
|
||||
@ -332,8 +332,8 @@ namespace trrep
|
||||
*
|
||||
* \return Zero on success, non-zero on failure.
|
||||
*/
|
||||
int on_apply(trrep::client_context& client_context,
|
||||
const trrep::data& data);
|
||||
int on_apply(wsrep::client_context& client_context,
|
||||
const wsrep::data& data);
|
||||
|
||||
/*!
|
||||
* This virtual method should be implemented by the DBMS
|
||||
@ -344,8 +344,8 @@ namespace trrep
|
||||
* replication, false otherwise.
|
||||
*/
|
||||
virtual bool statement_allowed_for_streaming(
|
||||
const trrep::client_context& client_context,
|
||||
const trrep::transaction_context& transaction_context) const;
|
||||
const wsrep::client_context& client_context,
|
||||
const wsrep::transaction_context& transaction_context) const;
|
||||
|
||||
void debug_log_level(int level) { debug_log_level_ = level; }
|
||||
int debug_log_level() const { return debug_log_level_; }
|
||||
@ -363,8 +363,8 @@ namespace trrep
|
||||
* data files.
|
||||
* \param rollback_mode Rollback mode which server operates on.
|
||||
*/
|
||||
server_context(trrep::mutex& mutex,
|
||||
trrep::condition_variable& cond,
|
||||
server_context(wsrep::mutex& mutex,
|
||||
wsrep::condition_variable& cond,
|
||||
const std::string& name,
|
||||
const std::string& id,
|
||||
const std::string& address,
|
||||
@ -388,13 +388,13 @@ namespace trrep
|
||||
server_context(const server_context&);
|
||||
server_context& operator=(const server_context&);
|
||||
|
||||
void state(trrep::unique_lock<trrep::mutex>&, enum state);
|
||||
void state(wsrep::unique_lock<wsrep::mutex>&, enum state);
|
||||
|
||||
trrep::mutex& mutex_;
|
||||
trrep::condition_variable& cond_;
|
||||
wsrep::mutex& mutex_;
|
||||
wsrep::condition_variable& cond_;
|
||||
enum state state_;
|
||||
mutable std::vector<int> state_waiters_;
|
||||
trrep::provider* provider_;
|
||||
wsrep::provider* provider_;
|
||||
std::string name_;
|
||||
std::string id_;
|
||||
std::string address_;
|
||||
@ -403,23 +403,23 @@ namespace trrep
|
||||
int debug_log_level_;
|
||||
};
|
||||
|
||||
static inline std::string to_string(enum trrep::server_context::state state)
|
||||
static inline std::string to_string(enum wsrep::server_context::state state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case trrep::server_context::s_disconnected: return "disconnected";
|
||||
case trrep::server_context::s_initializing: return "initilizing";
|
||||
case trrep::server_context::s_initialized: return "initilized";
|
||||
case trrep::server_context::s_connected: return "connected";
|
||||
case trrep::server_context::s_joiner: return "joiner";
|
||||
case trrep::server_context::s_joined: return "joined";
|
||||
case trrep::server_context::s_donor: return "donor";
|
||||
case trrep::server_context::s_synced: return "synced";
|
||||
case trrep::server_context::s_disconnecting: return "disconnecting";
|
||||
case wsrep::server_context::s_disconnected: return "disconnected";
|
||||
case wsrep::server_context::s_initializing: return "initilizing";
|
||||
case wsrep::server_context::s_initialized: return "initilized";
|
||||
case wsrep::server_context::s_connected: return "connected";
|
||||
case wsrep::server_context::s_joiner: return "joiner";
|
||||
case wsrep::server_context::s_joined: return "joined";
|
||||
case wsrep::server_context::s_donor: return "donor";
|
||||
case wsrep::server_context::s_synced: return "synced";
|
||||
case wsrep::server_context::s_disconnecting: return "disconnecting";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // TRREP_SERVER_CONTEXT_HPP
|
||||
#endif // WSREP_SERVER_CONTEXT_HPP
|
@ -2,8 +2,8 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_TRANSACTION_CONTEXT_HPP
|
||||
#define TRREP_TRANSACTION_CONTEXT_HPP
|
||||
#ifndef WSREP_TRANSACTION_CONTEXT_HPP
|
||||
#define WSREP_TRANSACTION_CONTEXT_HPP
|
||||
|
||||
#include "provider.hpp"
|
||||
#include "server_context.hpp"
|
||||
@ -14,7 +14,7 @@
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class client_context;
|
||||
class key;
|
||||
@ -59,17 +59,17 @@ namespace trrep
|
||||
enum state state() const
|
||||
{ return state_; }
|
||||
|
||||
transaction_context(trrep::client_context& client_context);
|
||||
transaction_context(wsrep::client_context& client_context);
|
||||
~transaction_context();
|
||||
// Accessors
|
||||
trrep::transaction_id id() const
|
||||
wsrep::transaction_id id() const
|
||||
{ return id_; }
|
||||
|
||||
bool active() const
|
||||
{ return (id_ != trrep::transaction_id::invalid()); }
|
||||
{ return (id_ != wsrep::transaction_id::invalid()); }
|
||||
|
||||
|
||||
void state(trrep::unique_lock<trrep::mutex>&, enum state);
|
||||
void state(wsrep::unique_lock<wsrep::mutex>&, enum state);
|
||||
|
||||
// Return true if the certification of the last
|
||||
// fragment succeeded
|
||||
@ -99,15 +99,15 @@ namespace trrep
|
||||
return start_transaction(trx_meta_.stid.trx);
|
||||
}
|
||||
|
||||
int start_transaction(const trrep::transaction_id& id);
|
||||
int start_transaction(const wsrep::transaction_id& id);
|
||||
|
||||
int start_transaction(const wsrep_ws_handle_t& ws_handle,
|
||||
const wsrep_trx_meta_t& trx_meta,
|
||||
uint32_t flags);
|
||||
|
||||
int append_key(const trrep::key&);
|
||||
int append_key(const wsrep::key&);
|
||||
|
||||
int append_data(const trrep::data&);
|
||||
int append_data(const wsrep::data&);
|
||||
|
||||
int after_row();
|
||||
|
||||
@ -129,7 +129,7 @@ namespace trrep
|
||||
|
||||
int after_statement();
|
||||
|
||||
bool bf_abort(trrep::unique_lock<trrep::mutex>& lock,
|
||||
bool bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
|
||||
wsrep_seqno_t bf_seqno);
|
||||
|
||||
uint32_t flags() const
|
||||
@ -137,7 +137,7 @@ namespace trrep
|
||||
return flags_;
|
||||
}
|
||||
|
||||
trrep::mutex& mutex();
|
||||
wsrep::mutex& mutex();
|
||||
|
||||
wsrep_ws_handle_t& ws_handle() { return ws_handle_; }
|
||||
private:
|
||||
@ -145,16 +145,16 @@ namespace trrep
|
||||
transaction_context operator=(const transaction_context&);
|
||||
|
||||
void flags(uint32_t flags) { flags_ = flags; }
|
||||
int certify_fragment(trrep::unique_lock<trrep::mutex>&);
|
||||
int certify_commit(trrep::unique_lock<trrep::mutex>&);
|
||||
int certify_fragment(wsrep::unique_lock<wsrep::mutex>&);
|
||||
int certify_commit(wsrep::unique_lock<wsrep::mutex>&);
|
||||
void remove_fragments();
|
||||
void clear_fragments();
|
||||
void cleanup();
|
||||
void debug_log_state(const char*) const;
|
||||
|
||||
trrep::provider& provider_;
|
||||
trrep::client_context& client_context_;
|
||||
trrep::transaction_id id_;
|
||||
wsrep::provider& provider_;
|
||||
wsrep::client_context& client_context_;
|
||||
wsrep::transaction_id id_;
|
||||
enum state state_;
|
||||
std::vector<enum state> state_hist_;
|
||||
enum state bf_abort_state_;
|
||||
@ -166,29 +166,29 @@ namespace trrep
|
||||
bool certified_;
|
||||
|
||||
std::vector<wsrep_gtid_t> fragments_;
|
||||
trrep::transaction_id rollback_replicated_for_;
|
||||
wsrep::transaction_id rollback_replicated_for_;
|
||||
};
|
||||
|
||||
static inline std::string to_string(enum trrep::transaction_context::state state)
|
||||
static inline std::string to_string(enum wsrep::transaction_context::state state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case trrep::transaction_context::s_executing: return "executing";
|
||||
case trrep::transaction_context::s_preparing: return "preparing";
|
||||
case trrep::transaction_context::s_certifying: return "certifying";
|
||||
case trrep::transaction_context::s_committing: return "committing";
|
||||
case trrep::transaction_context::s_ordered_commit: return "ordered_commit";
|
||||
case trrep::transaction_context::s_committed: return "committed";
|
||||
case trrep::transaction_context::s_cert_failed: return "cert_failed";
|
||||
case trrep::transaction_context::s_must_abort: return "must_abort";
|
||||
case trrep::transaction_context::s_aborting: return "aborting";
|
||||
case trrep::transaction_context::s_aborted: return "aborted";
|
||||
case trrep::transaction_context::s_must_replay: return "must_replay";
|
||||
case trrep::transaction_context::s_replaying: return "replaying";
|
||||
case wsrep::transaction_context::s_executing: return "executing";
|
||||
case wsrep::transaction_context::s_preparing: return "preparing";
|
||||
case wsrep::transaction_context::s_certifying: return "certifying";
|
||||
case wsrep::transaction_context::s_committing: return "committing";
|
||||
case wsrep::transaction_context::s_ordered_commit: return "ordered_commit";
|
||||
case wsrep::transaction_context::s_committed: return "committed";
|
||||
case wsrep::transaction_context::s_cert_failed: return "cert_failed";
|
||||
case wsrep::transaction_context::s_must_abort: return "must_abort";
|
||||
case wsrep::transaction_context::s_aborting: return "aborting";
|
||||
case wsrep::transaction_context::s_aborted: return "aborted";
|
||||
case wsrep::transaction_context::s_must_replay: return "must_replay";
|
||||
case wsrep::transaction_context::s_replaying: return "replaying";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // TRREP_TRANSACTION_CONTEXT_HPP
|
||||
#endif // WSREP_TRANSACTION_CONTEXT_HPP
|
@ -2,14 +2,14 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#ifndef TRREP_VIEW_HPP
|
||||
#define TRREP_VIEW_HPP
|
||||
#ifndef WSREP_VIEW_HPP
|
||||
#define WSREP_VIEW_HPP
|
||||
|
||||
#include <wsrep_api.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace trrep
|
||||
namespace wsrep
|
||||
{
|
||||
class view
|
||||
{
|
||||
@ -87,4 +87,4 @@ namespace trrep
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRREP_VIEW
|
||||
#endif // WSREP_VIEW
|
Reference in New Issue
Block a user