Skip to content

Commit

Permalink
bugfix: pango alias was not saved by database
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed Jul 24, 2023
1 parent 3e848a5 commit 33e925c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/silo/storage/pango_lineage_alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <unordered_set>
#include <vector>

#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>

namespace silo {

namespace common {
Expand All @@ -16,7 +19,16 @@ struct RawPangoLineage;
} // namespace common

class PangoLineageAliasLookup {
friend class boost::serialization::access;

private:
template <class Archive>
[[maybe_unused]] void serialize(Archive& archive, const uint32_t /* version */) {
// clang-format off
archive & alias_key;
// clang-format on
}

std::unordered_map<std::string, std::vector<std::string>> alias_key;

public:
Expand Down
8 changes: 8 additions & 0 deletions src/silo/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 33e925c

Please sign in to comment.