Interface for a locking shard.
More...
#include <interface.hpp>
|
| 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 | lock_outputs (std::vector< tx > &&txs, const hash_t &dtx_id) -> std::optional< std::vector< bool > >=0 |
| Attempts to lock the input hashes for the given vector of transactions.
|
|
virtual auto | apply_outputs (std::vector< bool > &&complete_txs, const hash_t &dtx_id) -> bool=0 |
| Completes a previous lock operation by deleting input hashes and creating output hashes, or unlocking input hashes.
|
|
virtual auto | hash_in_shard_range (const hash_t &h) const -> bool |
| Returns whether a given hash is within the shard's range.
|
|
virtual auto | discard_dtx (const hash_t &dtx_id) -> bool=0 |
| Discards any cached information about a given distributed transaction.
|
|
virtual void | stop ()=0 |
| Stops the locking shard implementation from processing further commands and unblocks any pending commands.
|
|
Interface for a locking shard.
Intended to allow for other classes to pick an implementation.
- See also
- locking_shard for an in-memory implementation using hashmaps
-
client for an implementation that connects to a remote shard over a network
Definition at line 30 of file uhs/twophase/locking_shard/interface.hpp.
◆ interface() [1/4]
cbdc::locking_shard::interface::interface |
( |
std::pair< uint8_t, uint8_t > | output_range | ) |
|
|
explicit |
◆ ~interface()
virtual cbdc::locking_shard::interface::~interface |
( |
| ) |
|
|
virtualdefault |
◆ interface() [2/4]
cbdc::locking_shard::interface::interface |
( |
| ) |
|
|
delete |
◆ interface() [3/4]
cbdc::locking_shard::interface::interface |
( |
const interface & | | ) |
|
|
delete |
◆ interface() [4/4]
cbdc::locking_shard::interface::interface |
( |
interface && | | ) |
|
|
delete |
◆ apply_outputs()
virtual auto cbdc::locking_shard::interface::apply_outputs |
( |
std::vector< bool > && | complete_txs, |
|
|
const hash_t & | dtx_id ) -> bool |
|
pure virtual |
Completes a previous lock operation by deleting input hashes and creating output hashes, or unlocking input hashes.
- Parameters
-
complete_txs | vector of flags indicating which txs from the previous lock operation the shard should apply and which it should cancel. Must be the same size as txs from lock. |
dtx_id | distributed transaction ID of the previous lock operation. |
- Returns
- true if the apply operation succeeded.
Implemented in cbdc::locking_shard::locking_shard, and cbdc::locking_shard::rpc::client.
◆ discard_dtx()
virtual auto cbdc::locking_shard::interface::discard_dtx |
( |
const hash_t & | dtx_id | ) |
-> bool |
|
pure virtual |
◆ hash_in_shard_range()
auto cbdc::locking_shard::interface::hash_in_shard_range |
( |
const hash_t & | h | ) |
const -> bool |
|
nodiscardvirtual |
◆ lock_outputs()
virtual auto cbdc::locking_shard::interface::lock_outputs |
( |
std::vector< tx > && | txs, |
|
|
const hash_t & | dtx_id ) -> std::optional< std::vector< bool > > |
|
pure virtual |
Attempts to lock the input hashes for the given vector of transactions.
Only considers input hashes relevant to this shard based on the shard range. The batch of transactions is a single distributed transaction, or 'dtx', referred to by a globally unique dtx ID provided by the caller.
- Parameters
-
txs | list of txs to attempt to lock. |
dtx_id | distributed tx ID for lock operation. |
- Returns
- if lock succeeds, return a vector of flags indicating which txs in the input vector had their relevant input hashes locked by the shard. Otherwise std::nullopt.
Implemented in cbdc::locking_shard::locking_shard, and cbdc::locking_shard::rpc::client.
◆ operator=() [1/2]
auto cbdc::locking_shard::interface::operator= |
( |
const interface & | | ) |
-> interface &=delete |
|
delete |
◆ operator=() [2/2]
◆ stop()
virtual void cbdc::locking_shard::interface::stop |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following files: