LCOV - code coverage report
Current view: top level - basic_component/package_manager/inc - plugin_version_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 5 5
Test Date: 2026-08-12 11:03:52 Functions: 100.0 % 5 5

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef TSD_PLUGIN_VERSION_MANAGER_H
      12              : #define TSD_PLUGIN_VERSION_MANAGER_H
      13              : 
      14              : #include "plugin_pkg_version.h"
      15              : #include "package_process_config.h"
      16              : #include "package_env_info.h"
      17              : #include "package_hash_store.h"
      18              : #include "package_context.h"
      19              : #include "hdc_message_builder.h"
      20              : #include "basic_define.h"
      21              : #include "proto/tsd_message.pb.h"
      22              : 
      23              : #include <map>
      24              : #include <string>
      25              : 
      26              : namespace tsd {
      27              : 
      28              : class PluginVersionManager {
      29              : public:
      30              :     PluginVersionManager(PackageEnvInfo& envInfo, PackageHashStore& hashStore, PackageContext& ctx);
      31          365 :     ~PluginVersionManager() = default;
      32              : 
      33              :     bool IsCompatPluginPackage(const PackConfDetail& detail) const;
      34              :     PluginUpdateStrategy GetPluginUpdateStrategy();
      35              :     bool ShouldLoadCompatPluginPkg(const std::string& pkgPureName);
      36              :     bool CompareHostDeviceCompatPluginVersion(const std::string& pkgPureName);
      37              :     void HandleDevicePluginVersionRsp(const HDCMessage& msg);
      38              : 
      39           10 :     std::map<std::string, PluginPkgVersion>& GetDevicePluginVersions() { return devicePluginVersions_; }
      40              :     const std::map<std::string, PluginPkgVersion>& GetDevicePluginVersions() const { return devicePluginVersions_; }
      41            9 :     void SetPluginUpdateStrategy(PluginUpdateStrategy s) { pluginUpdateStrategy_ = s; }
      42            5 :     bool HasComputedPluginStrategy() const { return hasComputedPluginStrategy_; }
      43            9 :     void SetHasComputedPluginStrategy(bool v) { hasComputedPluginStrategy_ = v; }
      44              : 
      45              : private:
      46              :     std::map<std::string, PluginPkgVersion> devicePluginVersions_;
      47              :     PluginUpdateStrategy pluginUpdateStrategy_ = PluginUpdateStrategy::PLUGIN_NOT_FORCE_UPDATE;
      48              :     bool hasComputedPluginStrategy_ = false;
      49              :     PackageEnvInfo& envInfo_;
      50              :     PackageHashStore& hashStore_;
      51              :     PackageContext& ctx_;
      52              : };
      53              : 
      54              : } // namespace tsd
      55              : 
      56              : #endif // TSD_PLUGIN_VERSION_MANAGER_H
        

Generated by: LCOV version 2.0-1