Wire Sysio Wire Sysion 1.0.0
|
#include <trx_retry_db.hpp>
Public Member Functions | |
trx_retry_db (const chain::controller &controller, size_t max_mem_usage_size, fc::microseconds retry_interval, fc::microseconds max_expiration_time, fc::microseconds abi_serializer_max_time) | |
~trx_retry_db () | |
trx_retry_db (trx_retry_db &&)=delete | |
trx_retry_db & | operator= (trx_retry_db &&)=delete |
fc::time_point_sec | get_max_expiration_time () const |
size_t | size () const |
void | track_transaction (chain::packed_transaction_ptr ptrx, std::optional< uint16_t > num_blocks, next_function< std::unique_ptr< fc::variant > > next) |
void | on_applied_transaction (const chain::transaction_trace_ptr &trace, const chain::packed_transaction_ptr &ptrx) |
void | on_block_start (uint32_t block_num) |
void | on_accepted_block (const chain::block_state_ptr &block) |
void | on_irreversible_block (const chain::block_state_ptr &block) |
This class manages the ephemeral indices and data that provide the transaction retry feature. It is designed to be run on an API node, as it only tracks incoming API transactions. It will not work correctly on a BP node because on_applied_transaction looks for transactions registered in track_transaction which is registered after speculatively executed. If the transaction is only executed only in a final signed block, then it will not be seen as executed and will expire.
Definition at line 19 of file trx_retry_db.hpp.
|
explicit |
chain | - controller to read data from, caller is expected to manage lifetimes such that this controller reference does not go stale for the life of this class. |
max_mem_usage_size | - maximum allowed memory for this feature, see track_transaction. |
retry_interval | - how often to retry transaction if not see in a block. |
max_expiration_time | - the maximum allowed expiration on a retry transaction |
abi_serializer_max_time | - the configurable abi-serializer-max-time-ms option used for creating trace variants |
Definition at line 292 of file trx_retry_db.cpp.
|
default |
|
delete |
fc::time_point_sec sysio::chain_apis::trx_retry_db::get_max_expiration_time | ( | ) | const |
Definition at line 305 of file trx_retry_db.cpp.
void sysio::chain_apis::trx_retry_db::on_accepted_block | ( | const chain::block_state_ptr & | block | ) |
Attach to chain accepted_block signal
Definition at line 326 of file trx_retry_db.cpp.
void sysio::chain_apis::trx_retry_db::on_applied_transaction | ( | const chain::transaction_trace_ptr & | trace, |
const chain::packed_transaction_ptr & | ptrx ) |
Attach to chain applied_transaction signal Add a transaction trace to the DB that has been applied to the controller
Definition at line 314 of file trx_retry_db.cpp.
void sysio::chain_apis::trx_retry_db::on_block_start | ( | uint32_t | block_num | ) |
Attach to chain block_start signal
Definition at line 320 of file trx_retry_db.cpp.
void sysio::chain_apis::trx_retry_db::on_irreversible_block | ( | const chain::block_state_ptr & | block | ) |
Attach to chain irreversible_block signal
Definition at line 332 of file trx_retry_db.cpp.
|
delete |
size_t sysio::chain_apis::trx_retry_db::size | ( | ) | const |
Definition at line 310 of file trx_retry_db.cpp.
void sysio::chain_apis::trx_retry_db::track_transaction | ( | chain::packed_transaction_ptr | ptrx, |
std::optional< uint16_t > | num_blocks, | ||
next_function< std::unique_ptr< fc::variant > > | next ) |
ptrx | trx to retry if not see in a block for retry_interval |
num_blocks | ack seen in a block after num_blocks have been accepted, LIB if optional !has_value() |
next | report result to user by calling next |
throw | tx_resource_exhaustion if trx would exceeds max_mem_usage_size |
Definition at line 301 of file trx_retry_db.cpp.