summaryrefslogtreecommitdiffhomepage
path: root/storage.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2022-12-31 22:00:11 +0100
committerRoland Reichwein <mail@reichwein.it>2022-12-31 22:00:11 +0100
commit9465fd744cc2117190bafc1a3e2da9f10ca29bf9 (patch)
tree7d94bdaaa37cabb58cede695b03082b8360167bd /storage.h
parentaf1c4ee4d74ff7afc997372802d851d11daad418 (diff)
Storage via SQLite, Added tests (WIP)
Diffstat (limited to 'storage.h')
-rw-r--r--storage.h22
1 files changed, 20 insertions, 2 deletions
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 <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;
};