diff --git a/include/silo/storage/pango_lineage_alias.h b/include/silo/storage/pango_lineage_alias.h index 35cf558cc..4ad6a85df 100644 --- a/include/silo/storage/pango_lineage_alias.h +++ b/include/silo/storage/pango_lineage_alias.h @@ -7,6 +7,9 @@ #include #include +#include +#include + namespace silo { namespace common { @@ -16,7 +19,16 @@ struct RawPangoLineage; } // namespace common class PangoLineageAliasLookup { + friend class boost::serialization::access; + private: + template + [[maybe_unused]] void serialize(Archive& archive, const uint32_t /* version */) { + // clang-format off + archive & alias_key; + // clang-format on + } + std::unordered_map> alias_key; public: diff --git a/src/silo/database.cpp b/src/silo/database.cpp index c74b81d2c..2fe3b42ea 100644 --- a/src/silo/database.cpp +++ b/src/silo/database.cpp @@ -392,6 +392,10 @@ void Database::saveDatabaseState(const std::string& save_directory) { const std::string database_config_filename = save_directory + "database_config.yaml"; database_config.writeConfig(database_config_filename); + std::ofstream alias_key_file(save_directory + "alias_key.silo"); + ::boost::archive::binary_oarchive alias_key_archive(alias_key_file); + alias_key_archive << alias_key; + std::ofstream partitions_file(save_directory + "partitions.silo"); ::boost::archive::binary_oarchive partitions_archive(partitions_file); partitions_archive << partitions; @@ -439,6 +443,10 @@ Database Database::loadDatabaseState(const std::string& save_directory) { database.database_config = silo::config::DatabaseConfigReader().readConfig(database_config_filename); + std::ifstream alias_key_file(save_directory + "alias_key.silo"); + ::boost::archive::binary_iarchive alias_key_archive(alias_key_file); + alias_key_archive >> database.alias_key; + SPDLOG_INFO("Loading partitions from {}", save_directory); std::ifstream partitions_file(save_directory + "partitions.silo");