Resource Tuner
Loading...
Searching...
No Matches
ClientDataManager Class Reference

#include <ClientDataManager.h>

Public Member Functions

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 createNewClient (int32_t clientPID, int32_t clientTID)
 Create a new entry for the client with the given PID in the ClientData Table.
 
std::unordered_set< int64_t > * getRequestsByClientID (int32_t clientTID)
 Returns a list of active requests for the client with the given 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 client with the given ID in the Client Data Table.
 
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 client with the given ID in the Client Data Table.
 
double getHealthByClientID (int32_t clientTID)
 This method is called by the RateLimiter to fetch the current health for a given client in the Client Data Table.
 
int64_t getLastRequestTimestampByClientID (int32_t clientTID)
 This method is called by the RateLimiter to fetch the Last Request Timestamp for a given client in the Client 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 Client Data Table.
 
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 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 Data Table, i.e. whether the client has SYSTEM (Root) or THIRD_PARTY (User) permissions.
 
std::vector< int32_t > * getThreadsByClientId (int32_t clientPID)
 Returns the list of threads corresponding to the thread with the given ID.
 
void getActiveClientList (std::vector< int32_t > &clientList)
 This method is called by the PulseMonitor to fetch the list of all active clients.
 
void deleteClientPID (int32_t clientPID)
 Delete a client PID Entry from the Client Table.
 
void deleteClientTID (int32_t clientTID)
 Delete a client TID Entry from the Client TID Data Table.
 

Private Attributes

std::unordered_map< int32_t, ClientInfo * > mClientRepo
 Maintains Client Info indexed by PID.
 
std::unordered_map< int32_t, ClientTidData * > mClientTidRepo
 Maintains Client Info indexed by TID.
 

Detailed Description

Stores and Maintains Client Tracking Data for all the Active Clients (i.e. clients with outstanding Requests). The Data Tracked for each Client includes:

Definition at line 44 of file ClientDataManager.h.

Member Function Documentation

◆ clientExists()

int8_t ClientDataManager::clientExists ( int32_t  clientPID,
int32_t  clientTID 
)

Checks if the client with the given ID exists in the Client Data Table.

Parameters
clientPIDPID of the client
clientTIDTID of the client
Returns
int8_t:
  • 1: if the client already exists
  • 0: otherwise

◆ createNewClient()

int8_t ClientDataManager::createNewClient ( int32_t  clientPID,
int32_t  clientTID 
)

Create a new entry for the client with the given PID in the ClientData Table.

This method should only be called if the clientExists method returns 0.

Parameters
clientPIDPID of the client
clientTIDTID of the client
Returns
int8_t:
  • 1: Indicating that a new Client Tracking Entry was successfully Created.
  • 0: Otherwise

◆ deleteClientPID()

void ClientDataManager::deleteClientPID ( int32_t  clientPID)

Delete a client PID Entry from the Client Table.

Parameters
clientPIDProcess ID of the client

◆ deleteClientTID()

void ClientDataManager::deleteClientTID ( int32_t  clientTID)

Delete a client TID Entry from the Client TID Data Table.

Parameters
clientTIDTID of the client

◆ deleteRequestByClientId()

void ClientDataManager::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 client with the given ID in the Client Data Table.

Parameters
clientTIDProcess TID of the client
requestHandleHandle of the Request

◆ getActiveClientList()

void ClientDataManager::getActiveClientList ( std::vector< int32_t > &  clientList)

This method is called by the PulseMonitor to fetch the list of all active clients.

Parameters
clientListAn IN/OUT parameter to store the list of active clients.

◆ getClientLevelByClientID()

int8_t ClientDataManager::getClientLevelByClientID ( int32_t  clientPID)

This method is called by the Verifier to fetch the Permission Level for a given client in the Client Data Table, i.e. whether the client has SYSTEM (Root) or THIRD_PARTY (User) permissions.

Parameters
clientPIDProcess ID of the client
Returns
int8_t:
  • PERMISSION_SYSTEM: If the client has System level access
  • PERMISSION_THIRD_PARTY: If the Client has Third Party level access
  • -1: If the Client could not be determined.

◆ getHealthByClientID()

double ClientDataManager::getHealthByClientID ( int32_t  clientTID)

This method is called by the RateLimiter to fetch the current health for a given client in the Client Data Table.

Parameters
clientPIDProcess ID of the client
Returns
double:
  • Health of the Client.

◆ getLastRequestTimestampByClientID()

int64_t ClientDataManager::getLastRequestTimestampByClientID ( int32_t  clientTID)

This method is called by the RateLimiter to fetch the Last Request Timestamp for a given client in the Client Data Table.

Parameters
clientTIDTID of the client
Returns
int64_t:
  • Timestamp of Last Request (A value of 0, indicates no prior Requests).

◆ getRequestsByClientID()

std::unordered_set< int64_t > * ClientDataManager::getRequestsByClientID ( int32_t  clientTID)

Returns a list of active requests for the client with the given PID.

Parameters
clientTIDProcess TID of the client
Returns
std::unordered_set<int64_t>*:
  • Pointer to an unordered_set containing the requests.

◆ getThreadsByClientId()

std::vector< int32_t > * ClientDataManager::getThreadsByClientId ( int32_t  clientPID)

Returns the list of threads corresponding to the thread with the given ID.

Parameters
clientPIDProcess ID of the client
Returns
std::vector<int32_t>*:
  • Pointer to a vector containing the threads ids.

◆ insertRequestByClientId()

void ClientDataManager::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 client with the given ID in the Client Data Table.

Parameters
clientTIDProcess TID of the client
requestHandleHandle of the Request

◆ updateHealthByClientID()

void ClientDataManager::updateHealthByClientID ( int32_t  clientTID,
double  health 
)

This method is called by the RateLimiter to update the current health for a given client in the Client Data Table.

Parameters
clientTIDTID of the client
healthUpdate value of the Health for the client

◆ updateLastRequestTimestampByClientID()

void ClientDataManager::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 the Client Data Table.

Parameters
clientTIDTID of the client
currentMillisNew value for the Last Request Timestamp for the client

The documentation for this class was generated from the following file: