-
Notifications
You must be signed in to change notification settings - Fork 5
Integration #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Integration #145
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
src/cm/smcontroller/tests/stubs/iteminfoproviderstub.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright (C) 2025 EPAM Systems, Inc. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #ifndef AOS_CM_SMCONTROLLER_TESTS_STUBS_ITEMINFOPROVIDERSTUB_HPP_ | ||
| #define AOS_CM_SMCONTROLLER_TESTS_STUBS_ITEMINFOPROVIDERSTUB_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <unordered_map> | ||
|
|
||
| #include <core/cm/imagemanager/itf/iteminfoprovider.hpp> | ||
|
|
||
| namespace aos::cm::smcontroller { | ||
|
|
||
| /** | ||
| * Item info provider stub. | ||
| */ | ||
| class ItemInfoProviderStub : public imagemanager::ItemInfoProviderItf { | ||
| public: | ||
| /** | ||
| * Sets blob URL by its digest. | ||
| * | ||
| * @param digest blob digest. | ||
| * @param url blob URL. | ||
| */ | ||
| void SetBlobURL(const std::string& digest, const std::string& url) { mBlobURLMap[digest] = url; } | ||
|
|
||
| /** | ||
| * Returns update item index digest. | ||
| * | ||
| * @param itemID update item ID. | ||
| * @param version update item version. | ||
| * @param[out] digest result item digest. | ||
| * @return Error. | ||
| */ | ||
| Error GetIndexDigest(const String& itemID, const String& version, String& digest) const override | ||
| { | ||
| (void)itemID; | ||
| (void)version; | ||
| (void)digest; | ||
|
|
||
| return ErrorEnum::eNone; | ||
| } | ||
|
|
||
| /** | ||
| * Returns blob path by its digest. | ||
| * | ||
| * @param digest blob digest. | ||
| * @param[out] path result blob path. | ||
| * @return Error. | ||
| */ | ||
| Error GetBlobPath(const String& digest, String& path) const override | ||
| { | ||
| (void)digest; | ||
| (void)path; | ||
|
|
||
| return ErrorEnum::eNone; | ||
| } | ||
|
|
||
| /** | ||
| * Returns blob URL by its digest. | ||
| * | ||
| * @param digest blob digest. | ||
| * @param[out] url result blob URL. | ||
| * @return Error. | ||
| */ | ||
| Error GetBlobURL(const String& digest, String& url) const override | ||
| { | ||
| auto it = mBlobURLMap.find(digest.CStr()); | ||
| if (it == mBlobURLMap.end()) { | ||
| return Error(ErrorEnum::eNotFound, "blob URL not found"); | ||
| } | ||
|
|
||
| url = it->second.c_str(); | ||
|
|
||
| return ErrorEnum::eNone; | ||
| } | ||
|
|
||
| /** | ||
| * Returns item current version. | ||
| * | ||
| * @param itemID update item ID. | ||
| * @param[out] version result item version. | ||
| * @return Error. | ||
| */ | ||
| Error GetItemCurrentVersion(const String& itemID, String& version) const override | ||
| { | ||
| (void)itemID; | ||
| (void)version; | ||
|
|
||
| return ErrorEnum::eNone; | ||
| } | ||
|
|
||
| private: | ||
| std::unordered_map<std::string, std::string> mBlobURLMap; | ||
| }; | ||
|
|
||
| } // namespace aos::cm::smcontroller | ||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetBlobURLerrors are always mapped togrpc::StatusCode::INTERNAL. This changes prior behavior where missing blob info/URL resulted inNOT_FOUND. IfGetBlobURLreturnsErrorEnum::eNotFound, returngrpc::StatusCode::NOT_FOUND(and keepINTERNALfor unexpected failures) so clients can distinguish missing data from server errors.