From 9465fd744cc2117190bafc1a3e2da9f10ca29bf9 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 31 Dec 2022 22:00:11 +0100 Subject: Storage via SQLite, Added tests (WIP) --- storage.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'storage.h') diff --git a/storage.h b/storage.h index 068fad0..dc4e216 100644 --- a/storage.h +++ b/storage.h @@ -1,6 +1,9 @@ #pragma once #include +#include + +#include #include "config.h" @@ -8,9 +11,24 @@ class Storage { public: Storage(const Config& config); - std::string getDocument(); + + uint64_t getNumberOfDocuments(); + bool exists(const std::string& id); + + std::string getDocument(const std::string& id); + int getRevision(const std::string& id); + int getCursorPos(const std::string& id); + std::tuple getRow(const std::string& id); + + void setDocument(const std::string& id, const std::string& document); + void setRevision(const std::string& id, int rev); + void setCursorPos(const std::string& id, int cursorPos); + void setRow(const std::string& id, const std::string& document, int rev, int cursorPos); + + void cleanup(); private: - const Config& m_config; + SQLite::Database m_db; + uint64_t m_maxage; }; -- cgit v1.2.3