VLink  2.0.0
A high-performance communication middleware
vlink::ProxyServer类 参考

In-process VLink proxy daemon backed by a MessageLoop. 更多...

#include <proxy_server.h>

类 vlink::ProxyServer 继承关系图:
vlink::ProxyServer 的协作图:

struct  Config
 Construction-time configuration aggregate for ProxyServer. 更多...
 

Public 成员函数

 ProxyServer (const Config &config)
 Constructs a ProxyServer and brings every proxy subsystem online. 更多...
 
 ~ProxyServer () override
 Destroys the ProxyServer in a deterministic shutdown order. 更多...
 
std::string get_token () const
 Returns the authentication token issued by this server. 更多...
 

Protected 成员函数

size_t get_max_task_count () const override
 Returns the maximum queue depth. 更多...
 
uint32_t get_max_elapsed_time () const override
 Returns the maximum allowed task execution time in milliseconds. 更多...
 
void on_begin () override
 Hook invoked once on the loop thread before the first task runs. 更多...
 
void on_end () override
 Hook invoked once on the loop thread after the last task runs. 更多...
 

额外继承的成员函数

 Internal queue implementation type. 更多...
 Back-pressure strategy applied when the bounded queue is at capacity. 更多...
 Built-in priority levels for kPriorityType loops; higher values dispatch first. 更多...

详细描述

In-process VLink proxy daemon backed by a MessageLoop.

Owns the discovery layer, the handshake/control/time/info DDS channels, the data relay path, and any embedded Iceoryx daemon or runnable plugins. Construction starts the DiscoveryViewer plus its 1-second heartbeat and statistics timers, but it does not start the server's own inherited loop. Call async_run() (or run()) on the MessageLoop base to enable asynchronous relays and the runnable-plugin lifecycle hooks. Only one instance is allowed per process.

构造及析构函数说明

◆ ProxyServer()

vlink::ProxyServer::ProxyServer ( const Config config)
explicit

Constructs a ProxyServer and brings every proxy subsystem online.

The constructor performs the following steps in order:

  1. Acquires the process-global singleton guard; on contention it logs a fatal message and throws before touching any DDS handle.
  2. Reads the VLINK_INTRA_BIND environment variable.
  3. When config.use_iox is true, calls init_shm_roudi() to spin up an embedded Iceoryx RouDi process.
  4. Calls init_server() to create the handshake, control, time, info, and data channels, subscribe to Control, and start the heartbeat plus statistics timers on the DiscoveryViewer's loop.
  5. Calls init_runnable() to load every plugin listed in config.runnable_list.

The inherited MessageLoop is not started here – call async_run() or run() explicitly when asynchronous relays and plugin lifecycle hooks must run.

参数
configServer configuration. See Config for per-field semantics.
注解
A second ProxyServer in the same process is unsupported and the constructor throws.

◆ ~ProxyServer()

vlink::ProxyServer::~ProxyServer ( )
override

Destroys the ProxyServer in a deterministic shutdown order.

Requests the inherited MessageLoop to stop, waits for it, then stops the proxy timers, joins the DiscoveryViewer, and releases each DDS/SHM handle. When the loop has been started, runnable plugins receive on_deinit(), quit(), and wait_for_quit() from on_end() before the destructor drops them. The process-global singleton guard remains set for the rest of the process lifetime.

成员函数说明

◆ get_max_elapsed_time()

uint32_t vlink::ProxyServer::get_max_elapsed_time ( ) const
overrideprotectedvirtual

Returns the maximum allowed task execution time in milliseconds.

Tasks exceeding this duration trigger on_task_timeout. Zero disables the check.

返回
Maximum execution time in milliseconds.

重载 vlink::MessageLoop .

◆ get_max_task_count()

size_t vlink::ProxyServer::get_max_task_count ( ) const
overrideprotectedvirtual

Returns the maximum queue depth.

返回
kMaxTaskSize (10000) by default.

重载 vlink::MessageLoop .

◆ get_token()

std::string vlink::ProxyServer::get_token ( ) const

Returns the authentication token issued by this server.

When VLINK_PROXY_ENABLE_HANDSHAKE is non-zero (the default), the token is generated once at construction via vlink::Uuid::random_hex() and remains constant for the server's lifetime. Clients learn it through the security-authenticated handshake RPC. The server then validates the token on every inbound Control and echoes it (alongside the server identity) inside every Time heartbeat so clients can detect both server restarts and identity mismatches. When the macro is 0, the token is empty, validation is disabled, and the handshake channel is not created.

返回
Hex-encoded token string, or empty when handshake is compiled out.
注解
Thread-safe; the returned string is a copy.

◆ on_begin()

void vlink::ProxyServer::on_begin ( )
overrideprotectedvirtual

Hook invoked once on the loop thread before the first task runs.

Subclasses override to perform per-thread initialisation.

重载 vlink::MessageLoop .

◆ on_end()

void vlink::ProxyServer::on_end ( )
overrideprotectedvirtual

Hook invoked once on the loop thread after the last task runs.

Subclasses override to perform per-thread cleanup.

重载 vlink::MessageLoop .


该类的文档由以下文件生成: