-
Notifications
You must be signed in to change notification settings - Fork 21
refactor(cache): replace xattr-based caching with file-based cache #383
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
Conversation
Summary of ChangesHello @chlins, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly overhauls the file digest caching strategy, moving from a system reliant on extended file attributes to a more robust and portable file-based approach. This change aims to improve the consistency and performance of build processes by efficiently storing and retrieving file metadata, ensuring that digest calculations are only performed when necessary. The refactor centralizes caching logic and removes dependencies on platform-specific file system features. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request is a great step towards improving build performance by introducing a file-based caching mechanism. The new cache implementation in internal/cache/cache.go is well-structured and the integration into pkg/backend/build/builder.go is clean.
I have a few suggestions to improve the robustness and configurability of the new cache:
- The file locking in the cache should be context-aware to prevent processes from hanging.
- The cache directory should be configurable instead of being hardcoded to the system's temporary directory.
- Error checking for cache misses could be made more robust.
Overall, this is a solid refactoring. Addressing these points will make the new caching feature even better.
2c03810 to
12638e2
Compare
…plementation Signed-off-by: chlins <chlins.zhang@gmail.com>
12638e2 to
191c150
Compare
aftersnow
left a comment
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.
lgtm
This pull request introduces a new caching mechanism for file digests, replacing the previous use of extended attributes (xattrs) with a file-based cache. The cache stores metadata about files (such as modification time, size, and digest) to avoid redundant digest calculations, improving build performance and reliability. The changes also include dependency updates and code cleanup related to this refactor.
Caching mechanism refactor:
internal/cache/cache.gousing thegofrs/flocklibrary for safe concurrent access. This cache stores file metadata and digests in a JSON file and prunes expired entries.pkg/backend/build/builder.goto use the new cache for storing and retrieving file digests, replacing the previous xattrs-based approach. This includes new methods for cache retrieval and update, and integration into the build process. [1] [2] [3] [4] [5] [6]Dependency updates:
github.com/gofrs/flockand updatedgolang.org/x/systo v0.40.0 ingo.modto support the new cache implementation. [1] [2]Code cleanup:
pkg/backend/build/builder.go. [1] [2]IsRawMediaTypehelper frompkg/codec/codec.gosince raw media type detection is now handled directly in the builder.