Class Tryll::Client::ManagedServer¶
ClassList > Tryll > Client > ManagedServer
RAII handle around a child tryll_server process.More...
#include <ManagedServer.h>
Public Functions¶
| Type | Name |
|---|---|
| std::string | Host () noexcept const The host string from ManagedServerOptions::host . |
| bool | IsRunning () noexcept const Returns true while the child process is still running. |
| ManagedServer (ManagedServer &&) noexcept |
|
| ManagedServer (const ManagedServer &) = delete |
|
| std::uint16_t | Port () noexcept const The port from ManagedServerOptions::port . |
| void | Stop (std::chrono::milliseconds timeout=std::chrono::seconds{8}) Terminate the child process. |
| ManagedServer & | operator= (ManagedServer &&) noexcept |
| ManagedServer & | operator= (const ManagedServer &) = delete |
| ~ManagedServer () |
Public Static Functions¶
| Type | Name |
|---|---|
| ManagedServer | Start (const ManagedServerOptions & opts) Spawn the server and block until its TCP port accepts connections. |
Detailed Description¶
Move-only. The destructor calls Stop if the process is still running.
Public Functions Documentation¶
function Host¶
The host string from ManagedServerOptions::host .
function IsRunning¶
Returns true while the child process is still running.
function ManagedServer [1/3]¶
function ManagedServer [2/3]¶
function Port¶
The port from ManagedServerOptions::port .
function Stop¶
Terminate the child process.
void Tryll::Client::ManagedServer::Stop (
std::chrono::milliseconds timeout=std::chrono::seconds{8}
)
Sends a termination signal and waits up to timeout for the process to exit. If the process does not exit in time it is force-killed. Idempotent — safe to call more than once.
Parameters:
timeoutOverride for the stop timeout set in the options.
function operator=¶
function operator=¶
function ~ManagedServer¶
Public Static Functions Documentation¶
function Start¶
Spawn the server and block until its TCP port accepts connections.
The server is launched with --port <opts.port> so the port is authoritative from the caller's side regardless of server-config.json.
Parameters:
optsLaunch options.opts.exemust exist.
Returns:
A ready-to-use ManagedServer.
Exception:
TryllErrorIf the executable is not found, the process fails to start, the process exits before the port opens, oropts.startTimeoutexpires.
The documentation for this class was generated from the following file C:/_tryll/_monorepo/server/client-cpp/include/tryll/ManagedServer.h