mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
codership/wsrep-lib#100 Support for assign_read_view() wsrep API call
Marshall the call from the `client_state` interface down to provider.
This commit is contained in:
@ -75,7 +75,7 @@ std::string wsrep::provider::capability::str(int caps)
|
||||
WSREP_PRINT_CAPABILITY(annotation, "ANNOTATION");
|
||||
WSREP_PRINT_CAPABILITY(preordered, "PREORDERED");
|
||||
WSREP_PRINT_CAPABILITY(streaming, "STREAMING");
|
||||
WSREP_PRINT_CAPABILITY(snapshot, "SNAPSHOT");
|
||||
WSREP_PRINT_CAPABILITY(snapshot, "READ_VIEW");
|
||||
WSREP_PRINT_CAPABILITY(nbo, "NBO");
|
||||
|
||||
#undef WSREP_PRINT_CAPABILITY
|
||||
@ -107,7 +107,7 @@ std::string wsrep::flags_to_string(int flags)
|
||||
if (flags & provider::flag::prepare)
|
||||
oss << "prepare | ";
|
||||
if (flags & provider::flag::snapshot)
|
||||
oss << "snapshot | ";
|
||||
oss << "read_view | ";
|
||||
if (flags & provider::flag::implicit_deps)
|
||||
oss << "implicit_deps | ";
|
||||
|
||||
|
@ -208,6 +208,19 @@ int wsrep::transaction::prepare_for_ordering(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wsrep::transaction::assign_read_view(const wsrep::gtid* const gtid)
|
||||
{
|
||||
try
|
||||
{
|
||||
return provider().assign_read_view(ws_handle_, gtid);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
wsrep::log_error() << "Failed to assign read view";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int wsrep::transaction::append_key(const wsrep::key& key)
|
||||
{
|
||||
try
|
||||
|
@ -690,6 +690,25 @@ wsrep::wsrep_provider_v26::run_applier(
|
||||
return map_return_value(wsrep_->recv(wsrep_, applier_ctx));
|
||||
}
|
||||
|
||||
enum wsrep::provider::status
|
||||
wsrep::wsrep_provider_v26::assign_read_view(wsrep::ws_handle& ws_handle,
|
||||
const wsrep::gtid* gtid)
|
||||
{
|
||||
const wsrep_gtid_t* gtid_ptr(NULL);
|
||||
wsrep_gtid_t tmp;
|
||||
|
||||
if (gtid)
|
||||
{
|
||||
::memcpy(&tmp.uuid, gtid->id().data(), sizeof(tmp.uuid));
|
||||
tmp.seqno = gtid->seqno().get();
|
||||
gtid_ptr = &tmp;
|
||||
}
|
||||
|
||||
mutable_ws_handle mwsh(ws_handle);
|
||||
return map_return_value(wsrep_->assign_read_view(wsrep_, mwsh.native(),
|
||||
gtid_ptr));
|
||||
}
|
||||
|
||||
int wsrep::wsrep_provider_v26::append_key(wsrep::ws_handle& ws_handle,
|
||||
const wsrep::key& key)
|
||||
{
|
||||
@ -714,7 +733,7 @@ int wsrep::wsrep_provider_v26::append_key(wsrep::ws_handle& ws_handle,
|
||||
|
||||
enum wsrep::provider::status
|
||||
wsrep::wsrep_provider_v26::append_data(wsrep::ws_handle& ws_handle,
|
||||
const wsrep::const_buffer& data)
|
||||
const wsrep::const_buffer& data)
|
||||
{
|
||||
const wsrep_buf_t wsrep_buf = {data.data(), data.size()};
|
||||
mutable_ws_handle mwsh(ws_handle);
|
||||
|
@ -46,6 +46,8 @@ namespace wsrep
|
||||
|
||||
enum wsrep::provider::status run_applier(wsrep::high_priority_service*);
|
||||
int start_transaction(wsrep::ws_handle&) { return 0; }
|
||||
enum wsrep::provider::status
|
||||
assign_read_view(wsrep::ws_handle&, const wsrep::gtid*);
|
||||
int append_key(wsrep::ws_handle&, const wsrep::key&);
|
||||
enum wsrep::provider::status
|
||||
append_data(wsrep::ws_handle&, const wsrep::const_buffer&);
|
||||
|
Reference in New Issue
Block a user