MXS-1881: Expand GTID helper class

Added string conversion methods to the gtid_pos_t class that can be used
to store and load a GTID value.

Also added the missing rpl.cc file that previously only had the Rpl class
constructor in it.
This commit is contained in:
Markus Mäkelä
2018-06-11 09:53:08 +03:00
parent ac6370afcf
commit c27529c9a4
4 changed files with 100 additions and 26 deletions

View File

@ -15,6 +15,7 @@
#include <vector>
#include <cstdint>
#include <string>
#include <sstream>
#include <tr1/memory>
#include <tr1/unordered_map>
@ -45,14 +46,11 @@ struct gtid_pos_t
* an event inside a GTID event and it is used to
* rebuild GTID events in the correct order. */
void extract(const REP_HEADER& hdr, uint8_t* ptr)
{
domain = extract_field(ptr + 8, 32);
server_id = hdr.serverid;
seq = extract_field(ptr, 64);
event_num = 0;
timestamp = hdr.timestamp;
}
void extract(const REP_HEADER& hdr, uint8_t* ptr);
bool parse(const char* str);
static gtid_pos_t from_string(std::string str);
std::string to_string() const;
bool empty() const;
};
/** A single column in a CREATE TABLE statement */
@ -196,7 +194,7 @@ public:
Rpl& operator=(const Rpl&) = delete;
// Construct a new replication stream transformer
Rpl(SERVICE* service, SRowEventHandler event_handler);
Rpl(SERVICE* service, SRowEventHandler event_handler, gtid_pos_t = {});
// Add a stored TableCreateEvent
void add_create(STableCreateEvent create);