This commit is contained in:
Gregory Burd 2024-05-01 19:44:44 -04:00
parent 2d69c24ac4
commit 558ff4d606
2 changed files with 30 additions and 8 deletions

View file

@ -1,15 +1,36 @@
#include "database.hh"
seastar::future<bool> Database::stop() { return seastar::make_ready_future<bool>(true); }
#include "noidb.hh"
future<sstring> Database::get(const sstring& key) { co_return key; }
seastar::future<bool> Database::stop() {
lg.info("Stopping the database.");
co_return true;
}
future<bool> Database::put(const sstring& key, sstring& val) { co_return true; }
future<sstring> Database::get(const sstring& key) {
lg.info("get: {}", key);
co_return key;
}
future<bool> Database::post(const sstring& key, input_stream<char>* val) { co_return true; }
future<bool> Database::put(const sstring& key, sstring& val) {
lg.info("put: {} -> {}", key, val);
co_return true;
}
future<bool> Database::del(const sstring& key) { co_return true; }
future<bool> Database::post(const sstring& key, input_stream<char>* stream) {
sstring val;
while (auto buf = co_await stream->read()) {
val.append(buf.get(), buf.size());
}
lg.info("post: {} -> {}", key, val);
co_return true;
}
future<bool> Database::del(const sstring& key) {
lg.info("del: {}", key);
co_return true;
}
GetHandler::GetHandler(Database& db)
: db(db) {}

View file

@ -1,4 +1,6 @@
#include "noidb.hh"
#include "database.hh"
#include <seastar/apps/lib/stop_signal.hh>
@ -8,17 +10,16 @@
#include <seastar/http/httpd.hh>
#include <seastar/http/request.hh>
#include <seastar/http/routes.hh>
#include <seastar/util/log.hh>
#include <stdexcept>
using namespace seastar;
using namespace httpd;
logger lg("noidb");
namespace bpo = boost::program_options;
seastar::logger lg("noidb");
int main(int argc, char** argv) {
seastar::app_template app;