MantisBase v0.3.4
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
27 void close() {}
28
33 bool setupRoutes();
34
38 void migrate();
39
50 HandlerResponse hasAccess([[maybe_unused]] MantisRequest& req, MantisResponse& res) const;
51
52 // Getter sections
58 json& configs();
59
60 private:
66 json initSettingsConfig();
67
71 void setupConfigRoutes();
72
73 // Cache settings config on create/read/update cycles to reduce database reads
74 // may not be that significant though...!
75 json m_configs;
76 };
77} // mb
78
79#endif // KV_STORE_H
Manages application settings.
Definition kv_store.h:23
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:27
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:42
Wrapper around httplib::Response for consistent API.
Definition http.h:318
router.h
Definition auth.h:15
httplib::Server::HandlerResponse HandlerResponse
Definition types.h:33
nlohmann::json json
Shorten JSON namespace.
Definition context_store.h:18
Route registry.