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 "hdc_message_builder.h"
19 : #include "inc/client_manager.h"
20 : #include "proto/tsd_message.pb.h"
21 :
22 : #include <map>
23 : #include <string>
24 :
25 : namespace tsd {
26 :
27 : class PluginVersionManager {
28 : public:
29 : PluginVersionManager(PackageEnvInfo& envInfo, PackageHashStore& hashStore, ResponseCode& pkgRspCode);
30 263 : ~PluginVersionManager() = default;
31 :
32 : bool IsCompatPluginPackage(const PackConfDetail& detail) const;
33 : PluginUpdateStrategy GetPluginUpdateStrategy();
34 : bool ShouldLoadCompatPluginPkg(const std::string& pkgPureName);
35 : bool CompareHostDeviceCompatPluginVersion(const std::string& pkgPureName);
36 : void HandleDevicePluginVersionRsp(const HDCMessage& msg);
37 :
38 : // 状态(public 供 Facade 引用别名访问)
39 : std::map<std::string, PluginPkgVersion> devicePluginVersions_;
40 : PluginUpdateStrategy pluginUpdateStrategy_ = PluginUpdateStrategy::PLUGIN_NOT_FORCE_UPDATE;
41 : bool hasComputedPluginStrategy_ = false;
42 :
43 : private:
44 : PackageEnvInfo& envInfo_;
45 : PackageHashStore& hashStore_;
46 : ResponseCode& pkgRspCode_;
47 : };
48 :
49 : } // namespace tsd
50 :
51 : #endif // TSD_PLUGIN_VERSION_MANAGER_H
|