noidb/src/database.hh

54 lines
1.1 KiB
C++
Raw Normal View History

2024-05-01 19:59:30 +00:00
#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;
};