6 #ifndef IROHA_PENDING_TXS_STORAGE_IMPL_HPP 7 #define IROHA_PENDING_TXS_STORAGE_IMPL_HPP 14 #include <shared_mutex> 15 #include <unordered_map> 17 #include <boost/bimap.hpp> 18 #include <boost/bimap/unordered_multiset_of.hpp> 19 #include <boost/bimap/unordered_set_of.hpp> 41 const std::optional<shared_model::interface::types::HashType>
42 &first_tx_hash)
const override;
45 std::shared_ptr<ametsuchi::TxPresenceCache> &cache)
override;
54 void removeFromStorage(
const HashType &first_tx_hash,
55 const std::set<AccountIdType> &batch_creators,
62 std::weak_ptr<ametsuchi::TxPresenceCache> presence_cache_;
67 mutable std::shared_timed_mutex mutex_;
83 struct AccountBatches {
84 using BatchPtr = std::shared_ptr<TransactionBatch>;
85 using BatchesBimap = boost::bimap<
86 boost::bimaps::unordered_set_of<
HashType,
88 boost::bimaps::unordered_multiset_of<
93 std::list<BatchPtr> batches;
95 unordered_map<HashType, decltype(batches)::iterator, HashType::Hasher>
97 BatchesBimap txs_to_batches;
99 uint64_t all_transactions_quantity{0};
105 std::unordered_map<AccountIdType, AccountBatches> storage_;
110 #endif // IROHA_PENDING_TXS_STORAGE_IMPL_HPP void insertPresenceCache(std::shared_ptr< ametsuchi::TxPresenceCache > &cache) override
Definition: pending_txs_storage_impl.cpp:150
void removeTransaction(HashType const &hash) override
Definition: pending_txs_storage_impl.cpp:189
crypto::Hash HashType
Type of hash.
Definition: types.hpp:34
shared_model::interface::types::AccountIdType AccountIdType
Definition: pending_txs_storage_impl.hpp:27
Definition: transaction_batch.hpp:64
Definition: result_fwd.hpp:27
shared_model::interface::types::HashType HashType
Definition: pending_txs_storage_impl.hpp:28
shared_model::interface::types::SharedTxsCollectionType SharedTxsCollectionType
Definition: pending_txs_storage_impl.hpp:30
Definition: block_query.hpp:15
Definition: pending_txs_storage_impl.hpp:25
std::string AccountIdType
Type of account id.
Definition: types.hpp:38
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
Definition: transaction_batch.hpp:22
std::shared_ptr< MstState > SharedState
Definition: pending_txs_storage_impl.hpp:32
std::vector< std::shared_ptr< Transaction > > SharedTxsCollectionType
Definition: transaction_sequence_common.hpp:27
void updatedBatchesHandler(const SharedState &updated_batches) override
Definition: pending_txs_storage_impl.cpp:92
uint16_t TransactionsNumberType
Type of a number of transactions in block and query response page.
Definition: types.hpp:86
void removeBatch(const SharedBatch &batch) override
Definition: pending_txs_storage_impl.cpp:181
std::shared_ptr< shared_model::interface::TransactionBatch > BatchPtr
Definition: mst_types.hpp:23
Definition: pending_txs_storage.hpp:23
SharedTxsCollectionType getPendingTransactions(const AccountIdType &account_id) const override
Definition: pending_txs_storage_impl.cpp:15
std::shared_ptr< TransactionBatch > SharedBatch
Definition: pending_txs_storage_impl.hpp:33