aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/services/console/grpc_service.cpp
blob: c77c9d745ea774b8f5a4a09f4dcabc2e4cbec920 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "grpc_service.h"

#include <ydb/core/grpc_services/service_console.h>
#include <ydb/core/grpc_services/grpc_helper.h>
#include <ydb/core/grpc_services/base/base.h>

namespace NKikimr {
namespace NGRpcService {

void TGRpcConsoleService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
    auto getCounterBlock = CreateCounterCb(Counters_, ActorSystem_);
    using namespace Ydb;

#ifdef ADD_REQUEST
#error ADD_REQUEST macro already defined
#endif
#define ADD_REQUEST(NAME, CB)                                                                         \
    MakeIntrusive<TGRpcRequest<Console::NAME##Request, Console::NAME##Response, TGRpcConsoleService>> \
        (this, &Service_, CQ_,                                                                        \
            [this](NGrpc::IRequestContextBase *ctx) {                                                 \
                NGRpcService::ReportGrpcReqToMon(*ActorSystem_, ctx->GetPeer());                      \
                ActorSystem_->Send(GRpcRequestProxyId_,                                               \
                    new TGrpcRequestOperationCall<Console::NAME##Request, Console::NAME##Response>    \
                        (ctx, &CB, TRequestAuxSettings{RLSWITCH(TRateLimiterMode::Rps), nullptr}));   \
            }, &Console::V1::ConsoleService::AsyncService::Request ## NAME,                           \
            #NAME, logger, getCounterBlock("console", #NAME))->Run();

    ADD_REQUEST(ApplyConfig, DoApplyConfigRequest)
    ADD_REQUEST(AddVolatileConfig, DoAddVolatileConfigRequest)
    ADD_REQUEST(RemoveVolatileConfig, DoRemoveVolatileConfigRequest)
    ADD_REQUEST(GetConfig, DoGetConfigRequest)
    ADD_REQUEST(ResolveConfig, DoResolveConfigRequest)
    ADD_REQUEST(ResolveAllConfig, DoResolveAllConfigRequest)

#undef ADD_REQUEST
}

} // namespace NGRpcService
} // namespace NKikimr