1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-16 02:01:44 +03:00

Provider type abstraction, partially completed.

This commit is contained in:
Teemu Ollakka
2018-06-09 23:28:02 +03:00
parent 2cecb3defe
commit e74b214c9c
15 changed files with 646 additions and 263 deletions

View File

@ -6,8 +6,34 @@
#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());
}
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&)
const std::string&)
{
return 0;
}