Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/config/cluster/v3/cluster.pb.h" 4 : 5 : #include "source/common/upstream/cluster_factory_impl.h" 6 : #include "source/common/upstream/upstream_impl.h" 7 : 8 : namespace Envoy { 9 : namespace Upstream { 10 : 11 : class StaticClusterFactory; 12 : class UpstreamImplTestBase; 13 : /** 14 : * Implementation of Upstream::Cluster for static clusters (clusters that have a fixed number of 15 : * hosts with resolved IP addresses). 16 : */ 17 : class StaticClusterImpl : public ClusterImplBase { 18 : public: 19 : // Upstream::Cluster 20 262 : InitializePhase initializePhase() const override { return InitializePhase::Primary; } 21 : 22 : private: 23 : friend class StaticClusterFactory; 24 : friend class UpstreamImplTestBase; 25 : 26 : StaticClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, 27 : ClusterFactoryContext& context); 28 : 29 : // ClusterImplBase 30 : void startPreInit() override; 31 : 32 : PriorityStateManagerPtr priority_state_manager_; 33 : uint32_t overprovisioning_factor_; 34 : bool weighted_priority_health_; 35 : }; 36 : 37 : /** 38 : * Factory for StaticClusterImpl cluster. 39 : */ 40 : class StaticClusterFactory : public ClusterFactoryImplBase { 41 : public: 42 13 : StaticClusterFactory() : ClusterFactoryImplBase("envoy.cluster.static") {} 43 : 44 : absl::StatusOr<std::pair<ClusterImplBaseSharedPtr, ThreadAwareLoadBalancerPtr>> 45 : createClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, 46 : ClusterFactoryContext& context) override; 47 : }; 48 : 49 : DECLARE_FACTORY(StaticClusterFactory); 50 : 51 : } // namespace Upstream 52 : } // namespace Envoy