diff --git a/.gitignore b/.gitignore index adb818a..8c4a9db 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ build/ # other... .direnv +cmake-* diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..f603881 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9c69411 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0b76fe5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..76b3db1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/noidb.iml b/.idea/noidb.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/noidb.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..b393dbe --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57ffead..cc0071f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(noidb) -target_sources(noidb PRIVATE noidb.cc database.cc api_handler.cc) +target_sources(noidb PRIVATE noidb.cc database.cc) target_link_libraries(noidb PRIVATE Seastar::seastar) diff --git a/src/database.hh b/src/database.hh new file mode 100644 index 0000000..1005feb --- /dev/null +++ b/src/database.hh @@ -0,0 +1,53 @@ +#pragma once + +#include + +using namespace seastar; +using namespace httpd; + + +#include +class Database { + + seastar::httpd::http_server_control& srv; + +public: + explicit Database(seastar::httpd::http_server_control& srv) + : srv(srv) {} + + seastar::future stop(); +}; + +class GetHandler : public handler_base { +public: + + explicit GetHandler(Database& db); + + future> handle(const sstring& path, std::unique_ptr req, std::unique_ptr rep) override; + +private: + Database& db; +}; + +class PutHandler : public handler_base { +public: + + explicit PutHandler(Database& db); + + future> handle(const sstring& path, std::unique_ptr req, std::unique_ptr rep) override; + +private: + Database& db; +}; + +class DeleteHandler : public handler_base { +public: + + explicit DeleteHandler(Database& db); + + future> handle(const sstring& path, std::unique_ptr req, std::unique_ptr rep) override; + +private: + Database& db; +}; +