The Reading List Service API will provide support for storing the order a list of items in the backend and allowing the user to update that. The updating operations are: move a given list item to a given position (ie. drag&drop sort) and sorting the whole list at once (e.g. alphabetically). This second one might or might not be needed.
In the discussion, two implementations were brought up:
- Use a sort key (such as an integer weight). Have MySQL order by that field. On single-item-update select a new sortkey accordingly (e.g. (weight of previous item + weight of next item) / 2). There will be some rare cases where that would not work (e.g. the previous & next item already have consecutive weights) in which case the sortkeys for the whole list need to be renormalized.
- Use linked lists. Always fetch all items of the list from the DB, sort and page them in the application logic. On single-item-update just update the links for the item and its old and new neighbours.