-
Notifications
You must be signed in to change notification settings - Fork 37
/
application_injector.hpp
174 lines (143 loc) · 4.8 KB
/
application_injector.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/**
* Copyright Quadrivium LLC
* All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <memory>
#include <boost/asio/io_context.hpp>
#include "clock/clock.hpp"
#include "network/dispute_request_observer.hpp"
#include "storage/spaced_storage.hpp"
namespace soralog {
class LoggingSystem;
}
namespace kagome {
namespace application {
class AppConfiguration;
class ChainSpec;
class AppStateManager;
} // namespace application
namespace application::mode {
class PrintChainInfoMode;
class PrecompileWasmMode;
class RecoveryMode;
class BenchmarkMode;
class Key;
} // namespace application::mode
namespace authority_discovery {
class AddressPublisher;
} // namespace authority_discovery
namespace benchmark {
class BlockExecutionBenchmark;
}
namespace dispute {
class DisputeCoordinator;
}
namespace metrics {
class Exposer;
class MetricsWatcher;
} // namespace metrics
namespace network {
class Router;
class PeerManager;
class StateProtocolObserver;
class SyncProtocolObserver;
} // namespace network
namespace parachain {
class ParachainObserver;
class ParachainProcessorImpl;
class ApprovalDistribution;
namespace statement_distribution {
class StatementDistribution;
}
} // namespace parachain
namespace runtime {
class Executor;
}
namespace api {
class ApiService;
}
namespace common {
class MainThreadPool;
}
namespace consensus {
class Timeline;
}
namespace consensus::babe {
class Babe;
}
namespace consensus::grandpa {
class Grandpa;
}
namespace blockchain {
class BlockStorage;
class BlockTree;
} // namespace blockchain
namespace storage::trie {
class TrieStorage;
}
namespace telemetry {
class TelemetryService;
}
namespace key {
class Key;
}
class Watchdog;
} // namespace kagome
namespace kagome::injector {
/**
* Dependency injector for a universal node. Provides all major components
* required by the kagome application.
*/
class KagomeNodeInjector final {
public:
explicit KagomeNodeInjector(
std::shared_ptr<application::AppConfiguration> app_config);
std::shared_ptr<application::AppConfiguration> injectAppConfig();
std::shared_ptr<application::ChainSpec> injectChainSpec();
std::shared_ptr<blockchain::BlockStorage> injectBlockStorage();
std::shared_ptr<application::AppStateManager> injectAppStateManager();
std::shared_ptr<boost::asio::io_context> injectIoContext();
std::shared_ptr<Watchdog> injectWatchdog();
std::shared_ptr<common::MainThreadPool> injectMainThreadPool();
std::shared_ptr<metrics::Exposer> injectOpenMetricsService();
std::shared_ptr<network::Router> injectRouter();
std::shared_ptr<network::PeerManager> injectPeerManager();
std::shared_ptr<api::ApiService> injectRpcApiService();
std::shared_ptr<clock::SystemClock> injectSystemClock();
std::shared_ptr<consensus::Timeline> injectTimeline();
std::shared_ptr<network::SyncProtocolObserver> injectSyncObserver();
std::shared_ptr<network::StateProtocolObserver> injectStateObserver();
std::shared_ptr<parachain::ParachainObserver> injectParachainObserver();
std::shared_ptr<parachain::ParachainProcessorImpl>
injectParachainProcessor();
std::shared_ptr<parachain::statement_distribution::StatementDistribution>
injectStatementDistribution();
std::shared_ptr<parachain::ApprovalDistribution>
injectApprovalDistribution();
std::shared_ptr<network::DisputeRequestObserver>
injectDisputeRequestObserver();
std::shared_ptr<dispute::DisputeCoordinator> injectDisputeCoordinator();
std::shared_ptr<consensus::grandpa::Grandpa> injectGrandpa();
std::shared_ptr<soralog::LoggingSystem> injectLoggingSystem();
std::shared_ptr<storage::trie::TrieStorage> injectTrieStorage();
std::shared_ptr<metrics::MetricsWatcher> injectMetricsWatcher();
std::shared_ptr<telemetry::TelemetryService> injectTelemetryService();
std::shared_ptr<blockchain::BlockTree> injectBlockTree();
std::shared_ptr<runtime::Executor> injectExecutor();
std::shared_ptr<storage::SpacedStorage> injectStorage();
std::shared_ptr<authority_discovery::AddressPublisher>
injectAddressPublisher();
void kademliaRandomWalk();
std::shared_ptr<application::mode::PrintChainInfoMode>
injectPrintChainInfoMode();
std::shared_ptr<application::mode::PrecompileWasmMode>
injectPrecompileWasmMode();
std::shared_ptr<application::mode::RecoveryMode> injectRecoveryMode();
std::shared_ptr<benchmark::BlockExecutionBenchmark> injectBlockBenchmark();
std::shared_ptr<key::Key> injectKey();
protected:
std::shared_ptr<class KagomeNodeInjectorImpl> pimpl_;
};
} // namespace kagome::injector