6 #ifndef IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP 7 #define IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP 11 #include <boost/range/adaptor/filtered.hpp> 12 #include <boost/range/adaptor/indirected.hpp> 15 #include <shared_mutex> 17 #include <tbb/concurrent_unordered_set.h> 28 class TxPresenceCache;
39 boost::optional<std::shared_ptr<
57 size_t transaction_limit,
58 std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
60 std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache,
61 std::shared_ptr<ProposalCreationStrategy> proposal_creation_strategy,
63 size_t number_of_proposals = 3);
70 removeFromBatchesCache(hashes);
77 boost::optional<std::shared_ptr<const ProposalType>> onRequestProposal(
85 boost::optional<std::shared_ptr<shared_model::interface::Proposal>>
89 std::shared_ptr<const OnDemandOrderingServiceImpl::ProposalType>>
92 using TransactionsCollectionType =
93 std::vector<std::shared_ptr<shared_model::interface::Transaction>>;
95 boost::optional<std::shared_ptr<shared_model::interface::Proposal>>
98 const TransactionsCollectionType &txs,
111 bool batchAlreadyProcessed(
114 void insertBatchToCache(
115 std::shared_ptr<shared_model::interface::TransactionBatch>
const 118 void removeFromBatchesCache(
121 bool isEmptyBatchesCache()
const;
123 void forCachedBatches(
125 &)>
const &f)
override;
127 std::vector<std::shared_ptr<shared_model::interface::Transaction>>
128 getTransactionsFromBatchesCache(
size_t requested_tx_amount);
133 size_t transaction_limit_;
138 size_t number_of_proposals_;
148 std::mutex proposals_mutex_;
150 mutable std::shared_timed_mutex batches_cache_cs_;
153 std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
159 std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache_;
164 std::shared_ptr<ProposalCreationStrategy> proposal_creation_strategy_;
179 #endif // IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP std::unordered_set< std::shared_ptr< shared_model::interface::TransactionBatch >, BatchPointerHasher, shared_model::interface::BatchHashEquality > BatchesSetType
Definition: on_demand_os_transport.hpp:54
void onTxsCommitted(const HashesSetType &hashes) override
Definition: on_demand_ordering_service_impl.hpp:69
Definition: transaction_batch.hpp:64
transport::OdOsNotification::TransactionBatchType TransactionBatchType
Definition: on_demand_ordering_service_impl.cpp:27
Definition: on_demand_ordering_service.hpp:17
Definition: proposal.hpp:17
std::unordered_set< shared_model::crypto::Hash, shared_model::crypto::Hash::Hasher > HashesSetType
Definition: on_demand_ordering_service.hpp:21
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: on_demand_ordering_service_impl.hpp:43
Definition: block_query.hpp:15
std::map< consensus::Round, boost::optional< std::shared_ptr< const transport::OdOsNotification::ProposalType > >> ProposalMapType
Definition: on_demand_ordering_service_impl.hpp:40
tbb::concurrent_unordered_set< transport::OdOsNotification::TransactionBatchType, model::PointerBatchHasher, shared_model::interface::BatchHashEquality > BatchSetType
Definition: on_demand_ordering_service_impl.hpp:35
Definition: transaction_batch.hpp:22
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_os_transport.hpp:65
uint64_t TimestampType
Type of timestamp.
Definition: types.hpp:67