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
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <filesystem>
namespace zen {
/** Scrub storage
*/
class ScrubCommand : public StorageCommand
{
public:
ScrubCommand();
~ScrubCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"scrub", "Scrub zen storage"};
std::string m_HostName;
bool m_DryRun = false;
bool m_NoGc = false;
bool m_NoCas = false;
};
/** Garbage collect storage
*/
class GcCommand : public StorageCommand
{
public:
GcCommand();
~GcCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"gc", "Garbage collect zen storage"};
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;
};
class GcStatusCommand : public StorageCommand
{
public:
GcStatusCommand();
~GcStatusCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"gc-status", "Garbage collect zen storage status check"};
std::string m_HostName;
bool m_Details = false;
};
class GcStopCommand : public StorageCommand
{
public:
GcStopCommand();
~GcStopCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"gc-stop", "Request cancel of running garbage collection in zen storage"};
std::string m_HostName;
};
////////////////////////////////////////////
class JobCommand : public ZenCmdBase
{
public:
JobCommand();
~JobCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"jobs", "Show/cancel zen background jobs"};
std::string m_HostName;
std::uint64_t m_JobId = 0;
bool m_Cancel = 0;
};
////////////////////////////////////////////
class LoggingCommand : public ZenCmdBase
{
public:
LoggingCommand();
~LoggingCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"logs", "Show/control zen logging"};
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:
FlushCommand();
~FlushCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"flush", "Flush zen storage"};
std::string m_HostName;
};
/** Copy state
*/
class CopyStateCommand : public StorageCommand
{
public:
CopyStateCommand();
~CopyStateCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{"copy-state", "Copy zen server disk state"};
std::filesystem::path m_DataPath;
std::filesystem::path m_TargetPath;
bool m_SkipLogs;
};
} // namespace zen
|