-
Notifications
You must be signed in to change notification settings - Fork 19
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
cache refactor #12
cache refactor #12
Conversation
); | ||
|
||
load_source_and_add( | ||
std::fs::read(&options_nixos_cache_path).map(|c| OptionsDatabase::load(&c)), |
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.
couldn't we use and_then
here to flatten the error structure beforehand? the Errors
type should be able to represent that possible io error, shouldn't it?
Ok(true) | ||
} | ||
} | ||
impl Cache for CommentsDatabase {} |
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.
This would ofc be prettier as a #[derive(Cache)]
macro, although those are kind of annoying to implement. Generally something to keep in mind, but i don't think we need to necessarily do that now
src/nixpkgs_tree_docsource.rs
Outdated
let new_keys = gen_keys()?; | ||
let last = std::mem::replace(&mut self.keys, new_keys); | ||
|
||
Ok(last != self.keys) |
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.
Generally i see the point in having update
return information about if anything actually changed, but in cases like this, doing that check might actually have some performance implications (as it probably needs to iterate over all of the values pretty much, "undoing" the efficiency you've saved by doing the std::mem::replace
. Are you sure that we actually need that return information, or that this causes no noticable increase in update-times?
Added a few comments, i think that's all I've noticed. everything else looks perfect! |
Completes mlvzk#12
No description provided.