VLink  2.0.0
A high-performance communication middleware
discovery_viewer.h 文件参考

Live aggregator of VLink endpoint announcements emitted by DiscoveryReporter. 更多...

#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include "../base/functional.h"
#include "../base/macros.h"
#include "../base/message_loop.h"
#include "../impl/types.h"
discovery_viewer.h 的引用(Include)关系图:

浏览源代码.

class  vlink::DiscoveryViewer
 MessageLoop-based aggregator of live VLink endpoint announcements. 更多...
 
struct  vlink::DiscoveryViewer::Process
 Identity of a process that hosts at least one endpoint for a URL. 更多...
 
struct  vlink::DiscoveryViewer::Info
 One row of the discovery snapshot, describing a URL and its publishers/subscribers. 更多...
 

命名空间

 

详细描述

Live aggregator of VLink endpoint announcements emitted by DiscoveryReporter.

DiscoveryViewer is the listening counterpart of DiscoveryReporter. It joins the discovery UDP multicast group, decodes incoming announcements, and maintains an in-memory snapshot of every URL/process currently advertised on the host or network. It powers vlink-cli, dashboards and any custom monitoring tool that needs a live topology view.

Filter modes select which announcements survive into the snapshot:

Value Description
kFilterNone Keep every announcement regardless of origin
kFilterAvailable Drop remote announcements for local-only URL schemes (intra, shm, ...)
kFilterNative Keep only announcements emitted by the same host as the viewer

Viewer interaction:

*   DiscoveryReporter --(UDP multicast)--> +----------------+    Callback(info_list)
*                                          |    Viewer      | ---------------------> user code
*   Heartbeat timeout         ----+--->    |  (MessageLoop) | <--- get_info_list()
*   process_offline()         ----+--->    +----------------+
* 
Example
viewer.register_callback([](const std::vector<vlink::DiscoveryViewer::Info>& list) {
for (const auto& entry : list) {
VLOG_I("url=", entry.url, " ser=", entry.ser_type,
" hosts=", entry.process_list.size());
}
});
viewer.async_run();
#define VLOG_I(...)
Definition: logger.h:785
注解
The callback runs on the viewer's MessageLoop thread; copy the snapshot if it needs to outlive the call. Endpoints whose heartbeat lapses are pruned automatically.