#include <userver/ugrpc/server/server.hpp>
Manages the gRPC server.
All methods are thread-safe. Usually retrieved from ugrpc::server::ServerComponent.
Definition at line 109 of file server.hpp.
Public Types | |
| using | SetupHook = utils::function_ref<void(grpc::ServerBuilder&)> |
Public Member Functions | |
| Server (utils::ResourceScopeStorage &scope_storage, ServerConfig &&config, utils::statistics::Storage &statistics_storage) | |
| Start building the server. | |
| Server (Server &&)=delete | |
| Server & | operator= (Server &&)=delete |
| void | AddService (ServiceBase &service, ServiceConfig &&config) |
| Register a service implementation in the server. The user or the component is responsible for keeping service and middlewares alive at least until Stop is called. | |
| void | AddService (GenericServiceBase &service, ServiceConfig &&config) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::vector< std::string_view > | GetServiceNames () const |
| Get names of all registered services. | |
| void | WithServerBuilder (SetupHook setup) |
| For advanced configuration of the gRPC server. | |
| void | Start () |
| Start accepting requests. | |
| int | GetPort () const noexcept |
| void | Stop () noexcept |
| Stop accepting requests. Also destroys server statistics and closes the associated CompletionQueue. | |
| void | StopServing (std::optional< engine::Deadline > serving_shutdown_deadline=std::nullopt) noexcept |
| virtual std::uint64_t | GetTotalRequests () const =0 |
| using ugrpc::server::Server::SetupHook = utils::function_ref<void(grpc::ServerBuilder&)> |
Definition at line 111 of file server.hpp.
|
explicit |
Start building the server.
| scope_storage | see where to obtain scopes for an object. |
|
noexcept |
| void ugrpc::server::Server::Start | ( | ) |
Start accepting requests.
|
noexcept |
Stop accepting requests. Also destroys server statistics and closes the associated CompletionQueue.
|
noexcept |
Same as Stop, but:
| void ugrpc::server::Server::WithServerBuilder | ( | SetupHook | setup | ) |
For advanced configuration of the gRPC server.