-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(mercury): introduce Storable #769
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
2a973ce
to
d85cbb3
Compare
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.
Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.
Files not reviewed (6)
- mercury/src/utils.rs: Evaluated as low risk
- mercury/src/internal/pack/mod.rs: Evaluated as low risk
- mercury/src/internal/pack/decode.rs: Evaluated as low risk
- libra/src/utils/client_storage.rs: Evaluated as low risk
- mercury/src/internal/pack/cache.rs: Evaluated as low risk
- mercury/src/internal/index.rs: Evaluated as low risk
Comments suppressed due to low confidence (2)
mercury/src/lib.rs:13
- [nitpick] The constant name MERCURY_DEFAULT_TMP_DIR should be renamed to MERCURY_DEFAULT_TMP_DIR to follow Rust naming conventions.
pub(crate) const MERCURY_DEFAULT_TMP_DIR: &str = "/tmp/.cache_temp";
mercury/src/internal/pack/cache_object.rs:291
- [nitpick] The error message could be more descriptive. It should include more details, such as the type of the object being stored and the path.
eprintln!("[{}] Error while storing {:?}: {:?}", std::any::type_name::<Self>(), path, e);
} | ||
|
||
fn store(obj: &T, location: &Path) -> Result<(), io::Error> { | ||
if location.exists() { |
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.
The store method in DefaultFileStorageStrategy does not overwrite existing files. This might be unintended behavior if the file needs to be updated.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Currently, the storage for all other projects is located at https://github.com/web3infra-foundation/mega/tree/main/jupiter. Most of it is related to the database, and the LFS section is now local_storage. The |
I see There are other code only used for decoding and caching but written for versatility, such as the generic |
This isn't really an issue. I’ve definitely learned a lot from your code, and this PR looks great. I just wanted to point out that the refactor seems to be slowly leaning towards over-engineering. After all, programming is about finding a balance between "over-engineering" and "straightforwardness."
|
No really, we use
We don't like over-design, as it makes future maintenance difficult. |
That's the reason why we should have I wrote that because, when I first implemented it, I wasn’t sure if the |
Anyway, I don't want to have to navigate through multiple layers to find the code I need during debugging, like in |
FileLoadStore
trait with some "real abstractions."utils
mods scattered around different directories andcrate::hash
could be moved tocrate::utils
as well.