Arlodotexe / strix-music

Combine any music sources into a single library. It's your music. Play it your way.
http://www.strixmusic.com
137 stars 4 forks source link

MergedCollectionMap refactor #105

Open Arlodotexe opened 2 years ago

Arlodotexe commented 2 years ago

Overview

The MergedCollectionMap is a class which contains all of our logic for merging collections together. It's a very important part of the AdapterModel layer, where we merge many CoreModel instances into a single AppModel instance.

The existing code for this was created in Nov 2020, and while it mostly works, after using it for a while we've found some improvements that need to be made.

General notes

Brainstorm session 4/23/2022

The follow are notes from a brainstorm session between @Arlodotexe and @amaid on how to best handle the issues that arise from merging multiple collections into one collection.

Possible approaches

Sparse collection population

Full collection population (preload everything)

Hybrid (background preload)

Questions

What to do

Arlodotexe commented 2 years ago

Since sparse collection population changes the count as it merges items, and getting items causes sparse collection population, it's easy to create a stack overflow by getting items inside the count changed event, like we ran into here for the Zune Desktop shell.