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/call_context.hpp>
9#include <userver/ugrpc/server/impl/service_worker.hpp>
10#include <userver/ugrpc/server/middlewares/fwd.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace ugrpc::server {
15
16/// Per-service settings
17struct ServiceConfig final {
18 /// TaskProcessor to use for serving RPCs.
20
21 /// Server middlewares to use for the gRPC service.
23};
24
25/// @brief The type-erased base class for all gRPC service implementations
26/// @note User-defined services should inherit from code-generated base service
27/// classes, not from this class directly.
29public:
30 using CallContext = ugrpc::server::CallContext;
31
32 ServiceBase& operator=(ServiceBase&&) = delete;
33 virtual ~ServiceBase();
34
35 /// @cond
36 // Creates a worker that forwards requests to this service.
37 // The service must be destroyed after the worker.
38 // For internal use only.
39 virtual std::unique_ptr<impl::ServiceWorker> MakeWorker(impl::ServiceSettings&& settings) = 0;
40 /// @endcond
41};
42
43} // namespace ugrpc::server
44
45USERVER_NAMESPACE_END