mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-08-14 14:49:48 +00:00
Rename settings stuff as it got moved to commonlib.
This commit is contained in:
parent
6e7176be10
commit
74afa9f502
7 changed files with 32 additions and 27 deletions
|
@ -46,7 +46,7 @@ namespace din {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
bool read_from_db (FileRecordData& parItem, SetRecordDataFull& parSet, const DinDBSettings& parDB, std::string&& parHash) {
|
||||
bool read_from_db (FileRecordData& parItem, SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, std::string&& parHash) {
|
||||
using boost::lexical_cast;
|
||||
|
||||
pq::Connection conn(std::string(parDB.username), std::string(parDB.password), std::string(parDB.dbname), std::string(parDB.address), parDB.port);
|
||||
|
@ -93,7 +93,7 @@ namespace din {
|
|||
return true;
|
||||
}
|
||||
|
||||
void write_to_db (const DinDBSettings& parDB, const std::vector<FileRecordData>& parData, const SetRecordData& parSetData) {
|
||||
void write_to_db (const dinlib::SettingsDB& parDB, const std::vector<FileRecordData>& parData, const SetRecordData& parSetData) {
|
||||
auto bool_to_str = [](bool b) { return (b ? "true" : "false"); };
|
||||
if (parData.empty()) {
|
||||
return;
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include <boost/utility/string_ref.hpp>
|
||||
#include <ctime>
|
||||
|
||||
namespace din {
|
||||
struct DinDBSettings;
|
||||
namespace dinlib {
|
||||
struct SettingsDB;;
|
||||
} //namespace dinlib
|
||||
|
||||
namespace din {
|
||||
struct FileRecordData {
|
||||
std::string path;
|
||||
std::string hash;
|
||||
|
@ -51,8 +53,8 @@ namespace din {
|
|||
const char type;
|
||||
};
|
||||
|
||||
void write_to_db ( const DinDBSettings& parDB, const std::vector<FileRecordData>& parData, const SetRecordData& parSetData );
|
||||
bool read_from_db ( FileRecordData& parItem, SetRecordDataFull& parSet, const DinDBSettings& parDB, std::string&& parHash );
|
||||
void write_to_db ( const dinlib::SettingsDB& parDB, const std::vector<FileRecordData>& parData, const SetRecordData& parSetData );
|
||||
bool read_from_db ( FileRecordData& parItem, SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, std::string&& parHash );
|
||||
} //namespace din
|
||||
|
||||
#endif
|
||||
|
|
|
@ -184,7 +184,7 @@ namespace din {
|
|||
struct Indexer::LocalData {
|
||||
typedef std::vector<FileEntry> PathList;
|
||||
|
||||
DinDBSettings db_settings;
|
||||
dinlib::SettingsDB db_settings;
|
||||
PathList paths;
|
||||
#if defined(WITH_PROGRESS_FEEDBACK)
|
||||
std::atomic<std::size_t> done_count;
|
||||
|
@ -212,7 +212,7 @@ namespace din {
|
|||
;
|
||||
}
|
||||
|
||||
Indexer::Indexer (const DinDBSettings& parDBSettings) :
|
||||
Indexer::Indexer (const dinlib::Settings& parSettings) :
|
||||
m_local_data(new LocalData)
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
|
@ -232,7 +232,7 @@ namespace din {
|
|||
m_local_data->processing_index = 0;
|
||||
#endif
|
||||
m_local_data->file_count = 0;
|
||||
m_local_data->db_settings = parDBSettings;
|
||||
m_local_data->db_settings = parSettings.db;
|
||||
}
|
||||
|
||||
Indexer::~Indexer() noexcept {
|
||||
|
|
|
@ -35,12 +35,14 @@ namespace fastf {
|
|||
struct FileStats;
|
||||
} //namespace fastf
|
||||
|
||||
namespace din {
|
||||
struct DinDBSettings;
|
||||
namespace dinlib {
|
||||
struct Settings;
|
||||
} //namespace dinlib
|
||||
|
||||
namespace din {
|
||||
class Indexer {
|
||||
public:
|
||||
explicit Indexer ( const DinDBSettings& parDBSettings );
|
||||
explicit Indexer ( const dinlib::Settings& parSettings );
|
||||
Indexer ( Indexer&& ) = default;
|
||||
Indexer ( const Indexer& ) = delete;
|
||||
~Indexer ( void ) noexcept;
|
||||
|
|
|
@ -64,9 +64,9 @@ int main (int parArgc, char* parArgv[]) {
|
|||
const bool verbose = false;
|
||||
#endif
|
||||
|
||||
din::DinDBSettings settings;
|
||||
dinlib::Settings settings;
|
||||
{
|
||||
const bool loaded = din::load_settings(expand(CONFIG_FILE_PATH), settings);
|
||||
const bool loaded = dinlib::load_settings(expand(CONFIG_FILE_PATH), settings);
|
||||
if (not loaded) {
|
||||
std::cerr << "Can't load settings from " << CONFIG_FILE_PATH << ", quitting\n";
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue