blob: e3c6248e6e29f7e9b56211b539f3918ad4070fc6 (
plain) (
blame)
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
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "zenserver.h"
#include <zenhttp/auth/authmgr.h>
#include <zenhttp/auth/authservice.h>
#include <zenhttp/httpapiservice.h>
#include <zenhttp/httptest.h>
#include <zenstore/cache/structuredcachestore.h>
#include <zenstore/gc.h>
#include <zenstore/projectstore.h>
#include "localrefpolicy.h"
#include "admin/admin.h"
#include "buildstore/httpbuildstore.h"
#include "cache/httpstructuredcache.h"
#include "diag/diagsvcs.h"
#include "frontend/frontend.h"
#include "objectstore/objectstore.h"
#include "projectstore/httpprojectstore.h"
#include "sessions/httpsessions.h"
#include "stats/statsreporter.h"
#include "upstream/upstream.h"
#include "vfs/vfsservice.h"
#include "workspaces/httpworkspaces.h"
#include <zenutil/sessionsclient.h>
#if ZEN_WITH_COMPUTE_SERVICES
# include <zencompute/httpcomputeservice.h>
#endif
namespace zen {
class ZenStorageServer : public ZenServerBase
{
ZenStorageServer& operator=(ZenStorageServer&&) = delete;
ZenStorageServer(ZenStorageServer&&) = delete;
public:
ZenStorageServer();
~ZenStorageServer();
int Initialize(const ZenStorageServerConfig& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry);
void Run();
void Cleanup();
private:
void InitializeState(const ZenStorageServerConfig& ServerOptions);
void InitializeStructuredCache(const ZenStorageServerConfig& ServerOptions);
void Flush();
std::string m_StartupScrubOptions;
CbObject m_RootManifest;
asio::steady_timer m_StateMarkerTimer{m_IoContext};
void EnqueueStateMarkerTimer();
void CheckStateMarker();
std::unique_ptr<AuthMgr> m_AuthMgr;
std::unique_ptr<HttpAuthService> m_AuthService;
void InitializeAuthentication(const ZenStorageServerConfig& ServerOptions);
void InitializeServices(const ZenStorageServerConfig& ServerOptions);
void RegisterServices();
std::unique_ptr<DataRootLocalRefPolicy> m_LocalRefPolicy;
std::unique_ptr<JobQueue> m_JobQueue;
GcManager m_GcManager;
GcScheduler m_GcScheduler{m_GcManager};
std::unique_ptr<CidStore> m_CidStore;
Ref<ZenCacheStore> m_CacheStore;
std::unique_ptr<OpenProcessCache> m_OpenProcessCache;
HttpTestService m_TestService;
std::unique_ptr<CidStore> m_BuildCidStore;
std::unique_ptr<BuildStore> m_BuildStore;
#if ZEN_WITH_TESTS
HttpTestingService m_TestingService;
#endif
RefPtr<ProjectStore> m_ProjectStore;
std::unique_ptr<VfsServiceImpl> m_VfsServiceImpl;
std::unique_ptr<HttpProjectService> m_HttpProjectService;
std::unique_ptr<Workspaces> m_Workspaces;
std::unique_ptr<HttpWorkspacesService> m_HttpWorkspacesService;
std::unique_ptr<SessionsService> m_SessionsService;
std::unique_ptr<HttpSessionsService> m_HttpSessionsService;
std::unique_ptr<UpstreamCache> m_UpstreamCache;
std::unique_ptr<HttpUpstreamService> m_UpstreamService;
std::unique_ptr<HttpStructuredCacheService> m_StructuredCacheService;
std::unique_ptr<HttpFrontendService> m_FrontendService;
std::unique_ptr<HttpObjectStoreService> m_ObjStoreService;
std::unique_ptr<HttpBuildStoreService> m_BuildStoreService;
std::unique_ptr<VfsService> m_VfsService;
std::unique_ptr<HttpAdminService> m_AdminService;
std::unique_ptr<HttpApiService> m_ApiService;
std::unique_ptr<SessionsServiceClient> m_SessionsClient;
logging::SinkPtr m_SessionLogSink;
logging::SinkPtr m_InProcSessionLogSink;
asio::steady_timer m_SessionAnnounceTimer{m_IoContext};
void EnqueueSessionAnnounceTimer();
#if ZEN_WITH_COMPUTE_SERVICES
std::unique_ptr<compute::HttpComputeService> m_HttpComputeService;
#endif
};
struct ZenStorageServerConfigurator;
class ZenStorageServerMain : public ZenServerMain
{
public:
ZenStorageServerMain(ZenStorageServerConfig& ServerOptions);
~ZenStorageServerMain();
virtual void DoRun(ZenServerState::ZenServerEntry* Entry) override;
virtual void InitializeLogging() override;
ZenStorageServerMain(const ZenStorageServerMain&) = delete;
ZenStorageServerMain& operator=(const ZenStorageServerMain&) = delete;
typedef ZenStorageServerConfig Config;
typedef ZenStorageServerConfigurator Configurator;
private:
ZenStorageServerConfig& m_ServerOptions;
};
} // namespace zen
|