fix: Use image hash in WLID map - #94
Merged
Merged
Conversation
This data structure is designed to replace the map-and-mutex that are side-by-side in the WatchHandler so clients can perform thread-safe operations on it with more confidence and ease. Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
As the first step in wiring the refactoring, use the IWMap in WatchHandler’s private functions that previously handled thread-safe operations on the raw ImageIDs to WLIDs map Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
The data structure maps image hashes to WLIDs. Image hashes are not the same as image IDs. Image hashes are plain hash digest values. Rename mentions to avoid confusion. Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
Previously, the ImageID to WLIDs map used values that were sort of like Image IDs, but not really. This is problematic, since the map is supposed to be used as a way to look up entities that have Image Hashes as their keys. When receiving such an entity, for example, an SBOM, our code cannot meaningfully transform the Image Hash of an SBOM, to an unambiguous, correct Image ID so we can look it up in the Image-WLID map. Therefore, this map should use Image Hashes instead. This commit refactors operations on the map to insert by Image Hash instead of Image IDs. Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
dwertent
approved these changes
Mar 26, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Previously, the ImageID to WLIDs map used values that were sort of like Image IDs, but not really. This is problematic, since the map is supposed to be used as a way to look up entities that have Image Hashes as their keys.
When receiving such an entity, for example, an SBOM, our code cannot meaningfully transform the Image Hash of an SBOM, to an unambiguous, correct Image ID so we can look it up in the Image-WLID map.
Therefore, this map should use Image Hashes instead.
This PR refactors operations on the map to insert by Image Hash instead of Image IDs.
Related issues/PRs:
This PR targets the relevancy branch, but requires that #93 is merged first. Check out that PR first.
Checklist before requesting a review