From 07f99a86578bee9e7ac0dd0114b89bf983a92d9b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 21 Oct 2018 15:57:36 +0200 Subject: Add database object to callback funcs --- include/odhtdb/Database.hpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/odhtdb/Database.hpp b/include/odhtdb/Database.hpp index 61365a0..ca713bd 100644 --- a/include/odhtdb/Database.hpp +++ b/include/odhtdb/Database.hpp @@ -46,6 +46,8 @@ namespace odhtdb public: DatabaseAddException(const std::string &errMsg) : std::runtime_error(errMsg) {} }; + + class Database; struct DatabaseCreateNodeRequest { @@ -56,13 +58,15 @@ namespace odhtdb const Signature::PublicKey *creatorPublicKey; const DataView groupId; bool loadedFromCache; + const Database *database; - DatabaseCreateNodeRequest(const Hash *_nodeHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const DataView &_groupId) : + DatabaseCreateNodeRequest(const Hash *_nodeHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const DataView &_groupId, const Database *_database) : nodeHash(_nodeHash), timestamp(_timestamp), creatorPublicKey(_creatorPublicKey), groupId(_groupId), - loadedFromCache(false) + loadedFromCache(false), + database(_database) { } @@ -78,14 +82,16 @@ namespace odhtdb const Signature::PublicKey *creatorPublicKey; const DataView decryptedData; bool loadedFromCache; + const Database *database; - DatabaseAddNodeRequest(const Hash *_nodeHash, const Hash *_requestHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const DataView &_decryptedData) : + DatabaseAddNodeRequest(const Hash *_nodeHash, const Hash *_requestHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const DataView &_decryptedData, const Database *_database) : nodeHash(_nodeHash), requestHash(_requestHash), timestamp(_timestamp), creatorPublicKey(_creatorPublicKey), decryptedData(_decryptedData), - loadedFromCache(false) + loadedFromCache(false), + database(_database) { } @@ -102,15 +108,17 @@ namespace odhtdb const Signature::PublicKey *userToAddPublicKey; const DataView groupToAddUserTo; bool loadedFromCache; + const Database *database; - DatabaseAddUserRequest(const Hash *_nodeHash, const Hash *_requestHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const Signature::PublicKey *_userToAddPublicKey, const DataView &_groupToAddUserTo) : + DatabaseAddUserRequest(const Hash *_nodeHash, const Hash *_requestHash, u64 _timestamp, const Signature::PublicKey *_creatorPublicKey, const Signature::PublicKey *_userToAddPublicKey, const DataView &_groupToAddUserTo, const Database *_database) : nodeHash(_nodeHash), requestHash(_requestHash), timestamp(_timestamp), creatorPublicKey(_creatorPublicKey), userToAddPublicKey(_userToAddPublicKey), groupToAddUserTo(_groupToAddUserTo), - loadedFromCache(false) + loadedFromCache(false), + database(_database) { } -- cgit v1.2.3