Add metadata!

This commit is contained in:
Your Name
2025-05-03 10:14:16 +12:00
parent 16754a48d4
commit 24a4c66c13
8 changed files with 283 additions and 149 deletions

View File

@@ -3,13 +3,13 @@
#include "config.hpp"
#include "httplib.hpp"
// #include "litecask.hpp" // Removed litecask
#include "database.hpp"
#include <string>
#include <memory>
#include <thread>
#include <atomic>
#include <filesystem>
#include <sqlite3.h> // Include SQLite header
#include <json.hpp>
namespace simple_object_storage {
@@ -25,20 +25,19 @@ 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); // Re-add directory handler
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);
bool validate_write_token(const std::string& token) const;
std::pair<std::string, std::string> parse_label_tag(const std::string& label_tag) const;
nlohmann::json get_metadata(const std::string& file_path) const;
bool init_db(); // Helper for DB initialization
bool init_db();
const ServerConfig& config_;
httplib::Server server_;
// Removed litecask members
sqlite3* db_ = nullptr; // SQLite database connection
std::filesystem::path db_path_;
std::unique_ptr<Database> db_;
std::atomic<bool> running_;
// Removed _isInitialized - will rely on db_ pointer
};
} // namespace simple_object_storage