hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
buffered_cleanup_strategy.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BUFFERED_CLEANUP_STRATEGY_HPP
7 #define IROHA_BUFFERED_CLEANUP_STRATEGY_HPP
8 
10 
11 #include <boost/optional.hpp>
12 #include <queue>
13 
15 
16 namespace iroha {
17  namespace consensus {
18  namespace yac {
20  public:
21  using RoundType = Round;
22 
30  boost::optional<CleanupStrategy::RoundsType> finalize(
31  RoundType consensus_round, Answer answer) override;
32 
33  bool shouldCreateRound(const RoundType &round) override;
34 
35  private:
41  RoundsType truncateCreatedRounds();
42 
47  boost::optional<RoundType> minimalRound() const;
48 
53  void createRound(const Round &round);
54 
60  bool isRequiredCreation(const Round &round) const;
61 
63  std::priority_queue<RoundType,
64  std::vector<RoundType>,
65  std::greater<RoundType>>
66  created_rounds_;
67 
69  boost::optional<RoundType> last_reject_round_;
71  boost::optional<RoundType> last_commit_round_;
72  };
73  } // namespace yac
74  } // namespace consensus
75 } // namespace iroha
76 
77 #endif // IROHA_BUFFERED_CLEANUP_STRATEGY_HPP
boost::variant< CommitMessage, RejectMessage > Answer
Definition: storage_result.hpp:21
Round RoundType
Definition: buffered_cleanup_strategy.hpp:21
Definition: block_query.hpp:14
Definition: cleanup_strategy.hpp:19
bool shouldCreateRound(const RoundType &round) override
Definition: buffered_cleanup_strategy.cpp:70
std::vector< Round > RoundsType
Definition: cleanup_strategy.hpp:24
Definition: buffered_cleanup_strategy.hpp:19
Definition: round.hpp:31
boost::optional< CleanupStrategy::RoundsType > finalize(RoundType consensus_round, Answer answer) override
Definition: buffered_cleanup_strategy.cpp:13