Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : 5 : #include "envoy/common/pure.h" 6 : 7 : #include "absl/strings/string_view.h" 8 : 9 : namespace Envoy { 10 : namespace Server { 11 : 12 : /** 13 : * A point within the connection or request lifecycle that provides context on 14 : * whether to shed load at that given stage for the current entity at the point. 15 : */ 16 : class LoadShedPoint { 17 : public: 18 1684 : virtual ~LoadShedPoint() = default; 19 : 20 : // Whether to shed the load. 21 : virtual bool shouldShedLoad() PURE; 22 : }; 23 : 24 : using LoadShedPointPtr = std::unique_ptr<LoadShedPoint>; 25 : 26 : /** 27 : * Provides configured LoadShedPoints. 28 : */ 29 : class LoadShedPointProvider { 30 : public: 31 2345 : virtual ~LoadShedPointProvider() = default; 32 : 33 : /** 34 : * Get the load shed point identified by the following string. Returns nullptr 35 : * for non-configured points. 36 : */ 37 : virtual LoadShedPoint* getLoadShedPoint(absl::string_view point_name) PURE; 38 : }; 39 : 40 : } // namespace Server 41 : } // namespace Envoy