CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
RequestExecutor.h File Reference

Request-system worker side: RequestExecutor pulls requests from a RequestGateway, processes them and replies. More...

#include "NetworkManager.h"
#include "RequestClient.h"
Include dependency graph for RequestExecutor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cmlabs::RequestExecutor
 Worker node of the request system: receives requests from gateways, queues them by class (short/long) and sends back replies. More...
class  cmlabs::TestRequestExecutor
 Test executor that services requests with a configurable artificial processing delay; used by RequestGateway::UnitTest(). More...

Namespaces

namespace  cmlabs

Functions

THREAD_RET THREAD_FUNCTION_CALL cmlabs::RequestExecutorRun (THREAD_ARG arg)
 Thread entry point for the RequestExecutor worker loop.
THREAD_RET THREAD_FUNCTION_CALL cmlabs::ShortExecutorRun (THREAD_ARG arg)
THREAD_RET THREAD_FUNCTION_CALL cmlabs::LongExecutorRun (THREAD_ARG arg)

Detailed Description

Request-system worker side: RequestExecutor pulls requests from a RequestGateway, processes them and replies.

The executor is the "server" role of the request fabric (see RequestClient.h for the conceptual overview and a round-trip example). It connects out to one or more gateways (addGateway()), announces itself with periodic status heartbeats — the gateway uses these both for liveness (an executor missing heartbeats is declared dead and its queued requests are redistributed) and for load balancing — and receives requests over the binary message protocol.

Requests are classified short (interactive, cheap) or long (expensive, e.g. heavy computation) by matching the request name against names registered with addLongRequestName(); the two classes have separate queues so long jobs cannot starve short ones, and the number of concurrent long requests is capped by setLongRequestLimit().

Application worker threads call waitForShortRequest() / waitForLongRequest() to pull work and replyToQuery() to answer.

Definition in file RequestExecutor.h.