Split IdPool and ItemStore
Closed this issue · 1 comments
mikegoatly commented
At the moment IdPool : ItemStore
. I think the intent was to make it easier to add an item and allow it to generate its own id as that happened. This has actually made it harder to do the item scoring work as I need to add in additional metadata for an item, and IdPool
would need to become aware of item types as well (probably via some method overloads). This is really messy and I have a feeling splitting this code up will make it more maintainable.
IdPool
- single responsibility for shared internal ids. (Possibly removing the need for it to be generic?)
ItemStore
- responsible for managing item metadata
- Clean up
IdPool
- Migrate logic to
ItemStore
- Change index add actions:
- Get the next id from the pool
- Add the item to the item store, with the returned id
- Change index remove actions:
- Remove the item from the item store
- Return the item's internal id to the pool
A good lesson in preferring composition over inheritance.
mikegoatly commented
Done as part of item score boosting for v6