Added flag for optional import of database.

This commit is contained in:
Kruno Tomola Fabro 2016-09-13 12:21:07 +01:00
parent 10e69cd3db
commit 6e4096d619
3 changed files with 8 additions and 5 deletions

View File

@ -20,8 +20,8 @@ class Db
public: public:
using sptr = std::shared_ptr<Db>; using sptr = std::shared_ptr<Db>;
Db(); Db(bool import_snapshot = true);
Db(const std::string &name); Db(const std::string &name, bool import_snapshot = true);
Db(const Db &db) = delete; Db(const Db &db) = delete;
private: private:

View File

@ -226,7 +226,7 @@ int main(int argc, char **argv)
auto para = all_arguments(argc, argv); auto para = all_arguments(argc, argv);
Db db; Db db(false);
auto loaded = import_csv_from_arguments(db, para); auto loaded = import_csv_from_arguments(db, para);
add_scores(db); add_scores(db);

View File

@ -4,9 +4,12 @@
#include "storage/indexes/indexes.hpp" #include "storage/indexes/indexes.hpp"
#include "storage/model/properties/property_family.hpp" #include "storage/model/properties/property_family.hpp"
Db::Db() : Db("default") {} Db::Db(bool import_snapshot) : Db("default", import_snapshot) {}
Db::Db(const std::string &name) : name_(name) { snap_engine.import(); } Db::Db(const std::string &name, bool import_snapshot) : name_(name)
{
if (import_snapshot) snap_engine.import();
}
Indexes Db::indexes() { return Indexes(*this); } Indexes Db::indexes() { return Indexes(*this); }