MantisBase v0.3.7
Loading...
Searching...
No Matches
kv_store.h
Go to the documentation of this file.
1
9#ifndef KV_STORE_H
10#define KV_STORE_H
11
13#include <nlohmann/json.hpp>
14#include "../utils/utils.h"
15#include "http.h"
16
17namespace mb
18{
23 {
24 public:
25 KeyValStore() = default;
26 ~KeyValStore() { std::cout << "KeyValStore Des()" << std::endl; }
27
28 void close() {}
29
34 bool setupRoutes();
35
39 void migrate();
40
51 HandlerResponse hasAccess([[maybe_unused]] MantisRequest& req, MantisResponse& res) const;
52
53 // Getter sections
59 json& configs();
60
61 private:
67 json initSettingsConfig();
68
72 void setupConfigRoutes();
73
74 // Cache settings config on create/read/update cycles to reduce database reads
75 // may not be that significant though...!
76 json m_configs;
77 };
78} // mb
79
80#endif // KV_STORE_H
Manages application settings.
Definition kv_store.h:23
~KeyValStore()
Definition kv_store.h:26
bool setupRoutes()
Initialize and set up routes for fetching settings data.
Definition kv_store.cpp:16
json & configs()
Get the current config data instance.
Definition kv_store.cpp:174
void close()
Definition kv_store.h:28
KeyValStore()=default
void migrate()
Initialize migration, create base data for setting fields.
Definition kv_store.cpp:32
HandlerResponse hasAccess(MantisRequest &req, MantisResponse &res) const
Evaluate if request is authenticated and has permission to access this route.
Definition kv_store.cpp:73
A wrapper class around httplib::Request offering a consistent API and allowing for easy wrapper metho...
Definition http.h:39
Wrapper around httplib::Response for consistent API.
Definition http.h:315
router.h
Definition auth.h:16
httplib::Server::HandlerResponse HandlerResponse
Definition types.h:33
nlohmann::json json
Shorten JSON namespace.
Definition context_store.h:18
Route registry.