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

Removing client_state dependency from client_service.

This commit is contained in:
Teemu Ollakka
2018-06-18 10:21:02 +03:00
parent af3119a58b
commit 03043d3f25
12 changed files with 159 additions and 175 deletions

View File

@ -22,7 +22,6 @@
namespace wsrep
{
class transaction;
class client_state;
class client_service
{
public:
@ -60,15 +59,14 @@ namespace wsrep
/**
* Set up a data for replication.
*/
virtual int prepare_data_for_replication(wsrep::client_state&, const wsrep::transaction&) = 0;
virtual int prepare_data_for_replication() = 0;
//
// Streaming
//
virtual size_t bytes_generated() const = 0;
virtual int prepare_fragment_for_replication(
wsrep::client_state&, const wsrep::transaction&, wsrep::mutable_buffer&) = 0;
virtual void remove_fragments(const wsrep::transaction&) = 0;
virtual int prepare_fragment_for_replication(wsrep::mutable_buffer&) = 0;
virtual void remove_fragments() = 0;
//
// Applying interface
@ -77,17 +75,17 @@ namespace wsrep
/**
* Apply a write set.
*/
virtual int apply(wsrep::client_state&, const wsrep::const_buffer&) = 0;
virtual int apply(const wsrep::const_buffer&) = 0;
/**
* Commit transaction.
*/
virtual int commit(wsrep::client_state&, const wsrep::ws_handle&, const wsrep::ws_meta&) = 0;
virtual int commit(const wsrep::ws_handle&, const wsrep::ws_meta&) = 0;
/**
* Roll back transaction.
*/
virtual int rollback(wsrep::client_state&) = 0;
virtual int rollback() = 0;
//
// Interface to global server state
@ -109,7 +107,7 @@ namespace wsrep
* @todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual void will_replay(const wsrep::transaction&) = 0;
virtual void will_replay() = 0;
/**
* Replay the current transaction. The implementation must put
@ -119,9 +117,7 @@ namespace wsrep
* @todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual enum wsrep::provider::status replay(
wsrep::client_state&,
wsrep::transaction&) = 0;
virtual enum wsrep::provider::status replay() = 0;
/**
* Wait until all replaying transactions have been finished
@ -130,7 +126,7 @@ namespace wsrep
* @todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib.
*/
virtual void wait_for_replayers(wsrep::client_state&, wsrep::unique_lock<wsrep::mutex>&) = 0;
virtual void wait_for_replayers(wsrep::unique_lock<wsrep::mutex>&) = 0;
// Streaming replication
/**
@ -146,7 +142,7 @@ namespace wsrep
*
* @params sync_point Name of the debug sync point.
*/
virtual void debug_sync(wsrep::client_state&, const char* sync_point) = 0;
virtual void debug_sync(const char* sync_point) = 0;
/**
* Forcefully kill the process if the crash_point has

View File

@ -242,9 +242,9 @@ namespace wsrep
return transaction_.append_data(data);
}
int prepare_data_for_replication(const wsrep::transaction& tc)
int prepare_data_for_replication()
{
return client_service_.prepare_data_for_replication(*this, tc);
return client_service_.prepare_data_for_replication();
}
/** @} */
@ -286,12 +286,9 @@ namespace wsrep
}
/** @todo deprecate */
int prepare_fragment_for_replication(
const wsrep::transaction& tc,
wsrep::mutable_buffer& mb)
int prepare_fragment_for_replication(wsrep::mutable_buffer& mb)
{
return client_service_.prepare_fragment_for_replication(
*this, tc, mb);
return client_service_.prepare_fragment_for_replication(mb);
}
/** @todo deprecate */
@ -310,7 +307,7 @@ namespace wsrep
*/
void remove_fragments()
{
client_service_.remove_fragments(transaction_);
client_service_.remove_fragments();
}
/** @} */
@ -323,17 +320,17 @@ namespace wsrep
return transaction_.start_transaction(wsh, meta);
}
/** @todo deprecate */
int apply(const wsrep::const_buffer& data)
{
assert(mode_ == m_high_priority);
return client_service_.apply(*this, data);
return client_service_.apply(data);
}
int commit()
{
assert(mode_ == m_high_priority || mode_ == m_local);
return client_service_.commit(
*this,
transaction_.ws_handle(), transaction_.ws_meta());
}
/** @} */
@ -377,7 +374,7 @@ namespace wsrep
/** @{ */
int rollback()
{
return client_service_.rollback(*this);
return client_service_.rollback();
}
int before_rollback()
@ -419,23 +416,25 @@ namespace wsrep
transaction_.streaming_context_ = transaction.streaming_context_;
}
/** @todo deprecate */
enum wsrep::provider::status replay(
wsrep::transaction& tc)
wsrep::transaction&)
{
return client_service_.replay(*this, tc);
return client_service_.replay();
}
//
//
//
void will_replay(const wsrep::transaction& tc)
void will_replay(const wsrep::transaction&)
{
client_service_.will_replay(tc);
client_service_.will_replay();
}
/** @todo deprecate */
void wait_for_replayers(wsrep::unique_lock<wsrep::mutex>& lock)
{
client_service_.wait_for_replayers(*this, lock);
client_service_.wait_for_replayers(lock);
}
bool interrupted() const
@ -503,7 +502,7 @@ namespace wsrep
//
void debug_sync(const char* sync_point)
{
client_service_.debug_sync(*this, sync_point);
client_service_.debug_sync(sync_point);
}
void debug_crash(const char* crash_point)