CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::RequestConnection Struct Reference

Gateway-side record of one connected client or executor. More...

#include <RequestClient.h>

Collaboration diagram for cmlabs::RequestConnection:
[legend]

Public Member Functions

void clear ()
 Reset all counters/ids to the disconnected state.
uint32 removeStaleRequests (uint32 ttlMS)
 Fail and drop requests older than ttlMS from both queues.

Public Attributes

uint64 lastConTime
 Last successful connect/heartbeat time (ms epoch).
uint64 lastFailTime
 Last connection failure time (ms epoch).
uint64 conID
 NetworkManager connection id.
uint64 location
 Remote endpoint packed as uint64.
uint64 lastStatusTime
 When the peer last reported its status (ms epoch).
uint32 reportedShortReqQSize
 Peer-reported short-request queue size.
uint32 reportedLongReqQSize
 Peer-reported long-request queue size.
uint32 longReqQProcessingSize
 Peer-reported long requests currently processing.
uint32 count
 Total requests routed via this connection.
RequestQueue shortReqQueue
 Gateway-side queue of short requests for this peer.
RequestQueue longReqQueue
 Gateway-side queue of long requests for this peer.
MovingAverage shortAvgStats
 Rolling latency stats for short requests.
MovingAverage longAvgStats
 Rolling latency stats for long requests.

Detailed Description

Gateway-side record of one connected client or executor.

Tracks the network connection, last-seen/failure times, the peer's self-reported queue sizes (from status heartbeats) and per-connection short/long request queues plus latency statistics. The gateway's load-balancing decision (RequestGateway::getBestExecutorID()) is based on these fields.

Definition at line 302 of file RequestClient.h.

Member Function Documentation

◆ clear()

void cmlabs::RequestConnection::clear ( )
inline

◆ removeStaleRequests()

uint32 cmlabs::RequestConnection::removeStaleRequests ( uint32 ttlMS)

Fail and drop requests older than ttlMS from both queues.

Parameters
ttlMSAge limit in ms.
Returns
Number of requests removed.

Definition at line 17 of file RequestClient.cpp.

References count, longReqQueue, and shortReqQueue.

Member Data Documentation

◆ conID

uint64 cmlabs::RequestConnection::conID

◆ count

uint32 cmlabs::RequestConnection::count

Total requests routed via this connection.

Definition at line 311 of file RequestClient.h.

Referenced by clear(), and removeStaleRequests().

◆ lastConTime

uint64 cmlabs::RequestConnection::lastConTime

Last successful connect/heartbeat time (ms epoch).

Definition at line 303 of file RequestClient.h.

Referenced by cmlabs::RequestGateway::callExternalAPI(), clear(), cmlabs::RequestGateway::receiveMessage(), and cmlabs::RequestGateway::receiveWebsocketData().

◆ lastFailTime

uint64 cmlabs::RequestConnection::lastFailTime

Last connection failure time (ms epoch).

Definition at line 304 of file RequestClient.h.

Referenced by clear().

◆ lastStatusTime

uint64 cmlabs::RequestConnection::lastStatusTime

When the peer last reported its status (ms epoch).

Definition at line 307 of file RequestClient.h.

Referenced by clear().

◆ location

uint64 cmlabs::RequestConnection::location

Remote endpoint packed as uint64.

Definition at line 306 of file RequestClient.h.

Referenced by clear(), and cmlabs::RequestGateway::receiveMessage().

◆ longAvgStats

MovingAverage cmlabs::RequestConnection::longAvgStats

Rolling latency stats for long requests.

Definition at line 315 of file RequestClient.h.

◆ longReqQProcessingSize

uint32 cmlabs::RequestConnection::longReqQProcessingSize

Peer-reported long requests currently processing.

Definition at line 310 of file RequestClient.h.

Referenced by cmlabs::RequestGateway::addRequestReplyToRequestQueue(), and clear().

◆ longReqQueue

RequestQueue cmlabs::RequestConnection::longReqQueue

Gateway-side queue of long requests for this peer.

Definition at line 313 of file RequestClient.h.

Referenced by cmlabs::RequestGateway::addRequestReplyToRequestQueue(), and removeStaleRequests().

◆ reportedLongReqQSize

uint32 cmlabs::RequestConnection::reportedLongReqQSize

Peer-reported long-request queue size.

Definition at line 309 of file RequestClient.h.

Referenced by clear().

◆ reportedShortReqQSize

uint32 cmlabs::RequestConnection::reportedShortReqQSize

Peer-reported short-request queue size.

Definition at line 308 of file RequestClient.h.

Referenced by clear().

◆ shortAvgStats

MovingAverage cmlabs::RequestConnection::shortAvgStats

Rolling latency stats for short requests.

Definition at line 314 of file RequestClient.h.

◆ shortReqQueue

RequestQueue cmlabs::RequestConnection::shortReqQueue

Gateway-side queue of short requests for this peer.

Definition at line 312 of file RequestClient.h.

Referenced by cmlabs::RequestGateway::addRequestReplyToRequestQueue(), and removeStaleRequests().


The documentation for this struct was generated from the following files: