|
VLink
2.0.0
A high-performance communication middleware
|
Connection-aware base class for method-model client implementations. 更多...
#include <client_impl.h>
Public 成员函数 | |
| ~ClientImpl () override | |
| Releases the helper state held by the base class. 更多... | |
| void | interrupt () override |
Wakes blocked waiters and forwards the interrupt to NodeImpl. 更多... | |
| virtual void | detect_connected (ConnectCallback &&callback) |
Registers callback to fire whenever the server presence changes. 更多... | |
| virtual bool | wait_for_connected (std::chrono::milliseconds timeout) |
Blocks until a server becomes reachable or timeout elapses. 更多... | |
| virtual bool | is_connected () const =0 |
| Reports whether the transport currently holds a path to a server. 更多... | |
| virtual bool | call (const Bytes &req_data, MsgCallback &&callback, std::chrono::milliseconds timeout)=0 |
| Performs a synchronous round-trip with the remote server. 更多... | |
| void | update_connected () |
| Notifies the base class that the underlying connection state may have changed. 更多... | |
Public 成员函数 继承自 vlink::NodeImpl | |
| virtual void | init ()=0 |
| Brings the underlying transport channel online. 更多... | |
| virtual void | deinit ()=0 |
| Tears the underlying transport channel down. 更多... | |
| virtual bool | suspend () |
| Pauses message delivery without releasing the channel. 更多... | |
| virtual bool | resume () |
Resumes message delivery after suspend(). 更多... | |
| virtual bool | is_suspend () const |
| Reports whether the node is currently suspended. 更多... | |
| virtual bool | is_support_loan () const |
| Indicates whether zero-copy loaning is available on this backend. 更多... | |
| virtual Bytes | loan (int64_t size) |
Borrows a write buffer of size bytes from the transport. 更多... | |
| virtual bool | return_loan (const Bytes &bytes) |
| Returns a previously loaned buffer to the transport. 更多... | |
| virtual void | set_manual_unloan (bool manual_unloan) |
| Toggles automatic versus manual release of received loaned buffers. 更多... | |
| virtual const struct Conf * | get_conf () const |
Returns the associated transport Conf, or nullptr in the base. 更多... | |
| virtual const AbstractNode * | get_abstract_node () const |
Returns the companion AbstractNode, when the impl is split. 更多... | |
| virtual Status::BasePtr | get_status (Status::Type type) const |
| Retrieves a transport-specific status object. 更多... | |
| virtual bool | check_version (const Version &version) |
Compares version with the runtime VLink library version. 更多... | |
| virtual bool | attach (class MessageLoop *message_loop) |
Attaches the node to a MessageLoop for callback dispatch. 更多... | |
| virtual bool | detach () |
Detaches the node from its MessageLoop. 更多... | |
| class MessageLoop * | get_message_loop () const |
Returns the currently attached MessageLoop. 更多... | |
| template<typename T > | |
| const T * | get_target_conf () const |
Convenience downcast wrapper around get_conf(). 更多... | |
| void | register_status_handler (StatusCallback &&callback) |
| Installs a DDS-family status handler. 更多... | |
| bool | has_register_status () const |
| Reports whether a status handler has been registered. 更多... | |
| void | call_status (Status::BasePtr ptr) |
| Delivers a status notification to the registered handler. 更多... | |
| void | set_property (const std::string &prop, const std::string &value) |
| Sets a named property on this node. 更多... | |
| std::string | get_property (const std::string &prop) const |
| Retrieves the value of a named property. 更多... | |
| Conf::PropertiesMap | get_all_properties () const |
| Returns a copy of every property currently set on this node. 更多... | |
| void | set_discovery_enabled (bool enable) |
| Toggles whether this node is reported to the discovery layer. 更多... | |
| bool | get_discovery_enabled () const |
| Returns the current discovery-reporting flag. 更多... | |
| void | set_record_path (const std::string &path) |
| Configures per-node message recording. 更多... | |
| bool | enable_security (const Security::Config &cfg) |
| Installs application-layer security from a const-reference config. 更多... | |
| bool | enable_security (Security::Config &&cfg) |
Installs application-layer security by consuming cfg. 更多... | |
| void | set_ssl_options (const SslOptions &options) |
| Merges SSL options into the node property map. 更多... | |
| void | try_record (ActionType action_type, const Bytes &data) |
| Records a message to the global and / or per-node bag writers. 更多... | |
| void | reset_interrupted () |
Clears the interrupted flag set by interrupt(). 更多... | |
| bool | is_interrupted () const |
Reports whether interrupt() has been called and not yet reset. 更多... | |
| void | init_ext () |
| Registers the node with the runtime-owned discovery reporter. 更多... | |
| void | deinit_ext () |
| Deregisters the node from the runtime-owned discovery reporter. 更多... | |
Public 属性 | |
| bool | is_resp_type {false} |
true when the public Client expects a response payload. 更多... | |
Public 属性 继承自 vlink::NodeImpl | |
| std::string | url |
Full URL string of the node, e.g. "dds://my/topic". 更多... | |
| std::string | ser_type |
Concrete serialisation type tag (e.g. "demo.proto.PointCloud"). 更多... | |
| ImplType | impl_type {kUnknownImplType} |
| Role of this implementation node. 更多... | |
| SchemaType | schema_type {SchemaType::kUnknown} |
| Coarse schema family reported to discovery and bag / proxy paths. 更多... | |
| TransportType | transport_type {TransportType::kUnknown} |
| Transport backend identifier for this node. 更多... | |
| bool | is_cdr_type {false} |
true when DDS native CDR serialisation is in use. 更多... | |
| bool | is_security_type {false} |
true when an authenticated transport is enabled. 更多... | |
| bool | is_discovery_enabled {true} |
| Whether the node is reported to the discovery layer. 更多... | |
| std::atomic_bool | has_suspend {false} |
| Atomic suspend flag (currently unused by the default impls). 更多... | |
| std::unique_ptr< CpuProfiler > | profiler |
| Optional per-node CPU profiler activated under global profiling. 更多... | |
| std::unique_ptr< Security > | security |
Installed per-node message-security context, or nullptr. 更多... | |
Protected 成员函数 | |
| ClientImpl () | |
Stamps the node as kClient and prepares the helper state. 更多... | |
Protected 成员函数 继承自 vlink::NodeImpl | |
| NodeImpl (ImplType type) | |
| virtual | ~NodeImpl () |
额外继承的成员函数 | |
Public 类型 继承自 vlink::NodeImpl | |
| using | ConnectCallback = Function< void(bool)> |
| Callback fired when peer presence changes. 更多... | |
| using | StatusCallback = Function< void(const Status::BasePtr &ptr)> |
| Callback fired on DDS-family status notifications (e.g. deadline missed). 更多... | |
| using | SyncCallback = Function< void()> |
Callback fired when a SetterImpl completes a late-getter sync. 更多... | |
| using | ReqRespCallback = Function< void(uint64_t, const Bytes &, Bytes *)> |
Request / response handler installed by ServerImpl::listen(). 更多... | |
| using | MsgCallback = Function< void(const Bytes &)> |
| Callback delivering a serialised payload to a subscriber or getter. 更多... | |
| using | IntraMsgCallback = Function< void(const IntraData &)> |
| Callback delivering an in-process payload to an intra:// subscriber. 更多... | |
静态 Public 成员函数 继承自 vlink::NodeImpl | |
| static void | global_init () |
| Initialises process-wide VLink singletons. 更多... | |
Connection-aware base class for method-model client implementations.
Owns the helper condition variable used by wait_for_connected() and the cached ConnectCallback delivered via detect_connected(). Backends are expected to push presence updates by calling update_connected() whenever the discovery layer reports a server appear / disappear event.
|
override |
Releases the helper state held by the base class.
|
protected |
Stamps the node as kClient and prepares the helper state.
|
pure virtual |
Performs a synchronous round-trip with the remote server.
Pure virtual; subclasses send req_data, wait for the matching response (typically through AckManager) and invoke callback with the received bytes once a frame arrives.
| req_data | Serialised request payload. |
| callback | Callable void(const Bytes&) receiving the response bytes. |
| timeout | Maximum wait duration; negative for unlimited. |
true on success; false on timeout, interruption or transport error.
|
virtual |
Registers callback to fire whenever the server presence changes.
If the connection is already established at registration time, callback is invoked with true before this method returns. Subsequent transitions are forwarded by update_connected().
| callback | Callable void(bool) to be notified on connect / disconnect. |
|
overridevirtual |
Wakes blocked waiters and forwards the interrupt to NodeImpl.
Marks the node interrupted, notifies the helper condition variable so any wait_for_connected() call returns false promptly, and delegates the rest of the shutdown handshake to NodeImpl::interrupt(). Transport subclasses commonly override this to also cancel pending AckManager requests.
重载 vlink::NodeImpl .
|
pure virtual |
Reports whether the transport currently holds a path to a server.
Pure virtual; subclasses query their underlying discovery handle. Called by both wait_for_connected() and update_connected() to compute state transitions.
true when a server is reachable; false otherwise. | void vlink::ClientImpl::update_connected | ( | ) |
Notifies the base class that the underlying connection state may have changed.
Compares is_connected() against the helper cache; when the value flips the condition variable is signalled and any registered ConnectCallback is delivered. Intended to run on the transport's discovery / listener thread, not on the application thread.
|
virtual |
Blocks until a server becomes reachable or timeout elapses.
Returns immediately when is_connected() already reports true. Otherwise sleeps on the helper condition variable that is poked by update_connected() and by interrupt(). A negative timeout, such as Timeout::kInfinite, disables the deadline.
| timeout | Maximum sleep duration. |
true when the server appeared in time; false on timeout or interruption. | bool vlink::ClientImpl::is_resp_type {false} |
true when the public Client expects a response payload.