13 : m_client(std::make_unique<decltype(m_client)::element_type>(
14 std::move(endpoints))) {}
17 return m_client->init();
31 return m_client->call(
33 [result_callback](std::optional<response> resp) {
34 assert(resp.has_value());
35 assert(std::holds_alternative<try_lock_return_type>(
37 result_callback(std::get<try_lock_return_type>(resp.value()));
46 return m_client->call(
48 [result_callback](std::optional<response> resp) {
49 assert(resp.has_value());
51 std::holds_alternative<prepare_return_type>(resp.value()));
52 result_callback(std::get<prepare_return_type>(resp.value()));
59 return m_client->call(
61 [result_callback](std::optional<response> resp) {
62 assert(resp.has_value());
64 std::holds_alternative<commit_return_type>(resp.value()));
65 result_callback(std::get<commit_return_type>(resp.value()));
72 return m_client->call(
74 [result_callback](std::optional<response> resp) {
75 assert(resp.has_value());
76 assert(std::holds_alternative<rollback_return_type>(
78 result_callback(std::get<rollback_return_type>(resp.value()));
85 return m_client->call(
87 [result_callback](std::optional<response> resp) {
88 assert(resp.has_value());
90 std::holds_alternative<finish_return_type>(resp.value()));
91 result_callback(std::get<finish_return_type>(resp.value()));
99 return m_client->call(
101 [result_callback](std::optional<response> resp) {
102 assert(resp.has_value());
103 assert(std::holds_alternative<get_tickets_return_type>(
106 std::get<get_tickets_return_type>(resp.value()));
Buffer to store and retrieve byte data.
std::function< void(prepare_return_type)> prepare_callback_type
Callback function type for the result of a prepare operation.
std::function< void(get_tickets_return_type)> get_tickets_callback_type
Callback function type for the result of a get tickets operation.
std::function< void(rollback_return_type)> rollback_callback_type
Callback function type for the result of a rollback operation.
std::function< void(finish_return_type)> finish_callback_type
Callback function type for the result of a finish operation.
std::function< void(try_lock_return_type)> try_lock_callback_type
Function type for try lock operation results.
std::function< void(commit_return_type)> commit_callback_type
Callback function type for the result of a commit operation.
auto init() -> bool
Initializes the underlying TCP client.
auto prepare(ticket_number_type ticket_number, broker_id_type broker_id, state_update_type state_update, prepare_callback_type result_callback) -> bool override
Requests a prepare operation from the remote shard.
auto commit(ticket_number_type ticket_number, commit_callback_type result_callback) -> bool override
Requests a commit operation from the remote shard.
auto get_tickets(broker_id_type broker_id, get_tickets_callback_type result_callback) -> bool override
Requests a get tickets operation from the remote shard.
auto try_lock(ticket_number_type ticket_number, broker_id_type broker_id, key_type key, lock_type locktype, bool first_lock, try_lock_callback_type result_callback) -> bool override
Requests a try lock operation from the remote shard.
auto finish(ticket_number_type ticket_number, finish_callback_type result_callback) -> bool override
Requests a finish operation from the remote shard.
auto rollback(ticket_number_type ticket_number, rollback_callback_type result_callback) -> bool override
Requests a rollback operation from the remote shard.
parsec::ticket_machine::ticket_number_type ticket_number_type
Type for a ticket number.
size_t broker_id_type
Type for the ID of a broker.
std:: unordered_map< key_type, value_type, hashing::const_sip_hash< key_type > > state_update_type
Type for state updates to a shard. A map of keys and their new values.
lock_type
Types of key lock supported by shards.
Get tickets request message.
Rollback request message.
Try lock request message.