import os and zstdfile2 bugfixes

This commit is contained in:
Green Sky 2024-04-13 21:06:51 +02:00
parent 7b4af58544
commit de3b8f059e
No known key found for this signature in database
2 changed files with 17 additions and 15 deletions

@ -1 +1 @@
Subproject commit 4d3ffb8192623740f6e170855ee1cffd428b78da Subproject commit 46955795b034ed4b058958bba620bd8965ce91f7

View File

@ -93,6 +93,20 @@ int main(int argc, const char** argv) {
} }
} }
// WARNING: manual and hardcoded
// manually upconvert message json to msgpack (v1 to v2)
if (true && e.e.get<ObjComp::MessagesVersion>().v == 1) {
// TODO: error handling
const auto j = nlohmann::json::parse(tmp_buffer);
if (false) {
e.e.replace<ObjComp::MessagesVersion>(uint16_t(2));
// overwrite og
tmp_buffer = nlohmann::json::to_msgpack(j);
}
}
// we dont copy meta file type, it will be the same for all "new" objects // we dont copy meta file type, it will be the same for all "new" objects
auto oh = _fsb_dst.newObject(ByteSpan{e.e.get<ObjComp::ID>().v}); auto oh = _fsb_dst.newObject(ByteSpan{e.e.get<ObjComp::ID>().v});
@ -121,22 +135,10 @@ int main(int argc, const char** argv) {
} }
} }
// WARNING: manual and hardcoded
// manually upconvert message json to msgpack (v1 to v2)
if (true && oh.get<ObjComp::MessagesVersion>().v == 1) {
// TODO: error handling
const auto j = nlohmann::json::parse(tmp_buffer);
if (false) {
oh.replace<ObjComp::MessagesVersion>(uint16_t(2));
// overwrite og
tmp_buffer = nlohmann::json::to_msgpack(j);
}
}
static_cast<StorageBackendI&>(_fsb_dst).write(oh, ByteSpan{tmp_buffer}); static_cast<StorageBackendI&>(_fsb_dst).write(oh, ByteSpan{tmp_buffer});
//assert(std::filesystem::file_size(e.e.get<ObjComp::Ephemeral::FilePath>().path) == std::filesystem::file_size(oh.get<ObjComp::Ephemeral::FilePath>().path));
return false; return false;
} }