LCOV - code coverage report
Current view: top level - envoy/network - drain_decision.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 <chrono>
       4             : #include <functional>
       5             : 
       6             : #include "envoy/common/callback.h"
       7             : #include "envoy/common/pure.h"
       8             : 
       9             : #include "absl/base/attributes.h"
      10             : 
      11             : namespace Envoy {
      12             : namespace Network {
      13             : 
      14             : class DrainDecision {
      15             : public:
      16             :   using DrainCloseCb = std::function<void(std::chrono::milliseconds)>;
      17             : 
      18         640 :   virtual ~DrainDecision() = default;
      19             : 
      20             :   /**
      21             :    * @return TRUE if a connection should be drained and closed. It is up to individual network
      22             :    *         filters to determine when this should be called for the least impact possible.
      23             :    */
      24             :   virtual bool drainClose() const PURE;
      25             : 
      26             :   /**
      27             :    * @brief Register a callback to be called proactively when a drain decision enters into a
      28             :    *        'close' state.
      29             :    *
      30             :    * @param cb Callback to be called once drain decision enters close state
      31             :    * @return handle to remove callback
      32             :    */
      33             :   ABSL_MUST_USE_RESULT
      34             :   virtual Common::CallbackHandlePtr addOnDrainCloseCb(DrainCloseCb cb) const PURE;
      35             : };
      36             : 
      37             : } // namespace Network
      38             : } // namespace Envoy

Generated by: LCOV version 1.15