Repository navigation
feat: report narinfo storage deprecated and must be migrated [backport #961] - #964
Conversation
The narinfo stored in the storage is deprecated and this is the last release that will support their migration from storage to the database. Include this messaging in the next release so I can clean up the code in the following one. (cherry picked from commit e32ee09)
Summary of ChangesHello @kalbasit, 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 introduces a crucial user-facing warning mechanism to inform administrators about the impending deprecation of file-based narinfo storage. It ensures that users are aware of the need to migrate their narinfo data to the database before the next release, preventing potential data loss or service disruption. The changes also enhance S3 storage flexibility by adding prefix support and improve code structure with new constants. Highlights
Changelog
Activity
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.
Code Review
This pull request introduces a deprecation warning for file-based narinfo storage, guiding users towards database migration. It correctly adds checks for legacy narinfo directories in both local and S3 storage, logging a helpful warning message. Additionally, it introduces support for an S3 prefix, which is a valuable feature for organizing data within a bucket. The changes are well-implemented and include corresponding tests. The suggestion to refactor the S3 path prefixing logic to improve code clarity and maintainability remains valid.
| func (s *Store) secretKeyPath() string { | ||
| return "config/cache.key" | ||
| if s.prefix == "" { | ||
| return "config/cache.key" | ||
| } | ||
|
|
||
| return s.prefix + "/config/cache.key" | ||
| } | ||
|
|
||
| func (s *Store) storeNarInfoPath() string { | ||
| if s.prefix == "" { | ||
| return "store/narinfo" | ||
| } | ||
|
|
||
| return s.prefix + "/store/narinfo" | ||
| } |
There was a problem hiding this comment.
To reduce code duplication when prepending the S3 prefix, you can use path.Join. This function correctly handles joining path segments, including when the prefix is empty.
You can apply a similar simplification to the narPath function as well.
| func (s *Store) secretKeyPath() string { | |
| return "config/cache.key" | |
| if s.prefix == "" { | |
| return "config/cache.key" | |
| } | |
| return s.prefix + "/config/cache.key" | |
| } | |
| func (s *Store) storeNarInfoPath() string { | |
| if s.prefix == "" { | |
| return "store/narinfo" | |
| } | |
| return s.prefix + "/store/narinfo" | |
| } | |
| func (s *Store) secretKeyPath() string { | |
| return path.Join(s.prefix, "config/cache.key") | |
| } | |
| func (s *Store) storeNarInfoPath() string { | |
| return path.Join(s.prefix, "store/narinfo") | |
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-0.9 #964 +/- ##
===========================================
Coverage 5.04% 5.04%
===========================================
Files 6 6
Lines 436 436
===========================================
Hits 22 22
Misses 410 410
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bot-based backport to
release-0.9, triggered by a label in #961.The narinfo stored in the storage is deprecated and this is the last
release that will support their migration from storage to the database.
Include this messaging in the next release so I can clean up the code in
the following one.