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

MessageLoop-based aggregator of live VLink endpoint announcements. 更多...

#include <discovery_viewer.h>

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

struct  Info
 One row of the discovery snapshot, describing a URL and its publishers/subscribers. 更多...
 
struct  Process
 Identity of a process that hosts at least one endpoint for a URL. 更多...
 

Public 类型

enum  FilterType : uint8_t { kFilterNone = 0 , kFilterAvailable = 1 , kFilterNative = 2 }
 Selects which announcements contribute to the live snapshot. 更多...
 
using Callback = Function< void(const std::vector< Info > &info_list)>
 Callback signature delivered whenever the snapshot changes. 更多...
 
 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. 更多...

Public 成员函数

 DiscoveryViewer (FilterType type=kFilterNone)
 Builds the viewer with the requested filter mode. 更多...
 
 ~DiscoveryViewer () override
 Stops the viewer loop and releases resources. 更多...
 
void register_callback (Callback &&callback)
 Registers the callback notified on every snapshot change. 更多...
 
std::vector< Infoget_info_list ()
 Returns a copy of the live snapshot at the moment of the call. 更多...
 
std::string get_ser_type (const std::string &url) const
 Resolves the announced serialisation type for url. 更多...
 
SchemaType get_schema_type (const std::string &url) const
 Resolves the announced coarse schema family for url. 更多...
 

静态 Public 成员函数

static ImplType convert_type (std::string_view str)
 Translates a discovery role token to the corresponding ImplType bit. 更多...
 
static std::string convert_type_to_view (uint32_t type)
 Formats an ImplType bitmask as a human-readable label. 更多...
 
static std::string convert_type_to_view (uint32_t type, const std::vector< Process > &process_list)
 Formats an ImplType bitmask together with its process list. 更多...
 
static std::string get_listen_address ()
 Returns the UDP multicast/broadcast address used by the discovery subsystem. 更多...
 

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. 更多...
 

详细描述

MessageLoop-based aggregator of live VLink endpoint announcements.

Construct with the desired filter and start with async_run(). Each viewer is explicitly owned by the caller; no process-global viewer is exposed. The viewer continuously rebuilds an Info list and notifies the registered callback every time the topology changes.

成员类型定义说明

◆ Callback

using vlink::DiscoveryViewer::Callback = Function<void(const std::vector<Info>& info_list)>

Callback signature delivered whenever the snapshot changes.

Invoked on the viewer's MessageLoop thread with the freshly built list.

成员枚举类型说明

◆ FilterType

Selects which announcements contribute to the live snapshot.

Value Effect
kFilterNone All announcements visible
kFilterAvailable Drop remote announcements for local-only URL schemes
kFilterNative Keep only announcements from the same host
枚举值
kFilterNone 

No filtering applied.

kFilterAvailable 

Drop remote announcements for local-only URL schemes.

kFilterNative 

Keep only same-host announcements.

构造及析构函数说明

◆ DiscoveryViewer()

vlink::DiscoveryViewer::DiscoveryViewer ( FilterType  type = kFilterNone)
explicit

Builds the viewer with the requested filter mode.

参数
typeFilter selecting which announcements survive (default: kFilterNone).

◆ ~DiscoveryViewer()

vlink::DiscoveryViewer::~DiscoveryViewer ( )
override

Stops the viewer loop and releases resources.

成员函数说明

◆ convert_type()

static ImplType vlink::DiscoveryViewer::convert_type ( std::string_view  str)
static

Translates a discovery role token to the corresponding ImplType bit.

参数
strRole token: "Ser", "Cli", "Pub", "Sub", "Set" or "Get".
返回
Matching ImplType, or 0 when the token is not recognised.

◆ convert_type_to_view() [1/2]

static std::string vlink::DiscoveryViewer::convert_type_to_view ( uint32_t  type)
static

Formats an ImplType bitmask as a human-readable label.

参数
typeImplType bitmask.
返回
Display string suitable for tooling output.

◆ convert_type_to_view() [2/2]

static std::string vlink::DiscoveryViewer::convert_type_to_view ( uint32_t  type,
const std::vector< Process > &  process_list 
)
static

Formats an ImplType bitmask together with its process list.

参数
typeImplType bitmask.
process_listProcesses to include in the display.
返回
Combined display string.

◆ get_info_list()

std::vector<Info> vlink::DiscoveryViewer::get_info_list ( )

Returns a copy of the live snapshot at the moment of the call.

返回
Vector of Info rows.

◆ get_listen_address()

static std::string vlink::DiscoveryViewer::get_listen_address ( )
static

Returns the UDP multicast/broadcast address used by the discovery subsystem.

◆ get_max_elapsed_time()

uint32_t vlink::DiscoveryViewer::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::DiscoveryViewer::get_max_task_count ( ) const
overrideprotectedvirtual

Returns the maximum queue depth.

返回
kMaxTaskSize (10000) by default.

重载 vlink::MessageLoop .

◆ get_schema_type()

SchemaType vlink::DiscoveryViewer::get_schema_type ( const std::string &  url) const

Resolves the announced coarse schema family for url.

参数
urlTopic URL.
返回
SchemaType, or SchemaType::kUnknown when unavailable.

◆ get_ser_type()

std::string vlink::DiscoveryViewer::get_ser_type ( const std::string &  url) const

Resolves the announced serialisation type for url.

参数
urlTopic URL.
返回
Announced serialisation type, or an empty string when unknown.

◆ on_begin()

void vlink::DiscoveryViewer::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::DiscoveryViewer::on_end ( )
overrideprotectedvirtual

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

Subclasses override to perform per-thread cleanup.

重载 vlink::MessageLoop .

◆ register_callback()

void vlink::DiscoveryViewer::register_callback ( Callback &&  callback)

Registers the callback notified on every snapshot change.

Replaces any previously installed callback; only the most recent registration remains effective.

参数
callbackFunction invoked with the new Info list.

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