9 using data_handler_function = std::function<std::tuple<fc::variant, std::optional<fc::variant>>(
const std::variant<action_trace_v0, action_trace_v1> & action_trace_t,
const yield_function&)>;
18 template<
typename LogfileProv
ider,
typename DataHandlerProv
ider>
22 :logfile_provider(
std::move(logfile_provider))
23 ,data_handler_provider(
std::move(data_handler_provider))
26 _log(
"Constructed request_handler");
41 auto data = logfile_provider.get_block(block_height, yield);
43 _log(
"No block found at block height " + std::to_string(block_height) );
50 return std::visit([&](
const auto& action_trace_t) {
51 return data_handler_provider.serialize_to_variant(action_trace_t, yield);
71 _log(
"get_transaction_trace called" );
75 if (!resp.is_null()) {
76 auto& b_mvo = resp.get_object();
77 if (b_mvo.contains(
"transactions")) {
78 auto& transactions = b_mvo[
"transactions"];
79 std::string input_id = trxid.
str();
80 for (
uint32_t i = 0; i < transactions.size(); ++i) {
81 if (transactions[i].is_null())
continue;
82 auto& t_mvo = transactions[i].get_object();
83 if (t_mvo.contains(
"id")) {
84 const auto& t_id = t_mvo[
"id"].get_string();
85 if (t_id == input_id) {
86 result = transactions[i];
91 if( result.is_null() )
92 _log(
"Exhausted all " + std::to_string(transactions.size()) +
" transactions in block " + b_mvo[
"number"].as_string() +
" without finding trxid " + trxid.
str());
99 LogfileProvider logfile_provider;
100 DataHandlerProvider data_handler_provider;
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
request_handler(LogfileProvider &&logfile_provider, DataHandlerProvider &&data_handler_provider, log_handler log)
fc::variant get_block_trace(uint32_t block_height, const yield_function &yield={})
fc::variant get_transaction_trace(chain::transaction_id_type trxid, uint32_t block_height, const yield_function &yield={})
fc::optional_delegate< void()> yield_function
std::variant< block_trace_v0, block_trace_v1, block_trace_v2 > data_log_entry
fc::optional_delegate< void(const std::string &)> log_handler
std::function< std::tuple< fc::variant, std::optional< fc::variant > >(const std::variant< action_trace_v0, action_trace_v1 > &action_trace_t, const yield_function &)> data_handler_function