6 #ifndef IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP 7 #define IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP 13 #include <shared_mutex> 24 class TxPresenceCache;
30 std::optional<std::shared_ptr<
47 size_t transaction_limit,
48 std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
50 std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache,
52 size_t number_of_proposals = 3);
58 std::optional<std::shared_ptr<const ProposalType>> onRequestProposal(
64 removeFromBatchesCache(hashes);
74 std::optional<std::shared_ptr<shared_model::interface::Proposal>>
77 using TransactionsCollectionType =
78 std::vector<std::shared_ptr<shared_model::interface::Transaction>>;
80 std::optional<std::shared_ptr<shared_model::interface::Proposal>>
83 const TransactionsCollectionType &txs,
96 bool batchAlreadyProcessed(
99 bool insertBatchToCache(
100 std::shared_ptr<shared_model::interface::TransactionBatch>
const 103 void removeFromBatchesCache(
106 bool isEmptyBatchesCache()
const override;
108 void forCachedBatches(
109 std::function<
void(
const BatchesSetType &)>
const &f)
const override;
111 std::vector<std::shared_ptr<shared_model::interface::Transaction>>
112 getTransactionsFromBatchesCache(
size_t requested_tx_amount);
119 size_t transaction_limit_;
124 size_t number_of_proposals_;
134 mutable std::mutex proposals_mutex_;
136 mutable std::shared_timed_mutex batches_cache_cs_;
139 std::shared_ptr<shared_model::interface::UnsafeProposalFactory>
145 std::shared_ptr<ametsuchi::TxPresenceCache> tx_cache_;
160 #endif // IROHA_ON_DEMAND_ORDERING_SERVICE_IMPL_HPP Definition: block_query.hpp:17
void onTxsCommitted(const HashesSetType &hashes) override
Definition: on_demand_ordering_service_impl.hpp:63
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_ordering_service.hpp:60
Definition: on_demand_ordering_service.hpp:28
Definition: proposal.hpp:17
std::unordered_set< shared_model::crypto::Hash, shared_model::crypto::Hash::Hasher > HashesSetType
Definition: on_demand_ordering_service.hpp:73
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: on_demand_ordering_service_impl.hpp:34
Definition: block_query.hpp:15
std::unordered_set< std::shared_ptr< shared_model::interface::TransactionBatch >, BatchPointerHasher, shared_model::interface::BatchHashEquality > BatchesSetType
Definition: on_demand_ordering_service.hpp:49
Definition: transaction_batch.hpp:22
std::map< consensus::Round, std::optional< std::shared_ptr< const OnDemandOrderingService::ProposalType > >> ProposalMapType
Definition: on_demand_ordering_service_impl.hpp:31
uint64_t TimestampType
Type of timestamp.
Definition: types.hpp:69