File MessageEndpointServer.h

Defines

DEFAULT_MESSAGE_SERVER_THREADS
namespace faabric
namespace transport
class MessageEndpointServer

Subclassed by faabric::planner::PlannerServer, faabric::scheduler::FunctionCallServer, faabric::snapshot::SnapshotServer, faabric::state::StateServer, faabric::transport::PointToPointServer

Public Functions

MessageEndpointServer(int asyncPortIn, int syncPortIn, const std::string &inprocLabelIn, int nThreadsIn)
virtual void start(int timeoutMs = DEFAULT_SOCKET_TIMEOUT_MS)

We need to guarantee to callers of this function, that when it returns, the server will be ready to use.

virtual void stop()
virtual void onWorkerStop()
void setRequestLatch()
void awaitRequestLatch()
int getNThreads()

Protected Functions

virtual void doAsyncRecv(transport::Message &message) = 0
virtual std::unique_ptr<google::protobuf::Message> doSyncRecv(transport::Message &message) = 0

Private Members

const int asyncPort
const int syncPort
const std::string inprocLabel
const int nThreads
MessageEndpointServerHandler asyncHandler
MessageEndpointServerHandler syncHandler
std::shared_ptr<faabric::util::Latch> requestLatch
bool started = false

Friends

friend class MessageEndpointServerHandler
class MessageEndpointServerHandler

Public Functions

MessageEndpointServerHandler(MessageEndpointServer *serverIn, bool asyncIn, const std::string &inprocLabelIn, int nThreadsIn)
void start(int timeoutMs = DEFAULT_SOCKET_TIMEOUT_MS)
void join()

Private Members

MessageEndpointServer *server
bool async = false
const std::string inprocLabel
int nThreads
std::jthread receiverThread
std::vector<std::jthread> workerThreads
std::shared_ptr<FanMessageEndpoint> fan = nullptr