Tidy
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
#ifndef SERVER_HPP
|
||||
#define SERVER_HPP
|
||||
#pragma once
|
||||
|
||||
#include "config.hpp"
|
||||
#include "httplib.hpp"
|
||||
#include "database.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <filesystem>
|
||||
#include <json.hpp>
|
||||
#include "httplib.hpp"
|
||||
#include "json.hpp"
|
||||
#include "database.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
namespace simple_object_storage {
|
||||
|
||||
class PutHandler; // Forward declaration
|
||||
|
||||
class Server {
|
||||
public:
|
||||
Server(const ServerConfig& config);
|
||||
@@ -20,31 +19,27 @@ public:
|
||||
|
||||
bool start();
|
||||
void stop();
|
||||
bool validate_write_request(const httplib::Request& req, httplib::Response& res, const std::vector<std::string>& required_params, std::map<std::string, std::string>& params);
|
||||
std::pair<std::string, std::string> parse_label_tag(const std::string& label_tag) const;
|
||||
|
||||
// Make these public so PutHandler can access them
|
||||
ServerConfig config_;
|
||||
std::unique_ptr<Database> db_;
|
||||
|
||||
private:
|
||||
void setup_routes();
|
||||
void handle_get_object(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_get_hash(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_get_directory(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_put_object(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_get_metadata(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_delete_object(const httplib::Request& req, httplib::Response& res);
|
||||
void handle_exists(const httplib::Request& req, httplib::Response& res);
|
||||
std::pair<std::string, std::string> parse_label_tag(const std::string& label_tag) const;
|
||||
void add_file_metadata(const std::string &file_path, nlohmann::json &metadata) const;
|
||||
|
||||
bool init_db();
|
||||
|
||||
bool validate_write_request(const httplib::Request& req, httplib::Response& res, const std::vector<std::string>& required_params,
|
||||
std::map<std::string, std::string>& params);
|
||||
|
||||
private:
|
||||
const ServerConfig& config_;
|
||||
httplib::Server server_;
|
||||
std::unique_ptr<Database> db_;
|
||||
std::atomic<bool> running_;
|
||||
bool running_;
|
||||
std::unique_ptr<PutHandler> put_handler_;
|
||||
};
|
||||
|
||||
} // namespace simple_object_storage
|
||||
|
||||
#endif
|
||||
} // namespace simple_object_storage
|
Reference in New Issue
Block a user