aboutsummaryrefslogtreecommitdiff
path: root/include/Database.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/Database.hpp')
-rw-r--r--include/Database.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/Database.hpp b/include/Database.hpp
new file mode 100644
index 0000000..0b324e8
--- /dev/null
+++ b/include/Database.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "types.hpp"
+#include "Key.hpp"
+#include "DataView.hpp"
+#include <opendht/dhtrunner.h>
+#include <vector>
+
+namespace odhtdb
+{
+ struct StagedObject
+ {
+ Key key;
+ DataView data;
+ };
+
+ class Database
+ {
+ public:
+ Database(const char *bootstrapNodeAddr, u16 port);
+ ~Database();
+
+ void add(const Key &key, DataView data);
+ void commit();
+ private:
+ void commitStagedObject(const StagedObject &stagedObject);
+ private:
+ dht::DhtRunner node;
+ std::vector<StagedObject> stagedObjects;
+ };
+} \ No newline at end of file