diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-04-28 10:44:11 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | fb447b94e369114df0bc96b5c4c20b2cd102bff0 (patch) | |
tree | 1dac4f99a3feeb06e94b744163f8dfadb7616245 /include/odhtdb/Database.hpp | |
parent | 2ecdfb3b47882411659a0efe451b0910c85a32f5 (diff) |
Add decryption (and caching) of data, even when adding encryption key after data has been added
Diffstat (limited to 'include/odhtdb/Database.hpp')
-rw-r--r-- | include/odhtdb/Database.hpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/include/odhtdb/Database.hpp b/include/odhtdb/Database.hpp index 9aff90e..e78bc6e 100644 --- a/include/odhtdb/Database.hpp +++ b/include/odhtdb/Database.hpp @@ -12,6 +12,7 @@ #include "DatabaseNode.hpp" #include "Encryption.hpp" #include "OwnedMemory.hpp" +#include "DatabaseOperation.hpp" #include <opendht/dhtrunner.h> #include <vector> #include <ntp/NtpClient.hpp> @@ -49,12 +50,6 @@ namespace odhtdb DatabaseAddException(const std::string &errMsg) : std::runtime_error(errMsg) {} }; - enum class DatabaseOperation : u8 - { - ADD_DATA, - ADD_USER - }; - struct DatabaseCreateNodeRequest { DISABLE_COPY(DatabaseCreateNodeRequest) @@ -133,6 +128,7 @@ namespace odhtdb class Database { + friend class DatabaseStorage; public: Database(const char *bootstrapNodeAddr, u16 port, const boost::filesystem::path &storageDir); ~Database(); @@ -142,7 +138,7 @@ namespace odhtdb std::unique_ptr<DatabaseCreateResponse> create(const std::string &ownerName, const std::string &nodeName); // Throws DatabaseCreateException on failure. std::unique_ptr<DatabaseCreateResponse> create(const std::string &ownerName, const Signature::KeyPair &keyPair, const std::string &nodeName); - // Throws DatabaseAddException on failure + // Throws PermissionDeniedException if user @userToPerformActionWith is not allowed to add data to node void addData(const DatabaseNode &nodeInfo, LocalUser *userToPerformActionWith, DataView dataToAdd); // Throws PermissionDeniedException if user @userToPerformActionWith is not allowed to add user @userToAdd to group @groupToAddUserTo void addUser(const DatabaseNode &nodeInfo, LocalUser *userToPerformActionWith, const std::string &userToAddName, const Signature::PublicKey &userToAddPublicKey, Group *groupToAddUserTo); |