Skip to content

Commit 44e4539

Browse files
committed
cm: launcher: add ImageInforProviderItf
Signed-off-by: Oleksandr Grytsov <[email protected]>
1 parent 699fa5e commit 44e4539

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

src/core/cm/launcher/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(TARGET_NAME launcher)
1414
# Headers
1515
# ######################################################################################################################
1616

17-
set(HEADERS nodemanager.hpp storage.hpp)
17+
set(HEADERS nodemanager.hpp storage.hpp itf/imageinfoprovider.hpp)
1818

1919
# ######################################################################################################################
2020
# Target
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (C) 2025 EPAM Systems, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef AOS_CORE_CM_LAUNCHER_ITF_UPDATEITEMPROVIDER_HPP_
8+
#define AOS_CORE_CM_LAUNCHER_ITF_UPDATEITEMPROVIDER_HPP_
9+
10+
#include <core/cm/networkmanager/itf/networkmanager.hpp>
11+
#include <core/common/ocispec/ocispec.hpp>
12+
#include <core/common/tools/error.hpp>
13+
14+
namespace aos::cm::launcher {
15+
16+
/** @addtogroup cm Communication Manager
17+
* @{
18+
*/
19+
20+
/**
21+
* Update image info.
22+
*/
23+
struct UpdateImageInfo : public ImageInfo {
24+
StaticString<cVersionLen> mVersion;
25+
StaticString<cURLLen> mURL;
26+
StaticString<cSHA256Size> mSHA256;
27+
size_t mSize {};
28+
29+
/**
30+
* Compares update image info.
31+
*
32+
* @param other object to compare with.
33+
* @return bool.
34+
*/
35+
bool operator==(const UpdateImageInfo& other) const
36+
{
37+
return mVersion == other.mVersion && mURL == other.mURL && mSHA256 == other.mSHA256 && mSize == other.mSize;
38+
}
39+
40+
/**
41+
* Compares update image info.
42+
*
43+
* @param other object to compare with.
44+
* @return bool.
45+
*/
46+
bool operator!=(const UpdateImageInfo& other) const { return !operator==(other); }
47+
};
48+
49+
/**
50+
* Interface that provides update items images information.
51+
*/
52+
class ImageInfoProviderItf {
53+
public:
54+
/**
55+
* Destructor.
56+
*/
57+
virtual ~ImageInfoProviderItf() = default;
58+
59+
/**
60+
* Returns update item images infos.
61+
*
62+
* @param urn update item URN.
63+
* @param[out] imagesInfos update item images info.
64+
* @return Error.
65+
*/
66+
virtual Error GetItemImages(const String& urn, Array<UpdateImageInfo>& imagesInfos) = 0;
67+
68+
/**
69+
* Returns service config.
70+
*
71+
* @param urn update item URN.
72+
* @param imageID image ID.
73+
* @param config service config.
74+
* @return Error.
75+
*/
76+
virtual Error GetServiceConfig(const String& urn, const uuid::UUID& imageID, oci::ServiceConfig& config) = 0;
77+
78+
/**
79+
* Returns image config.
80+
*
81+
* @param urn update item URN.
82+
* @param imageID image ID.
83+
* @param config image config.
84+
* @return Error.
85+
*/
86+
virtual Error GetImageConfig(const String& urn, const uuid::UUID& imageID, oci::ImageConfig& config) = 0;
87+
};
88+
89+
/** @}*/
90+
91+
} // namespace aos::cm::launcher
92+
93+
#endif

0 commit comments

Comments
 (0)