Ensure consistency between in-memory and database state #120
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Blocks
#136 Stale album information remains in TUI
wojtek/musichoard
Reference: wojtek/musichoard#120
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently the in-memory state is slightly disconnected from the database. One needs to explicitly reload and changes are only saved on exit. This is because the idea seemed to be to edit in-memory and then save to disk. This is okay for text editing, but perhaps not so much for a collection manager.
As a database, the interaction between the in-memory state and the filesystem should be closer. Every change to the state that corresponds to a change in the database should be written. Ideally, database first, and only on success, the in-memory state is updated.
This will make some of the other changes easier to implement as it will no longer be necessary to think too much how to manage the in-memory and database states. The in-memory state will only be allowed to represent the combined library/database on-disk state.
Some thoughts:
The database should ideally only contain metadata not included in the library.
However, there are some tricky cases:
The right solution may be just to use https://crates.io/crates/rusqlite
Figure out database philosophyto Establish a proper database interfaceEstablish a proper database interfaceto Ensure consistency between in-memory and database stateA quicker short-term solution that will most likely work well for quite some time - save to file after every update
120---establish-a-proper-database-interfaceto 120---ensure-consistency-between-in-memory-and-database-state