forked from ydb-platform/nbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.h
105 lines (80 loc) · 3.02 KB
/
bootstrap.h
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
#pragma once
#include "private.h"
#include <cloud/blockstore/libs/common/public.h>
#include <cloud/blockstore/libs/diagnostics/public.h>
#include <cloud/blockstore/libs/kikimr/public.h>
#include <cloud/blockstore/libs/nvme/public.h>
#include <cloud/blockstore/libs/rdma/iface/public.h>
#include <cloud/blockstore/libs/service/public.h>
#include <cloud/blockstore/libs/service_local/public.h>
#include <cloud/blockstore/libs/spdk/iface/public.h>
#include <cloud/blockstore/libs/storage/disk_agent/public.h>
#include <cloud/storage/core/libs/http/simple_http_server.h>
#include <contrib/ydb/core/driver_lib/run/factories.h>
#include <contrib/ydb/library/actors/util/should_continue.h>
#include <library/cpp/logger/log.h>
namespace NCloud::NBlockStore::NServer {
////////////////////////////////////////////////////////////////////////////////
struct TConfigInitializer;
////////////////////////////////////////////////////////////////////////////////
struct TSpdkParts
{
NSpdk::ISpdkEnvPtr Env;
std::function<void(TLog& log)> LogInitializer;
};
struct TServerModuleFactories
{
std::function<TSpdkParts(NSpdk::TSpdkEnvConfigPtr config)> SpdkFactory;
std::function<NRdma::IServerPtr(
ILoggingServicePtr logging,
IMonitoringServicePtr monitoring,
NRdma::TServerConfigPtr config)> RdmaServerFactory;
};
////////////////////////////////////////////////////////////////////////////////
class TBootstrap
{
private:
std::shared_ptr<NKikimr::TModuleFactories> ModuleFactories;
std::shared_ptr<TServerModuleFactories> ServerModuleFactories;
std::unique_ptr<TConfigInitializer> Configs;
ILoggingServicePtr BootstrapLogging;
TLog Log;
ITimerPtr Timer;
ISchedulerPtr Scheduler;
IActorSystemPtr ActorSystem;
ILoggingServicePtr Logging;
IAsyncLoggerPtr AsyncLogger;
IMonitoringServicePtr Monitoring;
TVector<ITraceReaderPtr> TraceReaders;
ITraceProcessorPtr TraceProcessor;
IProfileLogPtr ProfileLog;
IBlockDigestGeneratorPtr BlockDigestGenerator;
IFileIOServiceProviderPtr FileIOServiceProvider;
NSpdk::ISpdkEnvPtr Spdk;
std::function<void(TLog& log)> SpdkLogInitializer;
ICachingAllocatorPtr Allocator;
IStorageProviderPtr AioStorageProvider;
NNvme::INvmeManagerPtr NvmeManager;
NRdma::IServerPtr RdmaServer;
TProgramShouldContinue ShouldContinue;
TVector<TString> PostponedCriticalEvents;
std::unique_ptr<NCloud::NStorage::TSimpleHttpServer> StubMonPageServer;
bool Initialized = false;
public:
TBootstrap(
std::shared_ptr<NKikimr::TModuleFactories> moduleFactories,
std::shared_ptr<TServerModuleFactories> serverModuleFactories);
~TBootstrap();
void ParseOptions(int argc, char** argv);
void Init();
void Start();
void Stop();
TProgramShouldContinue& GetShouldContinue();
private:
void InitLWTrace();
void InitProfileLog();
bool InitKikimrService();
void InitHTTPServer();
void InitRdmaServer(NRdma::TRdmaConfig& config);
};
} // namespace NCloud::NBlockStore::NServer