diff options
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 |