Skip to content
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

Factor out the infrastructure for reading primary + additional stores #1384

Merged
merged 2 commits into from
Oct 13, 2022

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Oct 13, 2022

Factor out the repetitive “find primary + additional stores, and lock them in order” parts out of the top-level storage.Store API into helpers: readAll{Layer,Image}Stores.

Overall, this is just a refactoring that should not change behavior. The goal is to decrease the number of individual call sites to the locking code — so that the code refactored here does not need to be touched again for locking changes.

The more complex readers that don’t fit the simple locking schemes of these helpers remain unchanged; the locking in them will be updated individually.

This could be a bit better with Go 1.18, but that’s for the future.

See individual commit messages for (a bit) more detail.

#1383 is a counterpart for the write paths.

... to remove the copy&pasted iteration and copy&pasted locking/
ReloadIfChanged.

That will also make it much easier to add more locking in the future.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... to remove the copy&pasted iteration and copy&pasted locking/
ReloadIfChanged.

That will also make it much easier to add more locking in the future.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Oct 13, 2022

LGTM

@rhatdan
Copy link
Member

rhatdan commented Oct 13, 2022

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

None yet

3 participants