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

Implemented thread service support.

Added a wsrep::thread_service interface to allow application to
inject instrumented thread, mutex and condition variable implementation
for provider.

The interface is defined in include/wsrep/thread_service.hpp.
Sample implementation is provided in dbsim/db_threads.[h|c]pp.

This patch will also clean up some remaining dependencies to
wsrep-API compilation units so that the dependency to wsrep-API
is header only. This will extending the provider support to
later wsrep-API versions.
This commit is contained in:
Teemu Ollakka
2019-02-16 17:09:18 +02:00
parent 477a71dd46
commit eb4cf86c1e
33 changed files with 1821 additions and 58 deletions

View File

@ -22,9 +22,16 @@
#include "id.hpp"
#include "seqno.hpp"
#include "compiler.hpp"
#include <iosfwd>
/**
* Minimum number of bytes guaratneed to store GTID string representation,
* terminating '\0' not included (36 + 1 + 20).
*/
#define WSREP_LIB_GTID_C_STR_LEN 57
namespace wsrep
{
class gtid
@ -61,6 +68,18 @@ namespace wsrep
wsrep::seqno seqno_;
};
/**
* Scan a GTID from C string.
*
* @param buf Buffer containing the string
* @param len Length of buffer
* @param[out] gtid Gtid to be printed to
*
* @return Number of bytes scanned, negative value on error.
*/
ssize_t scan_from_c_str(const char* buf, size_t buf_len,
wsrep::gtid& gtid);
/**
* Print a GTID into character buffer.
* @param buf Pointer to the beginning of the buffer
@ -68,16 +87,16 @@ namespace wsrep
*
* @return Number of characters printed or negative value for error
*/
ssize_t gtid_print_to_c_str(const wsrep::gtid&, char* buf, size_t buf_len);
ssize_t print_to_c_str(const wsrep::gtid&, char* buf, size_t buf_len);
/**
* Return minimum number of bytes guaranteed to store GTID string
* representation, terminating '\0' not included (36 + 1 + 20)
* Overload for ostream operator<<.
*/
static inline size_t gtid_c_str_len()
{
return 57;
}
std::ostream& operator<<(std::ostream&, const wsrep::gtid&);
/**
* Overload for istream operator>>.
*/
std::istream& operator>>(std::istream&, wsrep::gtid&);
}