blob: 322dc99146729de60f6eb35cc41e6df605f9b83b (
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
40
41
42
43
44
45
|
#pragma once
#include "public.h"
namespace NYT::NRpc {
////////////////////////////////////////////////////////////////////////////////
struct IDiscoverRequestHook
: public TRefCounted
{
virtual void EnrichRequest(NProto::TReqDiscover* request) const = 0;
virtual void HandleResponse(NProto::TRspDiscover* response) const = 0;
};
DEFINE_REFCOUNTED_TYPE(IDiscoverRequestHook);
////////////////////////////////////////////////////////////////////////////////
struct TPeerDiscoveryResponse
{
bool IsUp;
std::vector<std::string> Addresses;
};
struct IPeerDiscovery
: public TRefCounted
{
virtual TFuture<TPeerDiscoveryResponse> Discover(
IChannelPtr channel,
const std::string& address,
TDuration timeout,
TDuration replyDelay,
const std::string& serviceName) = 0;
};
DEFINE_REFCOUNTED_TYPE(IPeerDiscovery)
////////////////////////////////////////////////////////////////////////////////
IPeerDiscoveryPtr CreateDefaultPeerDiscovery(IDiscoverRequestHookPtr hook = {});
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NRpc
|