LCOV - code coverage report
Current view: top level - envoy/common - backoff_strategy.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 1 1 100.0 %
Date: 2024-01-05 06:35:25 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <cstdint>
       4             : #include <memory>
       5             : 
       6             : #include "envoy/common/pure.h"
       7             : 
       8             : namespace Envoy {
       9             : /**
      10             :  * Generic interface for all backoff strategy implementations.
      11             :  */
      12             : class BackOffStrategy {
      13             : public:
      14          31 :   virtual ~BackOffStrategy() = default;
      15             : 
      16             :   /**
      17             :    * @return the next backoff interval in milli seconds.
      18             :    */
      19             :   virtual uint64_t nextBackOffMs() PURE;
      20             : 
      21             :   /**
      22             :    * Resets the intervals so that the back off intervals can start again.
      23             :    */
      24             :   virtual void reset() PURE;
      25             : 
      26             :   /**
      27             :    * Resets the interval with a (potentially) new starting point.
      28             :    * @param base_interval the new base interval for the backoff strategy.
      29             :    */
      30             :   virtual void reset(uint64_t base_interval) PURE;
      31             : 
      32             :   /**
      33             :    * @return if the time interval exceeds any configured cap on next backoff value.
      34             :    */
      35             :   virtual bool isOverTimeLimit(uint64_t interval_ms) const PURE;
      36             : };
      37             : 
      38             : using BackOffStrategyPtr = std::unique_ptr<BackOffStrategy>;
      39             : } // namespace Envoy

Generated by: LCOV version 1.15