9#include <userver/components/component_base.hpp>
10#include <userver/utils/function_ref.hpp>
12#include <userver/ugrpc/server/middlewares/fwd.hpp>
13#include <userver/ugrpc/server/rpc.hpp>
15USERVER_NAMESPACE_BEGIN
20class MiddlewareCallContext
final {
23 MiddlewareCallContext(
const Middlewares& middlewares,
CallAnyBase& call,
24 utils::function_ref<
void()> user_call,
25 const dynamic_config::Snapshot& config,
26 ::google::protobuf::Message* request);
40 void ClearMiddlewaresResources();
42 Middlewares::const_iterator middleware_;
43 Middlewares::const_iterator middleware_end_;
44 utils::function_ref<
void()> user_call_;
48 std::optional<dynamic_config::Snapshot> config_;
49 ::google::protobuf::Message* request_;
50 bool is_called_from_handle_{
false};
63 virtual ~MiddlewareBase();
68 virtual void Handle(MiddlewareCallContext& context)
const = 0;
72 google::protobuf::Message& request);
76 google::protobuf::Message& response);