LCOV - code coverage report
Current view: top level - envoy/server - guarddog.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 "envoy/common/pure.h"
       4             : #include "envoy/event/dispatcher.h"
       5             : #include "envoy/server/watchdog.h"
       6             : 
       7             : namespace Envoy {
       8             : namespace Server {
       9             : 
      10             : /**
      11             :  * The GuardDog runs a background thread which scans a number of shared WatchDog
      12             :  * objects periodically to verify that they have been recently touched. If some
      13             :  * of the watched items have not responded the GuardDog will take action ranging
      14             :  * from stats counter increments to killing the entire process (if a deadlock is
      15             :  * suspected).
      16             :  *
      17             :  * The lifespan of the GuardDog thread is tied to the lifespan of this object.
      18             :  */
      19             : class GuardDog {
      20             : public:
      21         222 :   virtual ~GuardDog() = default;
      22             : 
      23             :   /**
      24             :    * Get a WatchDog object pointer to a new WatchDog.
      25             :    *
      26             :    * After this method returns the WatchDog object must be touched periodically
      27             :    * to avoid triggering the GuardDog. If no longer needed use the
      28             :    * stopWatching() method to remove it from the list of watched objects.
      29             :    *
      30             :    * @param thread_id a Thread::ThreadId containing the system thread id
      31             :    * @param thread_name supplies the name of the thread which is used for per-thread miss stats.
      32             :    * @param dispatcher dispatcher responsible for petting the watchdog.
      33             :    */
      34             :   virtual WatchDogSharedPtr createWatchDog(Thread::ThreadId thread_id,
      35             :                                            const std::string& thread_name,
      36             :                                            Event::Dispatcher& dispatcher) PURE;
      37             : 
      38             :   /**
      39             :    * Tell the GuardDog to forget about this WatchDog.
      40             :    * After calling this method it is no longer necessary to touch the WatchDog
      41             :    * object.
      42             :    *
      43             :    * @param wd A WatchDogSharedPtr obtained from createWatchDog.
      44             :    */
      45             :   virtual void stopWatching(WatchDogSharedPtr wd) PURE;
      46             : };
      47             : 
      48             : } // namespace Server
      49             : } // namespace Envoy

Generated by: LCOV version 1.15