hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
tx_presence_cache_utils.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TX_PRESENCE_CACHE_UTILS_HPP
7 #define IROHA_TX_PRESENCE_CACHE_UTILS_HPP
8 
10 #include "common/visitor.hpp"
11 
12 namespace iroha {
13  namespace ametsuchi {
19  inline bool isAlreadyProcessed(
20  const TxCacheStatusType &tx_status) noexcept {
21  return std::visit(
22  make_visitor(
24  return false;
25  },
26  [](const auto &) { return true; }),
27  tx_status);
28  }
29 
36  const TxCacheStatusType &status) noexcept {
37  return std::visit(
38  make_visitor([](const auto &status) { return status.hash; }), status);
39  }
40  } // namespace ametsuchi
41 } // namespace iroha
42 
43 #endif // IROHA_TX_PRESENCE_CACHE_HPP
Definition: hash.hpp:18
std::variant< tx_cache_status_responses::Committed, tx_cache_status_responses::Rejected, tx_cache_status_responses::Missing > TxCacheStatusType
Sum type of all possible concrete responses from the tx cache.
Definition: tx_cache_response.hpp:63
Definition: block_query.hpp:15
bool isAlreadyProcessed(const TxCacheStatusType &tx_status) noexcept
Definition: tx_presence_cache_utils.hpp:19
Definition: tx_cache_response.hpp:55
tx_cache_response_details::HashType getHash(const TxCacheStatusType &status) noexcept
Definition: tx_presence_cache_utils.hpp:35