OpenCBDC Transaction Processor
|
RPC client for the mutable interface to a locking shard raft cluster. More...
#include <client.hpp>
Public Member Functions | |
client (std::vector< network::endpoint_t > endpoints, const std::pair< uint8_t, uint8_t > &output_range, logging::log &logger) | |
Constructs a new locking shard client for issuing RPCs to a remote shard cluster. | |
client ()=delete | |
~client () override | |
client (const client &)=delete | |
auto | operator= (const client &) -> client &=delete |
client (client &&)=delete | |
auto | operator= (client &&) -> client &=delete |
auto | init () -> bool |
Initializes the RPC client. | |
auto | lock_outputs (std::vector< tx > &&txs, const hash_t &dtx_id) -> std::optional< std::vector< bool > > override |
Issues a lock RPC to the remote shard and returns its response. | |
auto | apply_outputs (std::vector< bool > &&complete_txs, const hash_t &dtx_id) -> bool override |
Issues an apply RPC to the remote shard and returns its response. | |
auto | discard_dtx (const hash_t &dtx_id) -> bool override |
Issues a discard RPC to the remote shard and returns its response. | |
void | stop () override |
Shuts down the client and unblocks any existing requests waiting for a response. | |
![]() | |
interface (std::pair< uint8_t, uint8_t > output_range) | |
Constructor. | |
virtual | ~interface ()=default |
interface ()=delete | |
interface (const interface &)=delete | |
auto | operator= (const interface &) -> interface &=delete |
interface (interface &&)=delete | |
auto | operator= (interface &&) -> interface &=delete |
virtual auto | hash_in_shard_range (const hash_t &h) const -> bool |
Returns whether a given hash is within the shard's range. | |
RPC client for the mutable interface to a locking shard raft cluster.
Definition at line 16 of file uhs/twophase/locking_shard/client.hpp.
cbdc::locking_shard::rpc::client::client | ( | std::vector< network::endpoint_t > | endpoints, |
const std::pair< uint8_t, uint8_t > & | output_range, | ||
logging::log & | logger ) |
Constructs a new locking shard client for issuing RPCs to a remote shard cluster.
The class is thread-safe on a per-dtx ID basis; only one thread should issue RPCs for a given dtx ID at a time.
endpoints | vector of shard node endpoints comprising the cluster |
output_range | inclusive range of UHS ID prefixes covered by the shard cluster |
logger | log instance for writing status messages |
Definition at line 12 of file uhs/twophase/locking_shard/client.cpp.
|
delete |
|
override |
Definition at line 21 of file uhs/twophase/locking_shard/client.cpp.
References stop().
|
delete |
|
delete |
|
overridevirtual |
Issues an apply RPC to the remote shard and returns its response.
complete_txs | vector of flags to indicate which transactions in the distributed transaction should be finalized or rolled back |
dtx_id | dtx ID upon which to perform apply |
Implements cbdc::locking_shard::interface.
Definition at line 39 of file uhs/twophase/locking_shard/client.cpp.
|
overridevirtual |
Issues a discard RPC to the remote shard and returns its response.
dtx_id | dtx ID to discard |
Implements cbdc::locking_shard::interface.
Definition at line 46 of file uhs/twophase/locking_shard/client.cpp.
auto cbdc::locking_shard::rpc::client::init | ( | ) | -> bool |
Initializes the RPC client.
Connects to the shard cluster and starts the response handler thread.
Definition at line 25 of file uhs/twophase/locking_shard/client.cpp.
Referenced by cbdc::locking_shard::rpc::status_client::init().
|
overridevirtual |
Issues a lock RPC to the remote shard and returns its response.
txs | vector of txs representing the input and output UHS IDs to lock for spending or creation |
dtx_id | dtx ID for this batch of transactions |
Implements cbdc::locking_shard::interface.
Definition at line 29 of file uhs/twophase/locking_shard/client.cpp.
|
overridevirtual |
Shuts down the client and unblocks any existing requests waiting for a response.
Implements cbdc::locking_shard::interface.
Definition at line 71 of file uhs/twophase/locking_shard/client.cpp.
Referenced by ~client().