@@ -78,6 +78,7 @@ namespace fc::api {
7878 using sector_storage::stores::AcquireMode;
7979 using sector_storage::stores::LocalPath;
8080 using sector_storage::stores::PathType;
81+ using sector_storage::stores::SectorStorageInfo;
8182 using sector_storage::stores::StorageConfig;
8283 using sector_storage::stores::StorageInfo;
8384 using vm::actor::builtin::types::market::DealProposal;
@@ -91,6 +92,8 @@ namespace fc::api {
9192 ModularVerificationParameter;
9293 using vm::runtime::ExecutionResult;
9394 using base64 = cppcodec::base64_rfc4648;
95+ using common::fromString;
96+ using common::toString;
9497
9598 struct Codec {
9699 rapidjson::MemoryPoolAllocator<> &allocator;
@@ -258,19 +261,23 @@ namespace fc::api {
258261 }
259262
260263 ENCODE (PathType) {
261- return encode (common::to_int (v ));
264+ return encode (toString (v). value ( ));
262265 }
263266
264267 DECODE (PathType) {
265- decodeEnum (v, j);
268+ std::string temp;
269+ decode (temp, j);
270+ v = fromString<PathType>(temp).value ();
266271 }
267272
268273 ENCODE (AcquireMode) {
269- return encode (common::to_int (v));
274+ return encode (toString (v));
270275 }
271276
272277 DECODE (AcquireMode) {
273- decodeEnum (v, j);
278+ std::string temp;
279+ decode (temp, j);
280+ v = fromString<AcquireMode>(temp).value ();
274281 }
275282
276283 ENCODE (NetworkVersion) {
@@ -869,7 +876,7 @@ namespace fc::api {
869876 Get (j, " Locked" , v.locked );
870877 }
871878
872- ENCODE (StorageInfo ) {
879+ ENCODE (SectorStorageInfo ) {
873880 Value j{rapidjson::kObjectType };
874881 Set (j, " ID" , v.id );
875882 Set (j, " URLs" , v.urls );
@@ -880,7 +887,7 @@ namespace fc::api {
880887 return j;
881888 }
882889
883- DECODE (StorageInfo ) {
890+ DECODE (SectorStorageInfo ) {
884891 Get (j, " ID" , v.id );
885892 Get (j, " URLs" , v.urls );
886893 Get (j, " Weight" , v.weight );
@@ -889,6 +896,24 @@ namespace fc::api {
889896 Get (j, " Primary" , v.is_primary );
890897 }
891898
899+ ENCODE (StorageInfo) {
900+ Value j{rapidjson::kObjectType };
901+ Set (j, " ID" , v.id );
902+ Set (j, " URLs" , v.urls );
903+ Set (j, " Weight" , v.weight );
904+ Set (j, " CanSeal" , v.can_seal );
905+ Set (j, " CanStore" , v.can_store );
906+ return j;
907+ }
908+
909+ DECODE (StorageInfo) {
910+ Get (j, " ID" , v.id );
911+ Get (j, " URLs" , v.urls );
912+ Get (j, " Weight" , v.weight );
913+ Get (j, " CanSeal" , v.can_seal );
914+ Get (j, " CanStore" , v.can_store );
915+ }
916+
892917 ENCODE (StorageParticipantBalance) {
893918 Value j{rapidjson::kObjectType };
894919 Set (j, " Locked" , v.locked );
@@ -1348,13 +1373,11 @@ namespace fc::api {
13481373 ENCODE (HealthReport) {
13491374 Value j{rapidjson::kObjectType };
13501375 Set (j, " Stat" , v.stat );
1351- Set (j, " Error" , v.error );
13521376 return j;
13531377 }
13541378
13551379 DECODE (HealthReport) {
13561380 decode (v.stat , Get (j, " Stat" ));
1357- decode (v.error , Get (j, " Error" ));
13581381 }
13591382
13601383 ENCODE (libp2p::multi::Multiaddress) {
@@ -2058,13 +2081,15 @@ namespace fc::api {
20582081 Value j{rapidjson::kObjectType };
20592082 Set (j, " Capacity" , v.capacity );
20602083 Set (j, " Available" , v.available );
2084+ Set (j, " FSAvailable" , v.fs_available );
20612085 Set (j, " Reserved" , v.reserved );
20622086 return j;
20632087 }
20642088
20652089 DECODE (FsStat) {
20662090 decode (v.capacity , Get (j, " Capacity" ));
20672091 decode (v.available , Get (j, " Available" ));
2092+ decode (v.fs_available , Get (j, " FSAvailable" ));
20682093 decode (v.reserved , Get (j, " Reserved" ));
20692094 }
20702095
@@ -2084,7 +2109,7 @@ namespace fc::api {
20842109 Value j{rapidjson::kObjectType };
20852110 Set (j, " MemPhysical" , v.physical_memory );
20862111 Set (j, " MemSwap" , v.swap_memory );
2087- Set (j, " MemReserved " , v.reserved_memory );
2112+ Set (j, " MemUsed " , v.reserved_memory );
20882113 Set (j, " CPUs" , v.cpus );
20892114 Set (j, " GPUs" , v.gpus );
20902115 return j;
@@ -2093,7 +2118,7 @@ namespace fc::api {
20932118 DECODE (WorkerResources) {
20942119 Get (j, " MemPhysical" , v.physical_memory );
20952120 Get (j, " MemSwap" , v.swap_memory );
2096- Get (j, " MemReserved " , v.reserved_memory );
2121+ Get (j, " MemUsed " , v.reserved_memory );
20972122 Get (j, " CPUs" , v.cpus );
20982123 Get (j, " GPUs" , v.gpus );
20992124 }
@@ -2189,6 +2214,21 @@ namespace fc::api {
21892214 }
21902215 return j;
21912216 }
2217+ ENCODE (std::set<TaskType>) {
2218+ Value j{rapidjson::kObjectType };
2219+ j.MemberReserve (v.size (), allocator);
2220+ for (auto &pair : v) {
2221+ std::map<std::string, std::string> value;
2222+ Set (j, pair, value);
2223+ }
2224+ return j;
2225+ }
2226+
2227+ DECODE (std::set<TaskType>) {
2228+ for (auto it = j.MemberBegin (); it != j.MemberEnd (); ++it) {
2229+ v.emplace (TaskType (AsString (it->name )));
2230+ }
2231+ }
21922232
21932233 template <typename T>
21942234 DECODE (std::set<T>) {
0 commit comments