LCOV - code coverage report
Current view: top level - vnsw/agent/port_ipc - config_stale_cleaner.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 3 3 100.0 %
Date: 2026-08-03 02:19:58 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef __AGENT_CONFIG_STALE_CLEANER_H_
       6             : #define __AGENT_CONFIG_STALE_CLEANER_H_
       7             : 
       8             : #include <cmn/agent.h>
       9             : #include <boost/function.hpp>
      10             : 
      11             : // Stale cleaner to audit & delete old configuration, on a new client connect.
      12             : // Waits for timeout, before cleaning the old configuration.
      13             : class ConfigStaleCleaner {
      14             : public:
      15             :     static const uint32_t kConfigStaleTimeout = 60 * 1000;
      16             :     typedef boost::function<void(uint32_t)> TimerCallback;
      17             : 
      18             :     ConfigStaleCleaner(Agent *agent, TimerCallback callback);
      19           3 :     void set_callback(TimerCallback callback) { audit_callback_ = callback; }
      20             :     virtual ~ConfigStaleCleaner();
      21             :     virtual void StartStaleCleanTimer(int32_t version);
      22             :     virtual bool StaleEntryTimeout(int32_t version, Timer *timer);
      23           3 :     void set_timeout(uint32_t timeout) { timeout_ = timeout; }
      24             :     uint32_t timeout() const { return timeout_; }
      25           3 :     uint32_t TimersCount() const { return running_timer_list_.size(); }
      26             : 
      27             : protected:
      28             :     Agent *agent_;
      29             : 
      30             : private:
      31             :     uint32_t timeout_;
      32             :     // list of running audit timers (one per connect)
      33             :     std::set<Timer *> running_timer_list_;
      34             :     TimerCallback audit_callback_;
      35             :     DISALLOW_COPY_AND_ASSIGN(ConfigStaleCleaner);
      36             : };
      37             : 
      38             : class InterfaceConfigStaleCleaner : public ConfigStaleCleaner {
      39             : public:
      40             :     InterfaceConfigStaleCleaner(Agent *agent);
      41             :     virtual ~InterfaceConfigStaleCleaner();
      42             :     virtual bool OnInterfaceConfigStaleTimeout(int32_t version);
      43             : 
      44             : private:
      45             :     DISALLOW_COPY_AND_ASSIGN(InterfaceConfigStaleCleaner);
      46             : };
      47             : 
      48             : #endif /* __AGENT_CONFIG_STALE_CLEANER_H_ */

Generated by: LCOV version 1.14