userver: userver/ugrpc/server/service_base.hpp Source File
Loading...
Searching...
No Matches
service_base.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/ugrpc/server/service_base.hpp
4/// @brief @copybrief ugrpc::server::ServiceBase
5
6#include <userver/engine/task/task_processor_fwd.hpp>
7
8#include <userver/ugrpc/server/impl/service_worker.hpp>
9#include <userver/ugrpc/server/middlewares/fwd.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace ugrpc::server {
14
15/// Per-service settings
16struct ServiceConfig final {
17 /// TaskProcessor to use for serving RPCs.
18 engine::TaskProcessor& task_processor;
19
20 /// Server middlewares to use for the gRPC service.
22};
23
24/// @brief The type-erased base class for all gRPC service implementations
25/// @note User-defined services should inherit from code-generated base service
26/// classes, not from this class directly.
28 public:
29 ServiceBase& operator=(ServiceBase&&) = delete;
30 virtual ~ServiceBase();
31
32 /// @cond
33 // Creates a worker that forwards requests to this service.
34 // The service must be destroyed after the worker.
35 // For internal use only.
36 virtual std::unique_ptr<impl::ServiceWorker> MakeWorker(
37 impl::ServiceSettings&& settings) = 0;
38 /// @endcond
39};
40
41} // namespace ugrpc::server
42
43USERVER_NAMESPACE_END