1
#pragma once
2

            
3
#include <cstdint>
4
#include <vector>
5

            
6
#include "source/common/common/phantom.h"
7

            
8
namespace Envoy {
9
namespace Upstream {
10

            
11
// Phantom type indicating that the type is related to load.
12
struct Load {};
13

            
14
// Mapping from a priority to how much of the total traffic load should be directed to this
15
// priority. For example, {50, 30, 20} means that 50% of traffic should go to P0, 30% to P1
16
// and 20% to P2.
17
//
18
// This should either sum to 100 or consist of all zeros.
19
using PriorityLoad = Phantom<std::vector<uint32_t>, Load>;
20

            
21
// PriorityLoad specific to degraded hosts.
22
struct DegradedLoad : PriorityLoad {
23
  using PriorityLoad::PriorityLoad;
24
};
25

            
26
// PriorityLoad specific to healthy hosts.
27
struct HealthyLoad : PriorityLoad {
28
  using PriorityLoad::PriorityLoad;
29
};
30

            
31
struct HealthyAndDegradedLoad {
32
  HealthyLoad healthy_priority_load_;
33
  DegradedLoad degraded_priority_load_;
34
};
35

            
36
// Phantom type indicating that the type is related to host availability.
37
struct Availability {};
38

            
39
// Mapping from a priority how available the given priority is, e.g., the ratio of healthy host to
40
// total hosts.
41
using PriorityAvailability = Phantom<std::vector<uint32_t>, Availability>;
42

            
43
// Availability specific to degraded hosts.
44
struct DegradedAvailability : PriorityAvailability {
45
  using PriorityAvailability::PriorityAvailability;
46
};
47

            
48
// Availability specific to healthy hosts.
49
struct HealthyAvailability : PriorityAvailability {
50
  using PriorityAvailability::PriorityAvailability;
51
};
52

            
53
// Phantom type indicating that the type is related to healthy hosts.
54
struct Healthy {};
55
// Phantom type indicating that the type is related to degraded hosts.
56
struct Degraded {};
57
// Phantom type indicating that the type is related to excluded hosts.
58
struct Excluded {};
59

            
60
} // namespace Upstream
61
} // namespace Envoy