blob: 04b1cea826c3e8e382ad99a287857379d0822c06 (
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
|
#pragma once
#include <yt/yt/client/api/client.h>
#include <yt/yt/core/profiling/public.h>
// @brief IPenaltyProvider interface is used in HedgingClient to provide external penalties for different clusters.
// Current implementations are DummyPenaltyProvider and ReplicationLagPenaltyProvider.
namespace NYT::NClient::NHedging::NRpc {
////////////////////////////////////////////////////////////////////////////////
DECLARE_REFCOUNTED_CLASS(IPenaltyProvider)
class IPenaltyProvider
: public TRefCounted
{
public:
virtual NProfiling::TCpuDuration Get(const TString& cluster) = 0;
};
DEFINE_REFCOUNTED_TYPE(IPenaltyProvider)
////////////////////////////////////////////////////////////////////////////////
// @brief DummyPenaltyProvider - always returns 0.
IPenaltyProviderPtr CreateDummyPenaltyProvider();
// From config.proto.
class TReplicationLagPenaltyProviderConfig;
// @brief ReplicationLagPenaltyProvider - periodically checks replication lag for given table AND replica cluster.
// Based on values from TReplicationLagPenaltyProviderConfig add current number of tablets with lag, it either returns 0 or LagPenalty value.
// Master client - main cluster with replicated table. ReplicaCluster + TablePath specifies concrete replica for table from main cluster.
IPenaltyProviderPtr CreateReplicationLagPenaltyProvider(
const TReplicationLagPenaltyProviderConfig& config, NApi::IClientPtr client);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NClient::NHedging::NRpc
|