Kagome
Polkadot Runtime Engine in C++17
consistency_keeper_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CONSENSUS_BABE_CONSISTENCYKEEPERIMPL
7 #define KAGOME_CONSENSUS_BABE_CONSISTENCYKEEPERIMPL
8 
10 
11 #include <memory>
12 
14 #include "log/logger.hpp"
16 
17 namespace kagome::application {
18  class AppStateManager;
19 };
20 
21 namespace kagome::blockchain {
22  class DigestTracker;
23 };
24 
25 namespace kagome::consensus::babe {
26 
28  public:
30  std::shared_ptr<application::AppStateManager> app_state_manager,
31  std::shared_ptr<storage::BufferStorage> storage,
32  std::shared_ptr<blockchain::BlockTree> block_tree,
33  std::shared_ptr<blockchain::DigestTracker> digest_tracker);
34 
35  ~ConsistencyKeeperImpl() override = default;
36 
37  Guard start(primitives::BlockInfo block) override;
38 
39  protected:
40  void commit(primitives::BlockInfo block) override;
41  void rollback(primitives::BlockInfo block) override;
42 
43  private:
44  bool prepare();
45  void cleanup();
46 
47  std::shared_ptr<application::AppStateManager> app_state_manager_;
48  std::shared_ptr<storage::BufferStorage> storage_;
49  std::shared_ptr<blockchain::BlockTree> block_tree_;
50  std::shared_ptr<blockchain::DigestTracker> digest_tracker_;
51 
53  std::atomic_bool in_progress_{false};
54  };
55 
56 } // namespace kagome::consensus::babe
57 
58 #endif // KAGOME_CONSENSUS_BABE_CONSISTENCYKEEPERIMPL
std::shared_ptr< application::AppStateManager > app_state_manager_
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
std::shared_ptr< blockchain::BlockTree > block_tree_
std::shared_ptr< storage::BufferStorage > storage_
std::shared_ptr< blockchain::DigestTracker > digest_tracker_