Skip to content

fix: Use image hash in WLID map - #94

Merged
dwertent merged 9 commits into
relevancyfrom
fix-use-imageHash-in-wlid-map
Mar 26, 2023
Merged

fix: Use image hash in WLID map#94
dwertent merged 9 commits into
relevancyfrom
fix-use-imageHash-in-wlid-map

Conversation

@vladklokun

Copy link
Copy Markdown
Collaborator

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

  • My code follows the style guidelines of this project
  • I have commented on my code, particularly in hard-to-understand areas
  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • New and existing unit tests pass locally with my changes

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>
@vladklokun vladklokun self-assigned this Mar 24, 2023
@dwertent
dwertent merged commit d62a457 into relevancy Mar 26, 2023
@dwertent
dwertent deleted the fix-use-imageHash-in-wlid-map branch May 30, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants