LCOV - code coverage report
Current view: top level - vnsw/agent/resource_manager - resource_backup.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 2 0.0 %
Date: 2026-11-09 02:10:49 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_resource_backup_hpp
       7             : #define vnsw_agent_resource_backup_hpp
       8             : 
       9             : 
      10             : #include "resource_manager/resource_manager.h"
      11             : #include "resource_manager/sandesh_map.h"
      12             : 
      13             : class Timer;
      14             : class ResourceSandeshMaps;
      15             : class ResourceManager;
      16             : class ResourceTable;
      17             : class ResourceData;
      18             : 
      19             : class ResourceBackupReq {
      20             : public:
      21             :     enum Op {
      22             :         ADD = 1,
      23             :         DEL,
      24             :     };
      25             : 
      26             :     ResourceBackupReq(ResourceManager::KeyPtr key,
      27             :                              ResourceManager::DataPtr data,
      28             :                              Op op);
      29             :     virtual ~ResourceBackupReq();
      30             :     void Process();
      31             :     ResourceManager::KeyPtr key() {return key_;}
      32             :     ResourceManager::DataPtr data() {return data_;}
      33             : 
      34             : 
      35             : private:
      36             :     ResourceManager::KeyPtr key_;
      37             :     ResourceManager::DataPtr data_;
      38             :     Op op_;
      39             :     DISALLOW_COPY_AND_ASSIGN(ResourceBackupReq);
      40             : };
      41             : //Backup manager is to Process the Resource data and store
      42             : //it in to a file using Sandesh encoding.
      43             : class ResourceBackupManager {
      44             : public:
      45             :     typedef boost::shared_ptr<ResourceBackupReq> ResourceBackupReqPtr;
      46             :     ResourceBackupManager(ResourceManager *mgr);
      47             :     virtual ~ResourceBackupManager();
      48             : 
      49             :     void Init();
      50             :     ResourceSandeshMaps& sandesh_maps();
      51             :     static uint32_t ReadResourceDataFromFile(const std::string &file_name,
      52             :                                              std::unique_ptr<uint8_t> *buf);
      53             : 
      54           0 :     Agent *agent() {return agent_;}
      55           0 :     ResourceManager *resource_manager() {return resource_manager_;}
      56             :     bool WorkQueueBackUpProcess(ResourceBackupReqPtr backup_data);
      57             :     void BackupResource(ResourceManager::KeyPtr key,
      58             :                         ResourceManager::DataPtr data,
      59             :                         ResourceBackupReq::Op op);
      60             :     void AuditDone();
      61             : 
      62             : private:
      63             :     ResourceManager *resource_manager_;
      64             :     Agent *agent_;
      65             :     ResourceSandeshMaps sandesh_maps_;
      66             :     // Work queue to backup the data.
      67             :     WorkQueue<ResourceBackupReqPtr> backup_work_queue_;
      68             :     EventNotifyHandle::Ptr audit_handle_;
      69             :     DISALLOW_COPY_AND_ASSIGN(ResourceBackupManager);
      70             : };
      71             : 
      72             : #endif

Generated by: LCOV version 1.14