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

Refactored seqno and id classes out of provider.hpp

This commit is contained in:
Teemu Ollakka
2018-06-12 10:20:58 +03:00
parent f506faa360
commit 97d9f93648
14 changed files with 242 additions and 150 deletions

View File

@ -4,36 +4,6 @@
#include "wsrep/provider.hpp"
#include "provider_impl.hpp"
#include <wsrep_api.h>
#include <cerrno>
#include <sstream>
wsrep::id::id(const std::string& str)
: type_(none)
, data_()
{
wsrep_uuid_t wsrep_uuid;
if (wsrep_uuid_scan(str.c_str(), str.size(), &wsrep_uuid) ==
WSREP_UUID_STR_LEN)
{
type_ = uuid;
std::memcpy(data_, wsrep_uuid.data, sizeof(data_));
}
else if (str.size() <= 16)
{
type_ = string;
std::memcpy(data_, str.c_str(), str.size());
}
else
{
std::ostringstream os;
os << "String '" << str << "' does not contain UUID";
throw wsrep::runtime_error(os.str());
}
}
wsrep::provider* wsrep::provider::make_provider(
const std::string&)
{