-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor ArticleCached into separate struct #45
Comments
I want to see ArticleCached as a separate struct with persistable methods - new/save/load, started on it and then abandoned: both axum and tauri expect a single global state passed with API calls, so even when we separate config_state and cached_articles, we will have to pass both via a single State. This leads to the following requirements:
|
Yes, fair point. Then let's have a structure like this: struct State {
config: ConfigState,
articles: Thesaurus,
} which is essentially struct State {
config: ConfigState,
articles: AHashMap<String, Article> = AHashMap::new(),
} Then we can still keep the config and the cache separate, while passing the object to axum/tauri. |
Thesaurus is different - it's "index" using knowledge graphs attached to the role per config. I think this one:
for axum will be ideal. |
@mre in PR review: The one downside I see with making articles_cached a part of ConfigState is that we couple two separate concerns together: configuration handling and article handling. Do we always need both in all places? If the answer is no, then they shouldn't be coupled on that level. 😉 (To make that clearer, ConfigState could be renamed to ConfigSync to indicate that it is just a Sync version of Config.)
I think we should keep those two things separate.
If we need to couple them somehow, I would maybe introduce a new higher-level struct like State { config_state, cached_articles }
or introduce a Cache struct, which holds the cached articles: Cache { articles }.
I think this will make testing easier.
The text was updated successfully, but these errors were encountered: