OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::parsec::runtime_locking_shard::rpc::client Class Reference

RPC client for a runtime locking shard cluster. More...

#include <client.hpp>

Inheritance diagram for cbdc::parsec::runtime_locking_shard::rpc::client:
Collaboration diagram for cbdc::parsec::runtime_locking_shard::rpc::client:

Public Member Functions

 client (std::vector< network::endpoint_t > endpoints)
 Constructor.
 
 client ()=delete
 
 ~client () override=default
 
 client (const client &)=delete
 
auto operator= (const client &) -> client &=delete
 
 client (client &&)=delete
 
auto operator= (client &&) -> client &=delete
 
auto init () -> bool
 Initializes the underlying TCP client.
 
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 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 rollback (ticket_number_type ticket_number, rollback_callback_type result_callback) -> bool override
 Requests a rollback 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 get_tickets (broker_id_type broker_id, get_tickets_callback_type result_callback) -> bool override
 Requests a get tickets operation from the remote shard.
 
- Public Member Functions inherited from cbdc::parsec::runtime_locking_shard::interface
virtual ~interface ()=default
 
 interface ()=default
 
 interface (const interface &)=delete
 
auto operator= (const interface &) -> interface &=delete
 
 interface (interface &&)=delete
 
auto operator= (interface &&) -> interface &=delete
 

Additional Inherited Members

- Public Types inherited from cbdc::parsec::runtime_locking_shard::interface
using try_lock_return_type = std::variant<value_type, shard_error>
 Return type from a try lock operation.
 
using try_lock_callback_type = std::function<void(try_lock_return_type)>
 Function type for try lock operation results.
 
using prepare_return_type = std::optional<shard_error>
 Return type from a prepare operation. An error, if applicable.
 
using prepare_callback_type = std::function<void(prepare_return_type)>
 Callback function type for the result of a prepare operation.
 
using commit_return_type = std::optional<shard_error>
 Return type from a commit operation. An error code, if applicable.
 
using commit_callback_type = std::function<void(commit_return_type)>
 Callback function type for the result of a commit operation.
 
using rollback_return_type = std::optional<shard_error>
 Return type from a rollback operation.
 
using rollback_callback_type = std::function<void(rollback_return_type)>
 Callback function type for the result of a rollback operation.
 
using finish_return_type = std::optional<shard_error>
 Return type from a finish operation. An error code, if applicable.
 
using finish_callback_type = std::function<void(finish_return_type)>
 Callback function type for the result of a finish operation.
 
using get_tickets_success_type = std::unordered_map<ticket_number_type, ticket_state>
 Return type from a successful get tickets operation.
 
using get_tickets_return_type = std::variant<get_tickets_success_type, error_code>
 Return type from a get tickets operation.
 
using get_tickets_callback_type = std::function<void(get_tickets_return_type)>
 Callback function type for the result of a get tickets operation.
 

Detailed Description

RPC client for a runtime locking shard cluster.

Definition at line 15 of file parsec/runtime_locking_shard/client.hpp.

Constructor & Destructor Documentation

◆ client() [1/4]

cbdc::parsec::runtime_locking_shard::rpc::client::client ( std::vector< network::endpoint_t > endpoints)
explicit

Constructor.

Parameters
endpointsRPC server endpoints for the runtime locking shard cluster.

Definition at line 12 of file parsec/runtime_locking_shard/client.cpp.

◆ client() [2/4]

cbdc::parsec::runtime_locking_shard::rpc::client::client ( )
delete

◆ ~client()

cbdc::parsec::runtime_locking_shard::rpc::client::~client ( )
overridedefault

◆ client() [3/4]

cbdc::parsec::runtime_locking_shard::rpc::client::client ( const client & )
delete

◆ client() [4/4]

cbdc::parsec::runtime_locking_shard::rpc::client::client ( client && )
delete

Member Function Documentation

◆ commit()

auto cbdc::parsec::runtime_locking_shard::rpc::client::commit ( ticket_number_type ticket_number,
commit_callback_type result_callback ) -> bool
overridevirtual

Requests a commit operation from the remote shard.

Parameters
ticket_numberticket number.
result_callbackfunction to call with commit result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 56 of file parsec/runtime_locking_shard/client.cpp.

◆ finish()

auto cbdc::parsec::runtime_locking_shard::rpc::client::finish ( ticket_number_type ticket_number,
finish_callback_type result_callback ) -> bool
overridevirtual

Requests a finish operation from the remote shard.

Parameters
ticket_numberticket number.
result_callbackfunction to call with the finish result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 82 of file parsec/runtime_locking_shard/client.cpp.

◆ get_tickets()

auto cbdc::parsec::runtime_locking_shard::rpc::client::get_tickets ( broker_id_type broker_id,
get_tickets_callback_type result_callback ) -> bool
overridevirtual

Requests a get tickets operation from the remote shard.

Parameters
broker_idbroker ID.
result_callbackfunction to call with the get tickets result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 95 of file parsec/runtime_locking_shard/client.cpp.

◆ init()

auto cbdc::parsec::runtime_locking_shard::rpc::client::init ( ) -> bool

Initializes the underlying TCP client.

Returns
true if the client initialized successfully.

Definition at line 16 of file parsec/runtime_locking_shard/client.cpp.

◆ operator=() [1/2]

auto cbdc::parsec::runtime_locking_shard::rpc::client::operator= ( client && ) -> client &=delete
delete

◆ operator=() [2/2]

auto cbdc::parsec::runtime_locking_shard::rpc::client::operator= ( const client & ) -> client &=delete
delete

◆ prepare()

auto cbdc::parsec::runtime_locking_shard::rpc::client::prepare ( ticket_number_type ticket_number,
broker_id_type broker_id,
state_update_type state_update,
prepare_callback_type result_callback ) -> bool
overridevirtual

Requests a prepare operation from the remote shard.

Parameters
ticket_numberticket number.
broker_idID of broker managing ticket.
state_updatestate updates to apply if ticket is committed.
result_callbackfunction to call with prepare result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 41 of file parsec/runtime_locking_shard/client.cpp.

◆ rollback()

auto cbdc::parsec::runtime_locking_shard::rpc::client::rollback ( ticket_number_type ticket_number,
rollback_callback_type result_callback ) -> bool
overridevirtual

Requests a rollback operation from the remote shard.

Parameters
ticket_numberticket number.
result_callbackfunction to call with the rollback result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 69 of file parsec/runtime_locking_shard/client.cpp.

◆ try_lock()

auto cbdc::parsec::runtime_locking_shard::rpc::client::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
overridevirtual

Requests a try lock operation from the remote shard.

Parameters
ticket_numberticket number.
broker_idID of broker managing ticket.
keykey to lock.
locktypetype of lock to acquire.
first_locktrue if this is the first lock.
result_callbackfunction to call with try lock result.
Returns
true if the request was sent successfully.

Implements cbdc::parsec::runtime_locking_shard::interface.

Definition at line 20 of file parsec/runtime_locking_shard/client.cpp.


The documentation for this class was generated from the following files: