aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/services/discovery/grpc_service.h
blob: cd4cc7e569c404e0503d1857521fca993cd266c7 (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
#pragma once

#include <library/cpp/actors/core/actorsystem.h> 

#include <ydb/public/api/grpc/ydb_discovery_v1.grpc.pb.h>

#include <library/cpp/grpc/server/grpc_server.h>

namespace NKikimr {
namespace NGRpcService {

 class TGRpcDiscoveryService
     : public NGrpc::TGrpcServiceBase<Ydb::Discovery::V1::DiscoveryService>
 {
 public:
     TGRpcDiscoveryService(NActors::TActorSystem* system,
                     TIntrusivePtr<NMonitoring::TDynamicCounters> counters,
                     NActors::TActorId id);

     void InitService(grpc::ServerCompletionQueue* cq, NGrpc::TLoggerPtr logger) override;
     void SetGlobalLimiterHandle(NGrpc::TGlobalLimiter* limiter) override;

     bool IncRequest();
     void DecRequest();

  private:
     void SetupIncomingRequests(NGrpc::TLoggerPtr logger);

     NActors::TActorSystem* ActorSystem_;
     grpc::ServerCompletionQueue* CQ_ = nullptr;

     TIntrusivePtr<NMonitoring::TDynamicCounters> Counters_;
     NActors::TActorId GRpcRequestProxyId_;
     NGrpc::TGlobalLimiter* Limiter_ = nullptr;
 };

} // namespace NGRpcService
} // namespace NKikimr