upd: ready to write the database and engine
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
#include "bs-utility.h"
|
||||
|
||||
namespace BookStore_ZYM {
|
||||
std::mutex debug_Print_Mutex;
|
||||
bool shut_down = false;
|
||||
} // namespace BookStore_ZYM
|
||||
|
||||
BlockingStringStream &BlockingStringStream::getline(std::string &str,
|
||||
char delim) {
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
@ -43,10 +48,7 @@ void ReadWriteLock::endWrite() {
|
||||
is_writing = false;
|
||||
cv.notify_all(); // 唤醒所有等待的读操作和写操作
|
||||
}
|
||||
namespace BookStore_ZYM {
|
||||
std::mutex debug_Print_Mutex;
|
||||
bool shut_down = false;
|
||||
} // namespace BookStore_ZYM
|
||||
|
||||
void debugPrint() {
|
||||
BookStore_ZYM::debug_Print_Mutex.lock();
|
||||
std::cerr << std::endl;
|
||||
|
@ -22,7 +22,7 @@ void BookStoreMain(bool is_server, std::string config_dir) {
|
||||
if (BookStore_ZYM::shut_down) return;
|
||||
}
|
||||
} else {
|
||||
throw FatalError("Not implemented yet", 1);
|
||||
throw FatalError("Server mode has not been implemented yet", 1);
|
||||
std::unordered_map<std::string, SessionClass> session_map;
|
||||
}
|
||||
}
|
6
backend/src/database.cpp
Normal file
6
backend/src/database.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "database.h"
|
||||
|
||||
void UserDataBase::Open(std::string file_name) {
|
||||
full_user_data.OpenFile(file_name + ".full");
|
||||
user_name2index.OpenFile(file_name + ".n2i");
|
||||
}
|
@ -4,6 +4,11 @@
|
||||
#include <string>
|
||||
|
||||
#include "bs-utility.h"
|
||||
|
||||
BookStoreEngineClass::BookStoreEngineClass(std::string __config_dir) {
|
||||
config_dir = __config_dir;
|
||||
user_data_base.Open(config_dir + "user");
|
||||
}
|
||||
std::vector<std::string> BookStoreEngineClass::Execute(
|
||||
const std::string &cmd, std::stack<std::string> &login_stack) {
|
||||
if (cmd == "quit" || cmd == "exit") {
|
||||
|
Reference in New Issue
Block a user