|
VLink
2.0.0
A high-performance communication middleware
|
Caller-side primitive of the VLink method (RPC) communication model. More...
#include <chrono>#include <future>#include <memory>#include <mutex>#include <optional>#include <string>#include <type_traits>#include <unordered_map>#include "./base/functional.h"#include "./impl/client_impl.h"#include "./node.h"#include "./internal/client-inl.h"Go to the source code of this file.
Classes | |
| class | vlink::Client< ReqT, RespT, SecT > |
| Type-safe RPC caller for the VLink method communication model. More... | |
| class | vlink::SecurityClient< ReqT, RespT > |
Convenience alias of Client with per-message encryption enabled. More... | |
Namespaces | |
| vlink | |
Caller-side primitive of the VLink method (RPC) communication model.
Client<ReqT, RespT, SecT> issues remote calls to a matching Server. The request is serialised with the codec selected at compile time, sent via the active transport back-end, and (when RespT != EmptyType) the response payload is decoded back into a RespT instance and handed to the caller through one of several invocation styles.
The class is a thin, header-only template wrapper around ClientImpl with additional bookkeeping for std::future-based async invocations.
* Client<Req,Resp> Transport Back-end Server<Req,Resp> * ----------------- ------------------ ----------------- * | invoke(req) | | * |----------------------------->| serialised request | * | |--------------------------->| * | | | user handler * | | | fills resp * | | | * | | serialised response | * | |<---------------------------| * | deserialised response | | * |<-----------------------------| | *
| Method | Blocking | Result delivery | When to use |
|---|---|---|---|
invoke(req, resp&, timeout) | Yes | Out-param + bool | Classic synchronous call |
invoke(req, timeout) | Yes | std::optional | Synchronous, no out-param |
invoke(req, RespCallback) | No | Callback | Async with handler |
async_invoke(req) | No | std::future | Future / promise model |
send(req) | No | None | Fire-and-forget request |
timeout of 0 is treated as infinite and logs a warning. send() is only available when RespT == EmptyType, and the response-bearing overloads are only available when kHasResp is true (enforced by static_assert in the response-bearing entry points; the std::optional -returning overload inherits the constraint by delegating to the out-parameter invoke).