|
VLink
2.0.0
A high-performance communication middleware
|
Topic-scoped fan-out store of NodeImpl peers and their callbacks.
更多...
#include <abstract_factory.h>
Public 类型 | |
| using | ImplList = std::unordered_set< NodeImpl * > |
Set of currently registered NodeImpl peers. 更多... | |
| using | ConnectCallbackMap = std::unordered_map< NodeImpl *, NodeImpl::ConnectCallback > |
| Connect handlers per impl. 更多... | |
| using | ReqRespCallbackMap = std::unordered_map< NodeImpl *, NodeImpl::ReqRespCallback > |
| Req/resp callbacks, keyed by impl. 更多... | |
| using | MsgCallbackMap = std::unordered_map< NodeImpl *, NodeImpl::MsgCallback > |
| Message callbacks, keyed by impl. 更多... | |
| using | IntraMsgCallbackMap = std::unordered_map< NodeImpl *, NodeImpl::IntraMsgCallback > |
| Intra-message callbacks. 更多... | |
| using | StatusCallbackMap = std::unordered_map< NodeImpl *, NodeImpl::StatusCallback > |
| Status callbacks per impl. 更多... | |
| using | FindConnectCallback = Function< void(NodeImpl *, const NodeImpl::ConnectCallback &)> |
| Visitor invoked for each connect entry. 更多... | |
| using | FindReqRespCallback = Function< void(NodeImpl *, const NodeImpl::ReqRespCallback &)> |
| Visitor invoked for each req/resp entry. 更多... | |
| using | FindMsgCallback = Function< void(NodeImpl *, const NodeImpl::MsgCallback &)> |
| Visitor invoked for each message entry. 更多... | |
| using | FindIntraMsgCallback = Function< void(NodeImpl *, const NodeImpl::IntraMsgCallback &)> |
| Visitor for each intra-message entry. 更多... | |
| using | FindStatusCallback = Function< void(NodeImpl *, const NodeImpl::StatusCallback &)> |
| Visitor invoked for each status entry. 更多... | |
Public 成员函数 | |
| bool | add_impl (NodeImpl *impl) |
Registers impl as an active peer on this topic. 更多... | |
| bool | remove_impl (NodeImpl *impl) |
Removes impl from the peer set and forgets every associated callback. 更多... | |
| NodeImpl * | get_first_impl () const |
| Returns the most recently registered peer. 更多... | |
| bool | is_contains_impl (NodeImpl *impl) const |
Tests whether impl is currently part of the peer set. 更多... | |
| bool | has_impl () const |
| Indicates whether at least one peer has been registered. 更多... | |
| bool | register_server_connect_callback (NodeImpl *impl, NodeImpl::ConnectCallback &&callback) |
Stores callback as the server-side connect handler for impl. 更多... | |
| bool | register_sub_connect_callback (NodeImpl *impl, NodeImpl::ConnectCallback &&callback) |
Stores callback as the subscriber-side connect handler for impl. 更多... | |
| bool | register_req_resp_callback (NodeImpl *impl, NodeImpl::ReqRespCallback &&callback) |
Stores callback as the request/response handler for impl. 更多... | |
| bool | register_msg_callback (NodeImpl *impl, NodeImpl::MsgCallback &&callback) |
Stores callback as the serialised-message handler for impl. 更多... | |
| bool | register_intra_msg_callback (NodeImpl *impl, NodeImpl::IntraMsgCallback &&callback) |
Stores callback as the intra-process message handler for impl. 更多... | |
| bool | register_status_callback (NodeImpl *impl, NodeImpl::StatusCallback &&callback) |
Stores callback as the transport-status handler for impl. 更多... | |
| bool | server_connect_map_is_empty () const |
| Reports whether the server-connect dictionary is empty. 更多... | |
| bool | sub_connect_map_is_empty () const |
| Reports whether the subscriber-connect dictionary is empty. 更多... | |
| bool | req_resp_map_is_empty () const |
| Reports whether the request/response dictionary is empty. 更多... | |
| bool | msg_map_is_empty () const |
| Reports whether the serialised-message dictionary is empty. 更多... | |
| bool | intra_msg_map_is_empty () const |
| Reports whether the intra-process message dictionary is empty. 更多... | |
| bool | status_map_is_empty () const |
| Reports whether the transport-status dictionary is empty. 更多... | |
| void | traverse_server_connect_callback (const FindConnectCallback &callback) |
Walks the server-connect dictionary and invokes callback for every entry. 更多... | |
| void | traverse_sub_connect_callback (const FindConnectCallback &callback) |
Walks the subscriber-connect dictionary and invokes callback for every entry. 更多... | |
| void | traverse_req_resp_callback (const FindReqRespCallback &callback) |
Walks the request/response dictionary and invokes callback for every entry. 更多... | |
| void | traverse_msg_callback (const FindMsgCallback &callback) |
Walks the serialised-message dictionary and invokes callback for every entry. 更多... | |
| void | traverse_intra_msg_callback (const FindIntraMsgCallback &callback) |
Walks the intra-process dictionary and invokes callback for every entry. 更多... | |
| void | traverse_status_callback (const FindStatusCallback &callback) |
Walks the transport-status dictionary and invokes callback for every entry. 更多... | |
Public 成员函数 继承自 vlink::AbstractNode | |
| virtual std::any | get_native_handle () const |
Returns the backend-native handle wrapped in an std::any. 更多... | |
Protected 成员函数 | |
| AbstractObject () | |
| ~AbstractObject () override | |
| bool | has_called () const |
| void | ignore_called () |
Protected 成员函数 继承自 vlink::AbstractNode | |
| AbstractNode () | |
| virtual | ~AbstractNode () |
Topic-scoped fan-out store of NodeImpl peers and their callbacks.
Holds the active NodeImpl pointer set together with the six callback dictionaries documented at file scope and serialises mutation, traversal and accounting through a std::recursive_mutex. The traversal helpers honour the ignore_called() escape hatch so that individual callbacks can opt out of the "any callback was invoked" accounting tracked by has_called().
| FilterT | Key type used by the owning AbstractFactory for this object. |
| using vlink::AbstractObject< FilterT >::ConnectCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::ConnectCallback> |
Connect handlers per impl.
| using vlink::AbstractObject< FilterT >::FindConnectCallback = Function<void(NodeImpl*, const NodeImpl::ConnectCallback&)> |
Visitor invoked for each connect entry.
| using vlink::AbstractObject< FilterT >::FindIntraMsgCallback = Function<void(NodeImpl*, const NodeImpl::IntraMsgCallback&)> |
Visitor for each intra-message entry.
| using vlink::AbstractObject< FilterT >::FindMsgCallback = Function<void(NodeImpl*, const NodeImpl::MsgCallback&)> |
Visitor invoked for each message entry.
| using vlink::AbstractObject< FilterT >::FindReqRespCallback = Function<void(NodeImpl*, const NodeImpl::ReqRespCallback&)> |
Visitor invoked for each req/resp entry.
| using vlink::AbstractObject< FilterT >::FindStatusCallback = Function<void(NodeImpl*, const NodeImpl::StatusCallback&)> |
Visitor invoked for each status entry.
| using vlink::AbstractObject< FilterT >::ImplList = std::unordered_set<NodeImpl*> |
Set of currently registered NodeImpl peers.
| using vlink::AbstractObject< FilterT >::IntraMsgCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::IntraMsgCallback> |
Intra-message callbacks.
| using vlink::AbstractObject< FilterT >::MsgCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::MsgCallback> |
Message callbacks, keyed by impl.
| using vlink::AbstractObject< FilterT >::ReqRespCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::ReqRespCallback> |
Req/resp callbacks, keyed by impl.
| using vlink::AbstractObject< FilterT >::StatusCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::StatusCallback> |
Status callbacks per impl.
|
inlineprotecteddefault |
|
inlineoverrideprotecteddefault |
|
inline |
Registers impl as an active peer on this topic.
Details
Inserts impl into impl_list_ and refreshes the cached first_impl_ pointer to the latest registrant. The operation is serialised against all other public methods.
| impl | Non-owning peer pointer to track. |
true when the pointer was newly inserted; false when it was already present. | NodeImpl * vlink::AbstractObject< FilterT >::get_first_impl |
Returns the most recently registered peer.
The "first" pointer follows the latest successful add_impl() call. After a matching remove_impl() the cache is repopulated with an arbitrary remaining peer, or nullptr if the set has been drained.
nullptr when no peer is registered.
|
inlineprotected |
|
inline |
Indicates whether at least one peer has been registered.
true when impl_list_ is non-empty.
|
inlineprotected |
|
inline |
Reports whether the intra-process message dictionary is empty.
true when no intra-message callbacks are registered.
|
inline |
Tests whether impl is currently part of the peer set.
| impl | Pointer to query. |
true when impl is registered, false otherwise.
|
inline |
Reports whether the serialised-message dictionary is empty.
true when no message callbacks are registered.
|
inline |
Stores callback as the intra-process message handler for impl.
| impl | Peer that owns callback. |
| callback | Callable void(const IntraData&) invoked for each in-process delivery. |
true on insertion; false when already registered.
|
inline |
Stores callback as the serialised-message handler for impl.
| impl | Peer that owns callback. |
| callback | Callable void(const Bytes&) invoked for every received message. |
true on insertion; false when already registered.
|
inline |
Stores callback as the request/response handler for impl.
| impl | Peer that owns callback. |
| callback | Callable invoked for every incoming RPC request. |
true on insertion; false when already registered.
|
inline |
Stores callback as the server-side connect handler for impl.
| impl | Peer that owns callback. |
| callback | Callable void(bool) invoked when a remote client comes or goes. |
true if the entry was inserted; false when one was already present.
|
inline |
Stores callback as the transport-status handler for impl.
| impl | Peer that owns callback. |
| callback | Callable invoked when the transport reports a status change. |
true on insertion; false when already registered.
|
inline |
Stores callback as the subscriber-side connect handler for impl.
| impl | Peer that owns callback. |
| callback | Callable void(bool) invoked when a subscriber appears or disappears. |
true if the entry was inserted; false when one was already present.
|
inline |
Removes impl from the peer set and forgets every associated callback.
Erases the pointer from impl_list_, reassigns first_impl_ if needed and drops the entry from all six callback dictionaries. Thread-safe.
| impl | Peer pointer previously passed to add_impl(). |
true if impl was found and removed; false otherwise.
|
inline |
Reports whether the request/response dictionary is empty.
true when no req/resp callbacks are registered.
|
inline |
Reports whether the server-connect dictionary is empty.
true when no server-connect callbacks are registered.
|
inline |
Reports whether the transport-status dictionary is empty.
true when no status callbacks are registered.
|
inline |
Reports whether the subscriber-connect dictionary is empty.
true when no subscriber-connect callbacks are registered.
|
inline |
Walks the intra-process dictionary and invokes callback for every entry.
| callback | Visitor receiving each peer pointer and its stored handler. |
|
inline |
Walks the serialised-message dictionary and invokes callback for every entry.
| callback | Visitor receiving each peer pointer and its stored handler. |
|
inline |
Walks the request/response dictionary and invokes callback for every entry.
| callback | Visitor receiving each peer pointer and its stored handler. |
|
inline |
Walks the server-connect dictionary and invokes callback for every entry.
Iteration is performed while holding the recursive mutex. Individual visits may call ignore_called() to keep the current entry from setting the has_called() flag; iteration carries on regardless.
| callback | Visitor receiving each peer pointer and its stored handler. |
|
inline |
Walks the transport-status dictionary and invokes callback for every entry.
| callback | Visitor receiving each peer pointer and its stored handler. |
|
inline |
Walks the subscriber-connect dictionary and invokes callback for every entry.
| callback | Visitor receiving each peer pointer and its stored handler. |