4#ifndef CLIENT_DATA_MANAGER_H
5#define CLIENT_DATA_MANAGER_H
8#include <unordered_map>
9#include <unordered_set>
10#include <shared_mutex>
18#include "ResourceTunerSettings.h"
24 std::vector<int32_t>* mClientTIDs;
29 std::unordered_set<int64_t>* mClientHandles;
30 int64_t mLastRequestTimestamp;
46 static std::shared_ptr<ClientDataManager> mClientDataManagerInstance;
47 static std::mutex instanceProtectionLock;
50 std::shared_timed_mutex mGlobalTableMutex;
171 static std::shared_ptr<ClientDataManager> getInstance() {
172 if(mClientDataManagerInstance ==
nullptr) {
173 instanceProtectionLock.lock();
174 if(mClientDataManagerInstance ==
nullptr) {
176 mClientDataManagerInstance = std::shared_ptr<ClientDataManager> (
new ClientDataManager());
177 }
catch(
const std::bad_alloc& e) {
178 instanceProtectionLock.unlock();
182 instanceProtectionLock.unlock();
184 return mClientDataManagerInstance;
void deleteClientPID(int32_t clientPID)
Delete a client PID Entry from the Client Table.
void getActiveClientList(std::vector< int32_t > &clientList)
This method is called by the PulseMonitor to fetch the list of all active clients.
void deleteClientTID(int32_t clientTID)
Delete a client TID Entry from the Client TID Data Table.
void updateHealthByClientID(int32_t clientTID, double health)
This method is called by the RateLimiter to update the current health for a given client in the Clien...
std::unordered_set< int64_t > * getRequestsByClientID(int32_t clientTID)
Returns a list of active requests for the client with the given PID.
double getHealthByClientID(int32_t clientTID)
This method is called by the RateLimiter to fetch the current health for a given client in the Client...
void updateLastRequestTimestampByClientID(int32_t clientTID, int64_t currentMillis)
This method is called by the RateLimiter to update the Last Request Timestamp for a given client in t...
void deleteRequestByClientId(int32_t clientTID, int64_t requestHandle)
This method is called by the RequestMap to delete a Request (represented by it's handle) for the clie...
std::vector< int32_t > * getThreadsByClientId(int32_t clientPID)
Returns the list of threads corresponding to the thread with the given ID.
int64_t getLastRequestTimestampByClientID(int32_t clientTID)
This method is called by the RateLimiter to fetch the Last Request Timestamp for a given client in th...
int8_t createNewClient(int32_t clientPID, int32_t clientTID)
Create a new entry for the client with the given PID in the ClientData Table.
std::unordered_map< int32_t, ClientTidData * > mClientTidRepo
Maintains Client Info indexed by TID.
int8_t clientExists(int32_t clientPID, int32_t clientTID)
Checks if the client with the given ID exists in the Client Data Table.
int8_t getClientLevelByClientID(int32_t clientPID)
This method is called by the Verifier to fetch the Permission Level for a given client in the Client ...
std::unordered_map< int32_t, ClientInfo * > mClientRepo
Maintains Client Info indexed by PID.
void insertRequestByClientId(int32_t clientTID, int64_t requestHandle)
This method is called by the RequestMap to insert a new Request (represented by it's handle) for the ...