feat(backend): add skip support to pull/fetch layer hooks#536
Merged
Conversation
Signed-off-by: chlins <chlins.zhang@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request updates the PullHooks interface to allow skipping layers during pull and fetch operations, with corresponding logic implemented in the backend and verified by new tests. BeforePullLayer now returns a boolean to signal skipping, and AfterPullLayer includes a flag for skip status. Review feedback focuses on thread safety, suggesting that configuration objects be copied before mutation and that the PullHooks interface documentation explicitly require thread-safe implementations.
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.
This pull request introduces a more flexible and robust hook system for layer fetching and pulling operations, allowing hooks to skip specific layers and improving error handling and test coverage. The changes ensure that hooks are never nil, allow hooks to short-circuit layer downloads, and update the hook interface to provide more context. Comprehensive tests are added to validate the new behavior.
Hook system enhancements:
PullHooksinterface now allows theBeforePullLayerhook to return a boolean indicating whether a layer should be skipped;AfterPullLayernow receives askippedflag and error value for more detailed reporting. The default (empty) hook implementation is updated accordingly.backend.Fetchandbackend.Pull) now check the result ofBeforePullLayer, skip downloading the layer if requested, and always callAfterPullLayerwith the correct flags. This logic is consistently applied in both regular and Dragonfly code paths. [1] [2] [3] [4] [5] [6]Default hook safety:
Testing improvements: