Add database-library merge #48

Closed
opened 2023-04-27 11:46:49 +02:00 by wojtek · 0 comments
Owner

Some data will be kept in the database only which means that at startup the database and library information must be merged.

  1. Create new Library data structures to represent the subset of metadata that it returns. Right now these will be identical in content. This is to allow them to diverge in the future.
  2. The database deals with the complete data structures.
  3. Add a new public method, load_from_database to the MusicHoard struct.
  4. Whenever load_from_database is called, it is merged with the current in-memory collection. In-memory state ALWAYS wins. The assumption is that it will either have extra information from the library which is the ultimate source of truth.
  5. Whenever rescan_library is called the resulting collection is merged with the in-memory collection. The collection from the library ALWAYS wins. The library is the ultimate source of truth.

Since the binary currently doesn't really read/write from/to a database, this issue should also add consistent read/write behaviour to the binary. Since there are currently no options for editing the database this means reading on startup and writing on exit.

If the database does not exist on startup, this should not be an error.

Some data will be kept in the database only which means that at startup the database and library information must be merged. 1. [x] Create new Library data structures to represent the subset of metadata that it returns. Right now these will be identical in content. This is to allow them to diverge in the future. 2. [x] The database deals with the complete data structures. 3. [x] Add a new public method, `load_from_database` to the `MusicHoard` struct. 4. [x] Whenever `load_from_database` is called, it is merged with the current in-memory collection. In-memory state *ALWAYS* wins. The assumption is that it will either have extra information from the library which is the ultimate source of truth. 5. [x] Whenever `rescan_library` is called the resulting collection is merged with the in-memory collection. The collection from the library *ALWAYS* wins. The library is the ultimate source of truth. Since the binary currently doesn't really read/write from/to a database, this issue should also add consistent read/write behaviour to the binary. Since there are currently no options for editing the database this means reading on startup and writing on exit. If the database does not exist on startup, this should not be an error.
wojtek added this to the (deleted) project 2023-04-27 11:46:49 +02:00
wojtek added the
enhancement
label 2023-04-27 11:46:58 +02:00
wojtek added this to the (deleted) milestone 2023-04-27 11:47:01 +02:00
wojtek modified the milestone from (deleted) to (deleted) 2023-04-27 22:17:44 +02:00
wojtek added this to the (deleted) project 2023-05-06 09:51:01 +02:00
wojtek added this to the Artist tracking project 2023-05-06 09:52:53 +02:00
wojtek added this to the v0.2.0 milestone 2023-05-06 10:55:08 +02:00
wojtek changed title from Add database-library merge during startup to Add database-library merge 2023-05-06 10:56:22 +02:00
wojtek added reference 48---add-database-library-merge 2023-05-06 11:40:07 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: wojtek/musichoard#48
No description provided.