From 6099ec04bd0d98b9e75f5b55b1215c94ccf20202 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 11 Mar 2018 00:12:37 +0100 Subject: Add operation to allow users to be added to group WARNING! Lazy implementation everywhere, does not handle out-of-order packets --- include/DatabaseStorage.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/DatabaseStorage.hpp') 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 userPublicKeyNodeMap; Signature::MapPublicKey publicKeyUserMap; + DataViewMap groupByIdMap; }; } -- cgit v1.2.3