1 #pragma once
2 #include <nlohmann/json.hpp>
3 
4 namespace volume
5 {
6 // clang-format off
7 
8 enum class InitializeType{
9     Invalid,
10     Fast,
11     Slow,
12 };
13 
14 enum class InitializeMethod{
15     Invalid,
16     Skip,
17     Background,
18     Foreground,
19 };
20 
21 enum class RAIDType{
22     Invalid,
23     RAID0,
24     RAID1,
25     RAID3,
26     RAID4,
27     RAID5,
28     RAID6,
29     RAID10,
30     RAID01,
31     RAID6TP,
32     RAID1E,
33     RAID50,
34     RAID60,
35     RAID00,
36     RAID10E,
37     RAID1Triple,
38     RAID10Triple,
39     None,
40 };
41 
42 enum class VolumeType{
43     Invalid,
44     RawDevice,
45     NonRedundant,
46     Mirrored,
47     StripedWithParity,
48     SpannedMirrors,
49     SpannedStripesWithParity,
50 };
51 
52 enum class EncryptionTypes{
53     Invalid,
54     NativeDriveEncryption,
55     ControllerAssisted,
56     SoftwareAssisted,
57 };
58 
59 enum class WriteHoleProtectionPolicyType{
60     Invalid,
61     Off,
62     Journaling,
63     DistributedLog,
64     Oem,
65 };
66 
67 enum class VolumeUsageType{
68     Invalid,
69     Data,
70     SystemData,
71     CacheOnly,
72     SystemReserve,
73     ReplicationReserve,
74 };
75 
76 enum class ReadCachePolicyType{
77     Invalid,
78     ReadAhead,
79     AdaptiveReadAhead,
80     Off,
81 };
82 
83 enum class WriteCachePolicyType{
84     Invalid,
85     WriteThrough,
86     ProtectedWriteBack,
87     UnprotectedWriteBack,
88     Off,
89 };
90 
91 enum class WriteCacheStateType{
92     Invalid,
93     Unprotected,
94     Protected,
95     Degraded,
96 };
97 
98 enum class LBAFormatType{
99     Invalid,
100     LBAFormat0,
101     LBAFormat1,
102     LBAFormat2,
103     LBAFormat3,
104     LBAFormat4,
105     LBAFormat5,
106     LBAFormat6,
107     LBAFormat7,
108     LBAFormat8,
109     LBAFormat9,
110     LBAFormat10,
111     LBAFormat11,
112     LBAFormat12,
113     LBAFormat13,
114     LBAFormat14,
115     LBAFormat15,
116 };
117 
118 enum class NamespaceType{
119     Invalid,
120     Block,
121     KeyValue,
122     ZNS,
123     Computational,
124 };
125 
126 enum class OperationType{
127     Invalid,
128     Deduplicate,
129     CheckConsistency,
130     Initialize,
131     Replicate,
132     Delete,
133     ChangeRAIDType,
134     Rebuild,
135     Encrypt,
136     Decrypt,
137     Resize,
138     Compress,
139     Sanitize,
140     Format,
141     ChangeStripSize,
142 };
143 
144 enum class LBARelativePerformanceType{
145     Invalid,
146     Best,
147     Better,
148     Good,
149     Degraded,
150 };
151 
152 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeType, {
153     {InitializeType::Invalid, "Invalid"},
154     {InitializeType::Fast, "Fast"},
155     {InitializeType::Slow, "Slow"},
156 });
157 
158 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeMethod, {
159     {InitializeMethod::Invalid, "Invalid"},
160     {InitializeMethod::Skip, "Skip"},
161     {InitializeMethod::Background, "Background"},
162     {InitializeMethod::Foreground, "Foreground"},
163 });
164 
165 NLOHMANN_JSON_SERIALIZE_ENUM(RAIDType, {
166     {RAIDType::Invalid, "Invalid"},
167     {RAIDType::RAID0, "RAID0"},
168     {RAIDType::RAID1, "RAID1"},
169     {RAIDType::RAID3, "RAID3"},
170     {RAIDType::RAID4, "RAID4"},
171     {RAIDType::RAID5, "RAID5"},
172     {RAIDType::RAID6, "RAID6"},
173     {RAIDType::RAID10, "RAID10"},
174     {RAIDType::RAID01, "RAID01"},
175     {RAIDType::RAID6TP, "RAID6TP"},
176     {RAIDType::RAID1E, "RAID1E"},
177     {RAIDType::RAID50, "RAID50"},
178     {RAIDType::RAID60, "RAID60"},
179     {RAIDType::RAID00, "RAID00"},
180     {RAIDType::RAID10E, "RAID10E"},
181     {RAIDType::RAID1Triple, "RAID1Triple"},
182     {RAIDType::RAID10Triple, "RAID10Triple"},
183     {RAIDType::None, "None"},
184 });
185 
186 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeType, {
187     {VolumeType::Invalid, "Invalid"},
188     {VolumeType::RawDevice, "RawDevice"},
189     {VolumeType::NonRedundant, "NonRedundant"},
190     {VolumeType::Mirrored, "Mirrored"},
191     {VolumeType::StripedWithParity, "StripedWithParity"},
192     {VolumeType::SpannedMirrors, "SpannedMirrors"},
193     {VolumeType::SpannedStripesWithParity, "SpannedStripesWithParity"},
194 });
195 
196 NLOHMANN_JSON_SERIALIZE_ENUM(EncryptionTypes, {
197     {EncryptionTypes::Invalid, "Invalid"},
198     {EncryptionTypes::NativeDriveEncryption, "NativeDriveEncryption"},
199     {EncryptionTypes::ControllerAssisted, "ControllerAssisted"},
200     {EncryptionTypes::SoftwareAssisted, "SoftwareAssisted"},
201 });
202 
203 NLOHMANN_JSON_SERIALIZE_ENUM(WriteHoleProtectionPolicyType, {
204     {WriteHoleProtectionPolicyType::Invalid, "Invalid"},
205     {WriteHoleProtectionPolicyType::Off, "Off"},
206     {WriteHoleProtectionPolicyType::Journaling, "Journaling"},
207     {WriteHoleProtectionPolicyType::DistributedLog, "DistributedLog"},
208     {WriteHoleProtectionPolicyType::Oem, "Oem"},
209 });
210 
211 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeUsageType, {
212     {VolumeUsageType::Invalid, "Invalid"},
213     {VolumeUsageType::Data, "Data"},
214     {VolumeUsageType::SystemData, "SystemData"},
215     {VolumeUsageType::CacheOnly, "CacheOnly"},
216     {VolumeUsageType::SystemReserve, "SystemReserve"},
217     {VolumeUsageType::ReplicationReserve, "ReplicationReserve"},
218 });
219 
220 NLOHMANN_JSON_SERIALIZE_ENUM(ReadCachePolicyType, {
221     {ReadCachePolicyType::Invalid, "Invalid"},
222     {ReadCachePolicyType::ReadAhead, "ReadAhead"},
223     {ReadCachePolicyType::AdaptiveReadAhead, "AdaptiveReadAhead"},
224     {ReadCachePolicyType::Off, "Off"},
225 });
226 
227 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCachePolicyType, {
228     {WriteCachePolicyType::Invalid, "Invalid"},
229     {WriteCachePolicyType::WriteThrough, "WriteThrough"},
230     {WriteCachePolicyType::ProtectedWriteBack, "ProtectedWriteBack"},
231     {WriteCachePolicyType::UnprotectedWriteBack, "UnprotectedWriteBack"},
232     {WriteCachePolicyType::Off, "Off"},
233 });
234 
235 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCacheStateType, {
236     {WriteCacheStateType::Invalid, "Invalid"},
237     {WriteCacheStateType::Unprotected, "Unprotected"},
238     {WriteCacheStateType::Protected, "Protected"},
239     {WriteCacheStateType::Degraded, "Degraded"},
240 });
241 
242 NLOHMANN_JSON_SERIALIZE_ENUM(LBAFormatType, {
243     {LBAFormatType::Invalid, "Invalid"},
244     {LBAFormatType::LBAFormat0, "LBAFormat0"},
245     {LBAFormatType::LBAFormat1, "LBAFormat1"},
246     {LBAFormatType::LBAFormat2, "LBAFormat2"},
247     {LBAFormatType::LBAFormat3, "LBAFormat3"},
248     {LBAFormatType::LBAFormat4, "LBAFormat4"},
249     {LBAFormatType::LBAFormat5, "LBAFormat5"},
250     {LBAFormatType::LBAFormat6, "LBAFormat6"},
251     {LBAFormatType::LBAFormat7, "LBAFormat7"},
252     {LBAFormatType::LBAFormat8, "LBAFormat8"},
253     {LBAFormatType::LBAFormat9, "LBAFormat9"},
254     {LBAFormatType::LBAFormat10, "LBAFormat10"},
255     {LBAFormatType::LBAFormat11, "LBAFormat11"},
256     {LBAFormatType::LBAFormat12, "LBAFormat12"},
257     {LBAFormatType::LBAFormat13, "LBAFormat13"},
258     {LBAFormatType::LBAFormat14, "LBAFormat14"},
259     {LBAFormatType::LBAFormat15, "LBAFormat15"},
260 });
261 
262 NLOHMANN_JSON_SERIALIZE_ENUM(NamespaceType, {
263     {NamespaceType::Invalid, "Invalid"},
264     {NamespaceType::Block, "Block"},
265     {NamespaceType::KeyValue, "KeyValue"},
266     {NamespaceType::ZNS, "ZNS"},
267     {NamespaceType::Computational, "Computational"},
268 });
269 
270 NLOHMANN_JSON_SERIALIZE_ENUM(OperationType, {
271     {OperationType::Invalid, "Invalid"},
272     {OperationType::Deduplicate, "Deduplicate"},
273     {OperationType::CheckConsistency, "CheckConsistency"},
274     {OperationType::Initialize, "Initialize"},
275     {OperationType::Replicate, "Replicate"},
276     {OperationType::Delete, "Delete"},
277     {OperationType::ChangeRAIDType, "ChangeRAIDType"},
278     {OperationType::Rebuild, "Rebuild"},
279     {OperationType::Encrypt, "Encrypt"},
280     {OperationType::Decrypt, "Decrypt"},
281     {OperationType::Resize, "Resize"},
282     {OperationType::Compress, "Compress"},
283     {OperationType::Sanitize, "Sanitize"},
284     {OperationType::Format, "Format"},
285     {OperationType::ChangeStripSize, "ChangeStripSize"},
286 });
287 
288 NLOHMANN_JSON_SERIALIZE_ENUM(LBARelativePerformanceType, {
289     {LBARelativePerformanceType::Invalid, "Invalid"},
290     {LBARelativePerformanceType::Best, "Best"},
291     {LBARelativePerformanceType::Better, "Better"},
292     {LBARelativePerformanceType::Good, "Good"},
293     {LBARelativePerformanceType::Degraded, "Degraded"},
294 });
295 
296 }
297 // clang-format on
298