|
VLink
2.0.0
A high-performance communication middleware
|
Method-model server base shared by every transport implementation. 更多...
#include <server_impl.h>
Public 成员函数 | |
| ~ServerImpl () override | |
| Releases backend resources. 更多... | |
| virtual bool | listen (ReqRespCallback &&callback)=0 |
| Registers the request / response handler. 更多... | |
| virtual bool | has_clients () const |
| Reports whether at least one client is currently connected. 更多... | |
| virtual bool | reply (uint64_t req_id, const Bytes &resp_data, bool is_sync) |
| Sends a response for a previously received request. 更多... | |
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 void | interrupt () |
| Marks the node interrupted and wakes blocking operations. 更多... | |
| 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_listened {false} |
true once listen() has been registered successfully. 更多... | |
| bool | is_resp_type {false} |
true when the server is expected to produce a response. 更多... | |
| bool | is_sync_type {false} |
true when the reply is delivered inside the request callback. 更多... | |
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 成员函数 | |
| ServerImpl () | |
Stamps the node as kServer. 更多... | |
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. 更多... | |
Method-model server base shared by every transport implementation.
Backends override listen() to bind the supplied callback to the transport receive path and, where supported, override has_clients() and reply() to expose client discovery and asynchronous responses respectively.
|
override |
Releases backend resources.
|
protected |
Stamps the node as kServer.
|
virtual |
Reports whether at least one client is currently connected.
Default returns false. Backends that expose matched-publication discovery override the method.
true when one or more clients are reachable.
|
pure virtual |
Registers the request / response handler.
Pure virtual. The callback is invoked for every incoming RPC with the request bytes and a unique req_id; the handler writes the response into *resp_data, or receives nullptr in fire-and-forget mode. The owning Server marks is_listened to true once this method succeeds.
| callback | Callable void(uint64_t req_id, const Bytes& req_data, Bytes* resp_data). |
true on success; false on registration error.
|
virtual |
Sends a response for a previously received request.
Used in asynchronous server mode (is_sync_type == false) when the response is produced after the request callback returns. The base implementation warns when is_sync is false and always returns false; backends that support deferred replies override the method.
| req_id | Identifier supplied to the request callback. |
| resp_data | Serialised response payload. |
| is_sync | true when called synchronously inside the request callback. |
true on success; false otherwise. | bool vlink::ServerImpl::is_listened {false} |
true once listen() has been registered successfully.
| bool vlink::ServerImpl::is_resp_type {false} |
true when the server is expected to produce a response.
| bool vlink::ServerImpl::is_sync_type {false} |
true when the reply is delivered inside the request callback.