This commit is contained in:
Gregory Burd 2024-05-01 15:59:30 -04:00
parent d691b469bf
commit 47197b9491
11 changed files with 106 additions and 1 deletions

1
.gitignore vendored
View file

@ -40,4 +40,5 @@ build/
# other...
.direnv
cmake-*

8
.idea/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
</code_scheme>
</component>

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View file

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

7
.idea/misc.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" />
</component>
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/noidb.iml" filepath="$PROJECT_DIR$/.idea/noidb.iml" />
</modules>
</component>
</project>

2
.idea/noidb.iml Normal file
View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

7
.idea/vcs.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/seastar" vcs="Git" />
</component>
</project>

View file

@ -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)

53
src/database.hh Normal file
View file

@ -0,0 +1,53 @@
#pragma once
#include <seastar/http/httpd.hh>
using namespace seastar;
using namespace httpd;
#include <string>
class Database {
seastar::httpd::http_server_control& srv;
public:
explicit Database(seastar::httpd::http_server_control& srv)
: srv(srv) {}
seastar::future<bool> stop();
};
class GetHandler : public handler_base {
public:
explicit GetHandler(Database& db);
future<std::unique_ptr<http::reply>> handle(const sstring& path, std::unique_ptr<http::request> req, std::unique_ptr<http::reply> rep) override;
private:
Database& db;
};
class PutHandler : public handler_base {
public:
explicit PutHandler(Database& db);
future<std::unique_ptr<http::reply>> handle(const sstring& path, std::unique_ptr<http::request> req, std::unique_ptr<http::reply> rep) override;
private:
Database& db;
};
class DeleteHandler : public handler_base {
public:
explicit DeleteHandler(Database& db);
future<std::unique_ptr<http::reply>> handle(const sstring& path, std::unique_ptr<http::request> req, std::unique_ptr<http::reply> rep) override;
private:
Database& db;
};