Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain_apis::trx_retry_db Class Reference

#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_dboperator= (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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ trx_retry_db() [1/2]

sysio::chain_apis::trx_retry_db::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 )
explicit
Parameters
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.

295:_impl(std::make_unique<trx_retry_db_impl>(controller, max_mem_usage_size, retry_interval, max_expiration_time, abi_serializer_max_time))
296{
297}
const fc::microseconds abi_serializer_max_time
Definition main.cpp:173

◆ ~trx_retry_db()

sysio::chain_apis::trx_retry_db::~trx_retry_db ( )
default

◆ trx_retry_db() [2/2]

sysio::chain_apis::trx_retry_db::trx_retry_db ( trx_retry_db && )
delete

Member Function Documentation

◆ get_max_expiration_time()

fc::time_point_sec sysio::chain_apis::trx_retry_db::get_max_expiration_time ( ) const
Returns
current max expiration allowed on a retry transaction

Definition at line 305 of file trx_retry_db.cpp.

305 {
306 // conversion from time_point to time_point_sec rounds down, round up to nearest second to avoid appearing expired
307 return fc::time_point::now() + _impl->get_max_expiration() + fc::microseconds(999'999);
308}
static time_point now()
Definition time.cpp:14
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_accepted_block()

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.

326 {
327 try {
328 _impl->on_accepted_block(block);
329 } FC_LOG_AND_DROP(("trx retry accepted_block ERROR"));
330}
#define FC_LOG_AND_DROP(...)
Here is the caller graph for this function:

◆ on_applied_transaction()

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.

314 {
315 try {
316 _impl->on_applied_transaction(trace, ptrx);
317 } FC_LOG_AND_DROP(("trx retry on_applied_transaction ERROR"));
318}
Here is the caller graph for this function:

◆ on_block_start()

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.

320 {
321 try {
322 _impl->on_block_start(block_num);
323 } FC_LOG_AND_DROP(("trx retry block_start ERROR"));
324}
Here is the caller graph for this function:

◆ on_irreversible_block()

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.

332 {
333 try {
334 _impl->on_irreversible_block(block);
335 } FC_LOG_AND_DROP(("trx retry irreversible_block ERROR"));
336}
Here is the caller graph for this function:

◆ operator=()

trx_retry_db & sysio::chain_apis::trx_retry_db::operator= ( trx_retry_db && )
delete

◆ size()

size_t sysio::chain_apis::trx_retry_db::size ( ) const
Returns
number of trxs being tracked

Definition at line 310 of file trx_retry_db.cpp.

310 {
311 return _impl->size();
312}
Here is the caller graph for this function:

◆ track_transaction()

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 )
Parameters
ptrxtrx to retry if not see in a block for retry_interval
num_blocksack seen in a block after num_blocks have been accepted, LIB if optional !has_value()
nextreport result to user by calling next
Exceptions
throwtx_resource_exhaustion if trx would exceeds max_mem_usage_size

Definition at line 301 of file trx_retry_db.cpp.

301 {
302 _impl->track_transaction( std::move( ptrx ), num_blocks, next );
303}
Here is the caller graph for this function:

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