VLink  2.0.0
A high-performance communication middleware
server_impl.h File Reference

Transport-neutral base class for every method-model server implementation. More...

#include "./node_impl.h"
Include dependency graph for server_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vlink::ServerImpl
 Method-model server base shared by every transport implementation. More...
 

Namespaces

 

Detailed Description

Transport-neutral base class for every method-model server implementation.

This is an internal implementation header used by the public Server template; applications should depend on server.h. ServerImpl extends NodeImpl with the responder-side bookkeeping: it tracks whether a listen() callback has been installed, whether a response is expected and whether the reply is delivered synchronously inside the request callback or asynchronously via reply().

ImplType
The constructor stamps impl_type with kServer, advertising the role to discovery and recording layers.
Lifecycle
  • Construction stamps the impl type.
  • The public Server template calls listen() once the user installs a request handler; is_listened becomes true on success.
  • init() / deinit() inherited from NodeImpl bring the transport up.
  • Synchronous mode writes the response into the buffer supplied to the handler; asynchronous mode requires a later reply() call.
Role table
Capability Provider
Request callback registration Subclass override of listen()
Client presence query Subclass override of has_clients() (optional)
Deferred response delivery Subclass override of reply() for async transports
Sync / async behaviour flags is_resp_type / is_sync_type (set by public layer)
Internal API contract
Method Default Subclass duty
listen(ReqRespCallback&&) Pure virtual Bind transport receiver
has_clients() const Returns false Report client presence
reply(req_id, bytes, is_sync) Warns on async path Implement deferred reply