@@ -30,6 +30,7 @@ class TJsonLocalRpc : public TViewerPipeClient {
30
30
31
31
protected:
32
32
using TBase::ReplyAndPassAway;
33
+ using TRequestProtoType = TProtoRequest;
33
34
std::vector<HTTP_METHOD> AllowedMethods = {};
34
35
TAutoPtr<TEvLocalRpcPrivate::TEvGrpcRequestResult<TProtoResult>> Result;
35
36
NThreading::TFuture<TProtoResponse> RpcFuture;
@@ -40,10 +41,10 @@ class TJsonLocalRpc : public TViewerPipeClient {
40
41
}
41
42
42
43
TJsonLocalRpc (IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
43
- : TBase(viewer, ev, TProtoRequest ::descriptor()->name ())
44
+ : TBase(viewer, ev, TRequestProtoType ::descriptor()->name ())
44
45
{}
45
46
46
- void Params2Proto (const TCgiParameters& params, TProtoRequest & request) {
47
+ void Params2Proto (const TCgiParameters& params, TRequestProtoType & request) {
47
48
using google::protobuf::Descriptor;
48
49
using google::protobuf::Reflection;
49
50
using google::protobuf::FieldDescriptor;
@@ -95,12 +96,12 @@ class TJsonLocalRpc : public TViewerPipeClient {
95
96
}
96
97
}
97
98
98
- bool ValidateProto (TProtoRequest & request) {
99
+ virtual bool ValidateRequest (TRequestProtoType & request) {
99
100
using google::protobuf::Descriptor;
100
101
using google::protobuf::Reflection;
101
102
using google::protobuf::FieldDescriptor;
102
- const Descriptor& descriptor = *TProtoRequest ::GetDescriptor ();
103
- const Reflection& reflection = *TProtoRequest ::GetReflection ();
103
+ const Descriptor& descriptor = *TRequestProtoType ::GetDescriptor ();
104
+ const Reflection& reflection = *TRequestProtoType ::GetReflection ();
104
105
for (int idx = 0 ; idx < descriptor.field_count (); ++idx) {
105
106
const FieldDescriptor* field = descriptor.field (idx);
106
107
const auto & options (field->options ());
@@ -116,7 +117,7 @@ class TJsonLocalRpc : public TViewerPipeClient {
116
117
return true ;
117
118
}
118
119
119
- bool Params2Proto (TProtoRequest & request) {
120
+ bool Params2Proto (TRequestProtoType & request) {
120
121
auto postData = Event->Get ()->Request .GetPostContent ();
121
122
if (!postData.empty ()) {
122
123
try {
@@ -130,13 +131,13 @@ class TJsonLocalRpc : public TViewerPipeClient {
130
131
const auto & params (Event->Get ()->Request .GetParams ());
131
132
Params2Proto (params, request);
132
133
}
133
- if (!ValidateProto (request)) {
134
+ if (!ValidateRequest (request)) {
134
135
return false ;
135
136
}
136
137
return true ;
137
138
}
138
139
139
- void SendGrpcRequest (TProtoRequest && request) {
140
+ void SendGrpcRequest (TRequestProtoType && request) {
140
141
// TODO(xenoxeno): pass trace id
141
142
RpcFuture = NRpcService::DoLocalRpc<TRpcEv>(std::move (request), Database, Event->Get ()->UserToken , TlsActivationContext->ActorSystem ());
142
143
RpcFuture.Subscribe ([actorId = TBase::SelfId (), actorSystem = TlsActivationContext->ActorSystem ()]
@@ -173,7 +174,7 @@ class TJsonLocalRpc : public TViewerPipeClient {
173
174
if (TBase::NeedToRedirect ()) {
174
175
return ;
175
176
}
176
- TProtoRequest request;
177
+ TRequestProtoType request;
177
178
if (!Params2Proto (request)) {
178
179
return ;
179
180
}
0 commit comments