|
TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
|
Base class for actor-style gRPC servers. More...
#include <tec_grpc_server.hpp>
Public Types | |
| typedef TParams | Params |
| Configuration parameters type. | |
| typedef Traits::Service | Service |
| gRPC service type | |
| typedef Traits::RpcServer | RpcServer |
| running server instance type | |
| typedef Traits::Builder | Builder |
| server builder type | |
| typedef Traits::Credentials | Credentials |
| server credentials type | |
| typedef Traits::CompressionAlgorithm | CompressionAlgorithm |
| compression algorithm enum | |
| typedef Traits::CompressionLevel | CompressionLevel |
| compression level enum | |
Public Member Functions | |
| GrpcServer (const Params ¶ms, const std::shared_ptr< Credentials > &credentials) | |
| Constructs a GrpcServer instance. | |
| virtual | ~GrpcServer ()=default |
| Virtual destructor (defaulted) | |
| Status | process_request (Request, Reply) override |
| Synchronous request processor (optional override). | |
| void | start (Signal *sig_started, Status *status) override |
| Starts the gRPC server and begins listening. | |
| void | shutdown (Signal *sig_stopped) override |
| Initiates graceful shutdown of the server. | |
Public Member Functions inherited from tec::Actor | |
| Actor ()=default | |
| Default constructor. | |
| Actor (const Actor &)=delete | |
| Deleted copy constructor. | |
| Actor (Actor &&)=delete | |
| Deleted move constructor. | |
| Actor & | operator= (const Actor &)=delete |
| Deleted copy assignment operator. | |
| Actor & | operator= (Actor &&)=delete |
| Deleted move assignment operator. | |
| virtual | ~Actor ()=default |
| Virtual destructor. | |
| virtual Status | run () |
| Mimics Daemon's behavior. | |
| virtual Status | terminate () |
| Mimics Daemon's behavior. | |
Protected Member Functions | |
| virtual void | set_plugins () |
| Configures optional gRPC server plugins (reflection, health checking). | |
| virtual void | set_builder_options (Builder &builder) |
Configures server-wide options on the ServerBuilder. | |
Protected Attributes | |
| Params | params_ |
| Runtime configuration parameters (listen address, message size, compression, plugins…) | |
| std::unique_ptr< RpcServer > | server_ |
Owned server instance — created and started during start() | |
| std::shared_ptr< Credentials > | credentials_ |
| Server-side credentials (insecure / SSL / custom) | |
Base class for actor-style gRPC servers.
Provides common infrastructure for:
Concrete servers should inherit from this class and implement process_request() if synchronous request handling is needed, or override start() / use async service registration patterns.
| TParams | User-defined parameter structure (must derive from GrpcServerParams) |
| Traits | Instance of grpc_server_traits<...> defining all gRPC-related types |
|
inline |
Constructs a GrpcServer instance.
| params | Server configuration (listen address, limits, compression…) |
| credentials | Server-side credentials (for TLS or other authentication) |
|
inlineoverridevirtual |
Synchronous request processor (optional override).
Default implementation returns NotImplemented. May be overridden in derived classes that implement a synchronous service pattern.
| request | Input request |
| reply | Output reply (to be filled) |
Implements tec::Actor.
|
inlineprotectedvirtual |
Configures server-wide options on the ServerBuilder.
Called automatically during start(). Sets maximum message sizes and default compression settings according to values in params_.
Can be overridden in derived classes to set additional builder options (e.g. keep-alive, resource quotas, custom interceptors, etc.).
| builder | The ServerBuilder instance being configured |
|
inlineprotectedvirtual |
Configures optional gRPC server plugins (reflection, health checking).
Called automatically during start(). Enables server reflection and/or gRPC health checking if the corresponding builder functions were provided in params_.
Can be overridden in derived classes to register additional interceptors, authentication/authorization plugins, etc.
|
inlineoverridevirtual |
Initiates graceful shutdown of the server.
Triggers server shutdown (stops accepting new connections, allows existing RPCs to finish within deadline).
| sig_stopped | Signal to set when shutdown procedure has been completed |
Implements tec::Actor.
|
inlineoverridevirtual |
Starts the gRPC server and begins listening.
Sequence:
ServerBuilder| sig_started | Signal to set when server is successfully listening |
| status | [out] Startup result status |
Implements tec::Actor.