A thin wrapper that runs gRPC services next to an Orbit App.
More...
#include <GrpcServer.hpp>
|
| | GrpcServer () |
| |
| | ~GrpcServer () |
| |
| void | add_service (grpc::Service *service) |
| | Registers a service; it must outlive the server. Call before start().
|
| |
| void | start (const std::string &address) |
| |
| int | port () const |
| | The port listened on once started, e.g. the one chosen for port 0.
|
| |
| void | stop () |
| |
A thin wrapper that runs gRPC services next to an Orbit App.
- Warning
- Experimental. It is a minimal pass-through to grpc::ServerBuilder (insecure credentials only, no TLS, no options) and is not covered by the main CI matrix; see issue #22. Build with -DORBIT_ENABLE_GRPC=ON. Without it, add_service() and start() throw, rather than pretending to serve.
gRPC enables SO_REUSEPORT on Linux, so two servers (or two processes, as during App::hot_reload()) can listen on the same address and share its connections.
◆ GrpcServer()
| orbit::server::GrpcServer::GrpcServer |
( |
| ) |
|
◆ ~GrpcServer()
| orbit::server::GrpcServer::~GrpcServer |
( |
| ) |
|
◆ add_service()
| void orbit::server::GrpcServer::add_service |
( |
grpc::Service * |
service | ) |
|
Registers a service; it must outlive the server. Call before start().
◆ port()
| int orbit::server::GrpcServer::port |
( |
| ) |
const |
|
inline |
The port listened on once started, e.g. the one chosen for port 0.
◆ start()
| void orbit::server::GrpcServer::start |
( |
const std::string & |
address | ) |
|
Starts serving on address ("host:port"; port 0 picks a free one).
- Exceptions
-
| std::runtime_error | if the server could not be started. |
◆ stop()
| void orbit::server::GrpcServer::stop |
( |
| ) |
|
◆ port_
| int orbit::server::GrpcServer::port_ = 0 |
|
private |
The documentation for this class was generated from the following file: