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 };
142 
143 enum class LBARelativePerformanceType{
144     Invalid,
145     Best,
146     Better,
147     Good,
148     Degraded,
149 };
150 
151 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeType, {
152     {InitializeType::Invalid, "Invalid"},
153     {InitializeType::Fast, "Fast"},
154     {InitializeType::Slow, "Slow"},
155 });
156 
157 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeMethod, {
158     {InitializeMethod::Invalid, "Invalid"},
159     {InitializeMethod::Skip, "Skip"},
160     {InitializeMethod::Background, "Background"},
161     {InitializeMethod::Foreground, "Foreground"},
162 });
163 
164 NLOHMANN_JSON_SERIALIZE_ENUM(RAIDType, {
165     {RAIDType::Invalid, "Invalid"},
166     {RAIDType::RAID0, "RAID0"},
167     {RAIDType::RAID1, "RAID1"},
168     {RAIDType::RAID3, "RAID3"},
169     {RAIDType::RAID4, "RAID4"},
170     {RAIDType::RAID5, "RAID5"},
171     {RAIDType::RAID6, "RAID6"},
172     {RAIDType::RAID10, "RAID10"},
173     {RAIDType::RAID01, "RAID01"},
174     {RAIDType::RAID6TP, "RAID6TP"},
175     {RAIDType::RAID1E, "RAID1E"},
176     {RAIDType::RAID50, "RAID50"},
177     {RAIDType::RAID60, "RAID60"},
178     {RAIDType::RAID00, "RAID00"},
179     {RAIDType::RAID10E, "RAID10E"},
180     {RAIDType::RAID1Triple, "RAID1Triple"},
181     {RAIDType::RAID10Triple, "RAID10Triple"},
182     {RAIDType::None, "None"},
183 });
184 
185 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeType, {
186     {VolumeType::Invalid, "Invalid"},
187     {VolumeType::RawDevice, "RawDevice"},
188     {VolumeType::NonRedundant, "NonRedundant"},
189     {VolumeType::Mirrored, "Mirrored"},
190     {VolumeType::StripedWithParity, "StripedWithParity"},
191     {VolumeType::SpannedMirrors, "SpannedMirrors"},
192     {VolumeType::SpannedStripesWithParity, "SpannedStripesWithParity"},
193 });
194 
195 NLOHMANN_JSON_SERIALIZE_ENUM(EncryptionTypes, {
196     {EncryptionTypes::Invalid, "Invalid"},
197     {EncryptionTypes::NativeDriveEncryption, "NativeDriveEncryption"},
198     {EncryptionTypes::ControllerAssisted, "ControllerAssisted"},
199     {EncryptionTypes::SoftwareAssisted, "SoftwareAssisted"},
200 });
201 
202 NLOHMANN_JSON_SERIALIZE_ENUM(WriteHoleProtectionPolicyType, {
203     {WriteHoleProtectionPolicyType::Invalid, "Invalid"},
204     {WriteHoleProtectionPolicyType::Off, "Off"},
205     {WriteHoleProtectionPolicyType::Journaling, "Journaling"},
206     {WriteHoleProtectionPolicyType::DistributedLog, "DistributedLog"},
207     {WriteHoleProtectionPolicyType::Oem, "Oem"},
208 });
209 
210 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeUsageType, {
211     {VolumeUsageType::Invalid, "Invalid"},
212     {VolumeUsageType::Data, "Data"},
213     {VolumeUsageType::SystemData, "SystemData"},
214     {VolumeUsageType::CacheOnly, "CacheOnly"},
215     {VolumeUsageType::SystemReserve, "SystemReserve"},
216     {VolumeUsageType::ReplicationReserve, "ReplicationReserve"},
217 });
218 
219 NLOHMANN_JSON_SERIALIZE_ENUM(ReadCachePolicyType, {
220     {ReadCachePolicyType::Invalid, "Invalid"},
221     {ReadCachePolicyType::ReadAhead, "ReadAhead"},
222     {ReadCachePolicyType::AdaptiveReadAhead, "AdaptiveReadAhead"},
223     {ReadCachePolicyType::Off, "Off"},
224 });
225 
226 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCachePolicyType, {
227     {WriteCachePolicyType::Invalid, "Invalid"},
228     {WriteCachePolicyType::WriteThrough, "WriteThrough"},
229     {WriteCachePolicyType::ProtectedWriteBack, "ProtectedWriteBack"},
230     {WriteCachePolicyType::UnprotectedWriteBack, "UnprotectedWriteBack"},
231     {WriteCachePolicyType::Off, "Off"},
232 });
233 
234 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCacheStateType, {
235     {WriteCacheStateType::Invalid, "Invalid"},
236     {WriteCacheStateType::Unprotected, "Unprotected"},
237     {WriteCacheStateType::Protected, "Protected"},
238     {WriteCacheStateType::Degraded, "Degraded"},
239 });
240 
241 NLOHMANN_JSON_SERIALIZE_ENUM(LBAFormatType, {
242     {LBAFormatType::Invalid, "Invalid"},
243     {LBAFormatType::LBAFormat0, "LBAFormat0"},
244     {LBAFormatType::LBAFormat1, "LBAFormat1"},
245     {LBAFormatType::LBAFormat2, "LBAFormat2"},
246     {LBAFormatType::LBAFormat3, "LBAFormat3"},
247     {LBAFormatType::LBAFormat4, "LBAFormat4"},
248     {LBAFormatType::LBAFormat5, "LBAFormat5"},
249     {LBAFormatType::LBAFormat6, "LBAFormat6"},
250     {LBAFormatType::LBAFormat7, "LBAFormat7"},
251     {LBAFormatType::LBAFormat8, "LBAFormat8"},
252     {LBAFormatType::LBAFormat9, "LBAFormat9"},
253     {LBAFormatType::LBAFormat10, "LBAFormat10"},
254     {LBAFormatType::LBAFormat11, "LBAFormat11"},
255     {LBAFormatType::LBAFormat12, "LBAFormat12"},
256     {LBAFormatType::LBAFormat13, "LBAFormat13"},
257     {LBAFormatType::LBAFormat14, "LBAFormat14"},
258     {LBAFormatType::LBAFormat15, "LBAFormat15"},
259 });
260 
261 NLOHMANN_JSON_SERIALIZE_ENUM(NamespaceType, {
262     {NamespaceType::Invalid, "Invalid"},
263     {NamespaceType::Block, "Block"},
264     {NamespaceType::KeyValue, "KeyValue"},
265     {NamespaceType::ZNS, "ZNS"},
266     {NamespaceType::Computational, "Computational"},
267 });
268 
269 NLOHMANN_JSON_SERIALIZE_ENUM(OperationType, {
270     {OperationType::Invalid, "Invalid"},
271     {OperationType::Deduplicate, "Deduplicate"},
272     {OperationType::CheckConsistency, "CheckConsistency"},
273     {OperationType::Initialize, "Initialize"},
274     {OperationType::Replicate, "Replicate"},
275     {OperationType::Delete, "Delete"},
276     {OperationType::ChangeRAIDType, "ChangeRAIDType"},
277     {OperationType::Rebuild, "Rebuild"},
278     {OperationType::Encrypt, "Encrypt"},
279     {OperationType::Decrypt, "Decrypt"},
280     {OperationType::Resize, "Resize"},
281     {OperationType::Compress, "Compress"},
282     {OperationType::Sanitize, "Sanitize"},
283     {OperationType::Format, "Format"},
284 });
285 
286 NLOHMANN_JSON_SERIALIZE_ENUM(LBARelativePerformanceType, {
287     {LBARelativePerformanceType::Invalid, "Invalid"},
288     {LBARelativePerformanceType::Best, "Best"},
289     {LBARelativePerformanceType::Better, "Better"},
290     {LBARelativePerformanceType::Good, "Good"},
291     {LBARelativePerformanceType::Degraded, "Degraded"},
292 });
293 
294 }
295 // clang-format on
296