6 #ifndef KAGOME_BLOCK_TREE_IMPL_HPP 7 #define KAGOME_BLOCK_TREE_IMPL_HPP 14 #include <unordered_set> 47 static outcome::result<std::shared_ptr<BlockTreeImpl>> create(
48 std::shared_ptr<BlockHeaderRepository> header_repo,
49 std::shared_ptr<BlockStorage> storage,
50 std::shared_ptr<network::ExtrinsicObserver> extrinsic_observer,
51 std::shared_ptr<crypto::Hasher> hasher,
54 extrinsic_events_engine,
55 std::shared_ptr<subscription::ExtrinsicEventKeyRepository>
56 extrinsic_event_key_repo,
57 std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker,
58 std::shared_ptr<const class JustificationStoragePolicy>
59 justification_storage_policy);
62 static outcome::result<void> recover(
64 std::shared_ptr<BlockStorage> storage,
65 std::shared_ptr<BlockHeaderRepository> header_repo,
66 std::shared_ptr<const storage::trie::TrieStorage> trie_storage,
67 std::shared_ptr<blockchain::BlockTree> block_tree);
73 outcome::result<bool> hasBlockHeader(
76 outcome::result<primitives::BlockHeader> getBlockHeader(
79 outcome::result<primitives::BlockBody> getBlockBody(
82 outcome::result<primitives::Justification> getBlockJustification(
85 outcome::result<void> addBlockHeader(
90 outcome::result<void> removeLeaf(
93 outcome::result<void> addExistingBlock(
97 outcome::result<void> addBlockBody(
102 outcome::result<void> finalize(
107 uint64_t maximum)
const override;
121 outcome::result<primitives::BlockInfo> getBestContaining(
123 const std::optional<primitives::BlockNumber> &max_number)
126 std::vector<primitives::BlockHash> getLeaves()
const override;
139 std::shared_ptr<BlockHeaderRepository> header_repo,
140 std::shared_ptr<BlockStorage> storage,
141 std::unique_ptr<CachedTree> cached_tree,
142 std::shared_ptr<network::ExtrinsicObserver> extrinsic_observer,
143 std::shared_ptr<crypto::Hasher> hasher,
146 extrinsic_events_engine,
147 std::shared_ptr<subscription::ExtrinsicEventKeyRepository>
148 extrinsic_event_key_repo,
149 std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker,
150 std::shared_ptr<const class JustificationStoragePolicy>
151 justification_storage_policy);
157 outcome::result<primitives::BlockHash> walkBackUntilLess(
164 std::vector<primitives::BlockHash> getLeavesSorted()
const;
166 outcome::result<void> prune(
167 const std::shared_ptr<TreeNode> &lastFinalizedNode);
169 outcome::result<void> reorganize();
181 std::shared_ptr<subscription::ExtrinsicEventKeyRepository>
183 std::shared_ptr<storage::changes_trie::ChangesTracker>
185 std::shared_ptr<const class JustificationStoragePolicy>
201 #endif // KAGOME_BLOCK_TREE_IMPL_HPP
std::shared_ptr< BlockStorage > storage_
std::shared_ptr< TelemetryService > createTelemetryService()
Returns preliminary initialized instance of telemetry service.
std::vector< Extrinsic > BlockBody
Block class represents polkadot block primitive.
primitives::events::ExtrinsicSubscriptionEnginePtr extrinsic_events_engine_
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< const class JustificationStoragePolicy > justification_storage_policy_
std::unique_ptr< Registry > RegistryPtr
RegistryPtr createRegistry()
std::shared_ptr< ChainSubscriptionEngine > ChainSubscriptionEnginePtr
std::shared_ptr< soralog::Logger > Logger
metrics::Gauge * metric_finalized_block_height_
std::unique_ptr< CachedTree > tree_
std::shared_ptr< network::ExtrinsicObserver > extrinsic_observer_
std::shared_ptr< storage::changes_trie::ChangesTracker > trie_changes_tracker_
outcome::result< std::vector< primitives::BlockHash >> BlockHashVecRes
std::optional< primitives::BlockHash > genesis_block_hash_
std::shared_ptr< ExtrinsicSubscriptionEngine > ExtrinsicSubscriptionEnginePtr
metrics::Gauge * metric_best_block_height_
primitives::events::ChainSubscriptionEnginePtr chain_events_engine_
std::shared_ptr< subscription::ExtrinsicEventKeyRepository > extrinsic_event_key_repo_
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
Logger createLogger(const std::string &tag)
std::shared_ptr< TelemetryService > Telemetry
A gauge metric to represent a value that can arbitrarily go up and down.
metrics::Gauge * metric_known_chain_leaves_
std::shared_ptr< BlockHeaderRepository > header_repo_