diff options
Diffstat (limited to 'storage.h')
-rw-r--r-- | storage.h | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,6 +1,9 @@ #pragma once #include <string> +#include <tuple> + +#include <SQLiteCpp/SQLiteCpp.h> #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<std::string, int, int> 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; }; |