diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-02-01 21:15:13 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:12 +0200 |
commit | 1c7e6e074155499155adbbb651db1c66f1762ba2 (patch) | |
tree | c08a95e772c8e23228a2be78e308aba313034f26 /include/Database.hpp | |
parent | bd2bd91ac947a7b1f6d097d7efa4b0ab2041d4db (diff) |
Sync time with ntp server, starting with basic operations
Diffstat (limited to 'include/Database.hpp')
-rw-r--r-- | include/Database.hpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/Database.hpp b/include/Database.hpp index 0b324e8..20d7513 100644 --- a/include/Database.hpp +++ b/include/Database.hpp @@ -5,13 +5,24 @@ #include "DataView.hpp" #include <opendht/dhtrunner.h> #include <vector> +#include <ntp/NtpClient.hpp> namespace odhtdb { - struct StagedObject + class Group; + + struct StagedCreateObject + { + Key key; + Group *primaryAdminGroup; + u64 timestamp; // In microseconds + }; + + struct StagedAddObject { Key key; DataView data; + u64 timestamp; // In microseconds }; class Database @@ -20,12 +31,16 @@ namespace odhtdb Database(const char *bootstrapNodeAddr, u16 port); ~Database(); + void create(const Key &key, Group *primaryAdminGroup); void add(const Key &key, DataView data); void commit(); private: - void commitStagedObject(const StagedObject &stagedObject); + void commitStagedCreateObject(const StagedCreateObject &stagedObject); + void commitStagedAddObject(const StagedAddObject &stagedObject); + ntp::NtpTimestamp getSyncedTimestampUtc() const; private: dht::DhtRunner node; - std::vector<StagedObject> stagedObjects; + std::vector<StagedCreateObject> stagedCreateObjects; + std::vector<StagedAddObject> stagedAddObjects; }; }
\ No newline at end of file |