diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-03-11 00:12:37 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | 6099ec04bd0d98b9e75f5b55b1215c94ccf20202 (patch) | |
tree | 9a551e8e723cde057610d6071587bc76b4a6af19 /include/DatabaseStorage.hpp | |
parent | 0e62cb8e5ed06d906ad84321cdda22acfcc952c9 (diff) |
Add operation to allow users to be added to group
WARNING! Lazy implementation everywhere, does not handle out-of-order
packets
Diffstat (limited to 'include/DatabaseStorage.hpp')
-rw-r--r-- | include/DatabaseStorage.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/DatabaseStorage.hpp b/include/DatabaseStorage.hpp index fd29050..ee4d2ad 100644 --- a/include/DatabaseStorage.hpp +++ b/include/DatabaseStorage.hpp @@ -1,5 +1,6 @@ #pragma once +#include "types.hpp" #include "Hash.hpp" #include "DataView.hpp" #include "Signature.hpp" @@ -65,6 +66,8 @@ namespace odhtdb void addToQuarantine(const Signature::PublicKey &creatorPublicKey, u64 timestamp, const u8 *data, usize dataSize); + void addUser(User *user, const Hash &hash); + // Returns nullptr if no storage with provided hash exists const DatabaseStorageObjectList* getStorage(const Hash &hash) const; @@ -73,10 +76,17 @@ namespace odhtdb // Returns nullptr if no user with public key exists const User* getUserByPublicKey(const Signature::PublicKey &userPublicKey) const; + + // Returns nullptr if a group with id @groupId doesn't exist + Group* getGroupById(uint8_t groupId[16]); + + // Update storage state (remove quarantine objects if they are too old, etc) + void update(); private: DatabaseStorageMap storageMap; DatabaseStorageQuarantineMap quarantineStorageMap; Signature::MapPublicKey<Hash> userPublicKeyNodeMap; Signature::MapPublicKey<const User*> publicKeyUserMap; + DataViewMap<Group*> groupByIdMap; }; } |