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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <filesystem>
namespace zen {
/** Scrub storage
*/
class ScrubCommand : public StorageCommand
{
public:
static constexpr char Name[] = "scrub";
static constexpr char Description[] = "Scrub zen storage (verify data integrity)";
ScrubCommand();
~ScrubCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
bool m_DryRun = false;
bool m_NoGc = false;
bool m_NoCas = false;
uint64_t m_MaxTimeSliceSeconds = 300;
};
/** Garbage collect storage
*/
class GcCommand : public StorageCommand
{
public:
static constexpr char Name[] = "gc";
static constexpr char Description[] = "Garbage collect zen storage";
GcCommand();
~GcCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
bool m_SmallObjects{false};
bool m_SkipCid{false};
bool m_SkipDelete{false};
uint64_t m_MaxCacheDuration{0};
uint64_t m_DiskSizeSoftLimit{0};
bool m_ForceUseGCV1{false};
bool m_ForceUseGCV2{false};
uint32_t m_CompactBlockThreshold = 90;
bool m_Verbose{false};
bool m_SingleThreaded{false};
std::string m_ReferenceHashLow;
std::string m_ReferenceHashHigh;
bool m_StoreCacheAttachmentMetaData;
bool m_StoreProjectAttachmentMetaData;
bool m_EnableValidation;
};
class GcStatusCommand : public StorageCommand
{
public:
static constexpr char Name[] = "gc-status";
static constexpr char Description[] = "Garbage collect zen storage status check";
GcStatusCommand();
~GcStatusCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
bool m_Details = false;
};
class GcStopCommand : public StorageCommand
{
public:
static constexpr char Name[] = "gc-stop";
static constexpr char Description[] = "Request cancel of running garbage collection in zen storage";
GcStopCommand();
~GcStopCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
};
////////////////////////////////////////////
class JobCommand : public ZenCmdBase
{
public:
static constexpr char Name[] = "jobs";
static constexpr char Description[] = "Show/cancel zen background jobs";
JobCommand();
~JobCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
std::uint64_t m_JobId = 0;
bool m_Cancel = 0;
};
////////////////////////////////////////////
class LoggingCommand : public ZenCmdBase
{
public:
static constexpr char Name[] = "logs";
static constexpr char Description[] = "Show/control zen logging";
LoggingCommand();
~LoggingCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
std::string m_CacheWriteLog;
std::string m_CacheAccessLog;
std::string m_SetLogLevel;
std::string m_ServerLogTarget;
std::string m_CacheLogTarget;
std::string m_HttpLogTarget;
};
/** Flush storage
*/
class FlushCommand : public StorageCommand
{
public:
static constexpr char Name[] = "flush";
static constexpr char Description[] = "Flush storage";
FlushCommand();
~FlushCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
};
/** Copy state
*/
class CopyStateCommand : public StorageCommand
{
public:
static constexpr char Name[] = "copy-state";
static constexpr char Description[] = "Copy zen server disk state";
CopyStateCommand();
~CopyStateCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::filesystem::path m_DataPath;
std::filesystem::path m_TargetPath;
bool m_SkipLogs = false;
};
} // namespace zen
|