mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
Anki is a smart spaced repetition flashcard program
![]() The approach of using incrementing id numbers works for syncing if we assume the server is canonical and all other clients rewrite their ids as necessary, but upon reflection it is not sufficient for merging decks in general, as we have no way of knowing whether objects with the same id are actually the same or not. So we need some way of uniquely identifying the object. One approach would be to go back to Anki 1.0's random 64bit numbers, but as outlined in a previous commit such large numbers can't be handled easy in some languages like Javascript, and they tend to be fragmented on disk which impacts performance. It's much better if we can keep content added at the same time in the same place on disk, so that operations like syncing which are mainly interested in newly added content can run faster. Another approach is to add a separate column containing the unique id, which is what Mnemosyne 2.0 will be doing. Unfortunately it means adding an index for that column, leading to slower inserts and larger deck files. And if the current sequential ids are kept, a bunch of code needs to be kept to ensure ids don't conflict when merging. To address the above, the plan is to use a millisecond timestamp as the id. This ensures disk order reflects creation order, allows us to merge the id and crt columns, avoids the need for a separate index, and saves us from worrying about rewriting ids. There is of course a small chance that the objects to be merged were created at exactly the same time, but this is extremely unlikely. This commit changes models. Other objects will follow. |
||
---|---|---|
anki | ||
tests | ||
tools | ||
.gitignore | ||
ChangeLog.old | ||
LICENSE |