mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-08-22 16:00:50 +00:00
Rename namespace dinbpostgres to dindb.
It's so much better!
This commit is contained in:
parent
45fc758915
commit
1fd51f75ba
20 changed files with 64 additions and 64 deletions
|
@ -68,7 +68,7 @@ namespace din {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
ListDirContent::ListDirContent (dinbpostgres::DBSource* parDB) :
|
||||
ListDirContent::ListDirContent (dindb::DBSource* parDB) :
|
||||
m_cache(g_max_cached_lists),
|
||||
m_db(parDB)
|
||||
{
|
||||
|
@ -86,13 +86,13 @@ namespace din {
|
|||
//Requested item is not cached, so we need to query the db now
|
||||
if (parDir.points_to_group()) {
|
||||
auto sets_ids = m_db->sets();
|
||||
auto sets_info = m_db->set_details<dinbpostgres::SetDetail_ID, dinbpostgres::SetDetail_Desc, dinbpostgres::SetDetail_CreeationDate>(sets_ids);
|
||||
auto sets_info = m_db->set_details<dindb::SetDetail_ID, dindb::SetDetail_Desc, dindb::SetDetail_CreeationDate>(sets_ids);
|
||||
m_cache.push_back(std::make_pair(curr_path, db_result_to_vec(sets_info)));
|
||||
}
|
||||
else {
|
||||
auto path_prefix = parDir.file_path();
|
||||
const auto set_id = parDir.group_id();
|
||||
auto files_info = m_db->file_details<dinbpostgres::FileDetail_Path>(set_id, parDir.level() + 1, path_prefix);
|
||||
auto files_info = m_db->file_details<dindb::FileDetail_Path>(set_id, parDir.level() + 1, path_prefix);
|
||||
m_cache.push_back(std::make_pair(curr_path, db_result_to_vec(files_info)));
|
||||
}
|
||||
return last_cached_item(curr_path);
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace dinbpostgres {
|
||||
namespace dindb {
|
||||
class DBSource;
|
||||
} //namespace dinbpostgres
|
||||
} //namespace dindb
|
||||
|
||||
namespace din {
|
||||
class EntryPath;
|
||||
|
@ -34,7 +34,7 @@ namespace din {
|
|||
using ListType = std::vector<std::string>;
|
||||
using CachedItemType = std::pair<std::string, ListType>;
|
||||
public:
|
||||
explicit ListDirContent ( dinbpostgres::DBSource* parDB );
|
||||
explicit ListDirContent ( dindb::DBSource* parDB );
|
||||
~ListDirContent ( void ) noexcept = default;
|
||||
|
||||
const ListType& ls ( const EntryPath& parDir ) const;
|
||||
|
@ -44,7 +44,7 @@ namespace din {
|
|||
const ListType& last_cached_item ( const std::string& parCurrPath ) const;
|
||||
|
||||
mutable boost::circular_buffer<CachedItemType> m_cache;
|
||||
dinbpostgres::DBSource* m_db;
|
||||
dindb::DBSource* m_db;
|
||||
};
|
||||
} //namespace din
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <boost/range/algorithm/copy.hpp>
|
||||
|
||||
namespace {
|
||||
void do_navigation ( dinbpostgres::DBSource& parDB );
|
||||
void do_navigation ( dindb::DBSource& parDB );
|
||||
|
||||
bool on_exit ( void );
|
||||
void on_pwd ( const din::EntryPath& parDirMan );
|
||||
|
@ -61,7 +61,7 @@ int main (int parArgc, char* parArgv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
dinbpostgres::DBSource db_source(settings.db);
|
||||
dindb::DBSource db_source(settings.db);
|
||||
|
||||
do_navigation(db_source);
|
||||
return 0;
|
||||
|
@ -81,7 +81,7 @@ namespace {
|
|||
boost::copy(ls_result, std::ostream_iterator<std::string>(std::cout, "\n"));
|
||||
}
|
||||
|
||||
void do_navigation (dinbpostgres::DBSource& parDB) {
|
||||
void do_navigation (dindb::DBSource& parDB) {
|
||||
const std::string prompt;
|
||||
din::ListDirContent ls(&parDB);
|
||||
din::LineReader lines(&ls);
|
||||
|
@ -92,7 +92,7 @@ namespace {
|
|||
din::EntryPath dir_man;
|
||||
proc.add_command("exit", &on_exit, 0);
|
||||
proc.add_command("cd", std::function<void(const std::string&)>(std::bind(&din::EntryPath::push_piece, &dir_man, std::placeholders::_1)), 1);
|
||||
proc.add_command("disconnect", std::function<void()>(std::bind(&dinbpostgres::DBSource::disconnect, &parDB)), 0);
|
||||
proc.add_command("disconnect", std::function<void()>(std::bind(&dindb::DBSource::disconnect, &parDB)), 0);
|
||||
proc.add_command("pwd", std::function<void()>(std::bind(&on_pwd, std::ref(dir_man))), 0);
|
||||
proc.add_command("ls", std::function<void()>(std::bind(on_ls, std::ref(ls), std::ref(dir_man))), 0);
|
||||
do {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue