1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-31 18:24:25 +03:00

Cleaning wsrep-API dependencies from library code

Replace all wsrep_api.h dependencies with similar code
in library implementation.

Also add gcc/g++ 4.4 to travis automation to get better
compiler coverage.
This commit is contained in:
Teemu Ollakka
2019-02-16 17:09:18 +02:00
parent 58aa3e821f
commit 29835fbec0
14 changed files with 354 additions and 30 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&);
}