2020-03-12 13:21:22 +03:00
|
|
|
// Copyright (c) 2014-2020 Zano Project
|
2019-08-31 14:48:02 +02:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-03-13 03:47:44 +03:00
|
|
|
#include <boost/program_options.hpp>
|
2020-03-12 14:29:52 +03:00
|
|
|
#include "misc_language.h"
|
2020-03-12 13:21:22 +03:00
|
|
|
#include "db_backend_base.h"
|
2019-08-31 14:48:02 +02:00
|
|
|
|
|
|
|
|
namespace tools
|
|
|
|
|
{
|
|
|
|
|
namespace db
|
|
|
|
|
{
|
2020-03-12 13:21:22 +03:00
|
|
|
enum db_engine_type { db_none = 0, db_lmdb, db_mdbx };
|
|
|
|
|
|
|
|
|
|
class db_backend_selector
|
2019-10-25 00:13:38 +02:00
|
|
|
{
|
2020-03-12 13:21:22 +03:00
|
|
|
public:
|
|
|
|
|
db_backend_selector();
|
2019-11-14 05:54:52 +03:00
|
|
|
|
2020-03-12 13:21:22 +03:00
|
|
|
static void init_options(boost::program_options::options_description& desc);
|
|
|
|
|
bool init(const boost::program_options::variables_map& vm);
|
|
|
|
|
|
|
|
|
|
std::string get_db_folder_path() const;
|
|
|
|
|
std::string get_db_main_file_name() const;
|
|
|
|
|
db_engine_type get_engine_type() const { return m_engine_type; }
|
|
|
|
|
std::string get_engine_name() const;
|
|
|
|
|
std::string get_config_folder() const { return m_config_folder; }
|
2020-03-12 18:07:31 +03:00
|
|
|
std::string get_temp_config_folder() const;
|
|
|
|
|
std::string get_temp_db_folder_path() const;
|
|
|
|
|
|
|
|
|
|
std::string get_pool_db_folder_path() const;
|
|
|
|
|
|
2020-03-12 13:21:22 +03:00
|
|
|
std::shared_ptr<tools::db::i_db_backend> create_backend();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
db_engine_type m_engine_type;
|
|
|
|
|
std::string m_config_folder;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace db
|
|
|
|
|
} // namespace tools
|