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

* Added size exceeded error code

* Return provider status from selected client_state calls
* Added more methods to provider interface
This commit is contained in:
Teemu Ollakka
2018-06-20 19:44:20 +03:00
parent bf7dad6815
commit ef0fb72b73
9 changed files with 109 additions and 15 deletions

View File

@ -30,6 +30,7 @@ namespace wsrep
e_error_during_commit,
e_deadlock_error,
e_interrupted_error,
e_size_exceeded_error,
e_append_fragment_error
};
@ -41,6 +42,7 @@ namespace wsrep
case e_error_during_commit: return "error_during_commit";
case e_deadlock_error: return "deadlock_error";
case e_interrupted_error: return "interrupted_error";
case e_size_exceeded_error: return "size_exceeded";
case e_append_fragment_error: return "append_fragment_error";
}
return "unknown";
@ -393,7 +395,7 @@ namespace wsrep
* in the DBMS cluster, so it may be relatively heavy operation.
* Method wait_for_gtid() should be used whenever possible.
*/
int causal_read() const;
enum wsrep::provider::status causal_read() const;
/**
* Wait until all the write sets up to given GTID have been
@ -401,7 +403,7 @@ namespace wsrep
*
* @return Zero on success, non-zero on failure.
*/
int wait_for_gtid(const wsrep::gtid&) const;
enum wsrep::provider::status wait_for_gtid(const wsrep::gtid&) const;
//
//
@ -413,7 +415,7 @@ namespace wsrep
/**
* Enter total order isolation critical section.
*/
int enter_toi();
enum wsrep::provider::status enter_toi();
/**
* Leave total order isolation critical section.
@ -423,7 +425,7 @@ namespace wsrep
/**
* Begin non-blocking operation.
*/
int begin_nbo();
int begin_nbo(const wsrep::key_array&);
/**
* End non-blocking operation

View File

@ -57,6 +57,9 @@ namespace wsrep
wsrep::const_buffer key_parts_[3];
size_t key_parts_len_;
};
typedef std::vector<wsrep::key> key_array;
}
#endif // WSREP_KEY_HPP

View File

@ -196,7 +196,7 @@ namespace wsrep
/**
* Provider capabilities.
*/
struct capabilities
struct capability
{
static const int multi_master = (1 << 0);
static const int certification = (1 << 1);
@ -228,6 +228,12 @@ namespace wsrep
bool bootstrap) = 0;
virtual int disconnect() = 0;
virtual int capabilities() const = 0;
virtual int desync() = 0;
virtual int resync() = 0;
virtual int pause() = 0;
virtual int resume() = 0;
// Applier interface
virtual enum status run_applier(void* applier_ctx) = 0;
@ -235,7 +241,8 @@ namespace wsrep
// TODO: Rename to assing_read_view()
virtual int start_transaction(wsrep::ws_handle&) = 0;
virtual int append_key(wsrep::ws_handle&, const wsrep::key&) = 0;
virtual int append_data(wsrep::ws_handle&, const wsrep::const_buffer&) = 0;
virtual enum status append_data(
wsrep::ws_handle&, const wsrep::const_buffer&) = 0;
virtual enum status
certify(wsrep::client_id, wsrep::ws_handle&,
int,
@ -274,6 +281,10 @@ namespace wsrep
virtual int sst_received(const wsrep::gtid&, int) = 0;
virtual std::vector<status_variable> status() const = 0;
virtual void reset_status() = 0;
virtual std::string options() const = 0;
virtual void options(const std::string&) = 0;
/**
* Return pointer to native provider handle.

View File

@ -316,6 +316,7 @@ namespace wsrep
const wsrep::ws_meta& ws_meta,
const wsrep::const_buffer& data);
enum state state() const { return state_; }
/**
* Set server wide wsrep debug logging level.
*

View File

@ -155,7 +155,7 @@ namespace wsrep
wsrep::streaming_context streaming_context_;
};
static inline std::string to_string(enum wsrep::transaction::state state)
static inline const char* to_c_string(enum wsrep::transaction::state state)
{
switch (state)
{
@ -174,6 +174,10 @@ namespace wsrep
}
return "unknown";
}
static inline std::string to_string(enum wsrep::transaction::state state)
{
return to_c_string(state);
}
}