Kagome
Polkadot Runtime Engine in C++17
authority_manager.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_AUTHORITY_MANAGER
7 #define KAGOME_AUTHORITY_MANAGER
8 
9 #include <boost/optional.hpp>
10 
11 #include "common/tagged.hpp"
12 #include "primitives/authority.hpp"
14 
15 namespace kagome::storage::trie {
16  class TrieStorage;
17  class TrieBatch;
18 }
19 
20 namespace kagome::crypto {
21  class Hasher;
22 }
23 
24 namespace kagome::authority {
25 
27 
29  public:
30  virtual ~AuthorityManager() = default;
31 
38  virtual outcome::result<void> recalculateStoredState(
39  primitives::BlockNumber last_finalized_number) = 0;
40 
44  virtual primitives::BlockInfo base() const = 0;
45 
53  virtual std::optional<std::shared_ptr<const primitives::AuthoritySet>>
54  authorities(const primitives::BlockInfo &block,
55  IsBlockFinalized finalized) const = 0;
56 
65  virtual outcome::result<void> applyScheduledChange(
66  const primitives::BlockInfo &block,
67  const primitives::AuthorityList &authorities,
68  primitives::BlockNumber activate_at) = 0;
69 
80  virtual outcome::result<void> applyForcedChange(
81  const primitives::BlockInfo &block,
82  const primitives::AuthorityList &authorities,
83  primitives::BlockNumber delay_start,
84  size_t delay) = 0;
85 
99  virtual outcome::result<void> applyOnDisabled(
100  const primitives::BlockInfo &block, uint64_t authority_index) = 0;
101 
109  virtual outcome::result<void> applyPause(
110  const primitives::BlockInfo &block,
111  primitives::BlockNumber activate_at) = 0;
112 
121  virtual outcome::result<void> applyResume(
122  const primitives::BlockInfo &block,
123  primitives::BlockNumber activate_at) = 0;
124 
129  virtual void prune(const primitives::BlockInfo &block) = 0;
130  };
131 } // namespace kagome::authority
132 
133 #endif // KAGOME_AUTHORITY_MANAGER
uint32_t BlockNumber
Definition: common.hpp:18