OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::watchtower::error_cache Class Reference

Stores a set of internal transaction errors in memory, indexed by Tx ID and UHS ID. More...

#include <error_cache.hpp>

Public Member Functions

 error_cache ()=delete
 
 error_cache (size_t k)
 Constructor.
 
void push_errors (std::vector< tx_error > &&errs)
 Moves an error into the error cache, evicting the oldest error if the cache has reached its maximum size.
 
auto check_tx_id (const hash_t &tx_id) const -> std::optional< tx_error >
 Checks the cache for an error associated with the given Tx ID.
 
auto check_uhs_id (const hash_t &uhs_id) const -> std::optional< tx_error >
 Checks the cache for an error associated with the given UHS ID.
 

Detailed Description

Stores a set of internal transaction errors in memory, indexed by Tx ID and UHS ID.

Definition at line 26 of file error_cache.hpp.

Constructor & Destructor Documentation

◆ error_cache() [1/2]

cbdc::watchtower::error_cache::error_cache ( )
delete

◆ error_cache() [2/2]

cbdc::watchtower::error_cache::error_cache ( size_t k)
explicit

Constructor.

Parameters
knumber of errors to store in memory. 0 -> no limit.

Definition at line 11 of file error_cache.cpp.

Member Function Documentation

◆ check_tx_id()

auto cbdc::watchtower::error_cache::check_tx_id ( const hash_t & tx_id) const -> std::optional<tx_error>

Checks the cache for an error associated with the given Tx ID.

Parameters
tx_idthe Tx ID to check.
Returns
error information, or nullopt if not found.

Definition at line 65 of file error_cache.cpp.

◆ check_uhs_id()

auto cbdc::watchtower::error_cache::check_uhs_id ( const hash_t & uhs_id) const -> std::optional<tx_error>

Checks the cache for an error associated with the given UHS ID.

Parameters
uhs_idthe UHS ID to check.
Returns
error information, or nullopt if not found.

Definition at line 74 of file error_cache.cpp.

◆ push_errors()

void cbdc::watchtower::error_cache::push_errors ( std::vector< tx_error > && errs)

Moves an error into the error cache, evicting the oldest error if the cache has reached its maximum size.

Parameters
errsthe error to move.

Definition at line 16 of file error_cache.cpp.

Referenced by cbdc::watchtower::watchtower::add_errors().


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