anki/rslib
Damien Elmes 1871b57663 don't put flag changes in the undo queue, and don't bump mtime
This is not ideal, but I struggled to come up with a better solution.

Background:

- The scheduler records the mtime of cards as it's building the queues,
and will throw an error in get_queued_cards() if the card on the DB
has a different mtime. This is to catch bugs - any operation that modifies
cards should be triggering a queue rebuild, or should adjust the queues
appropriately.
- The review screen skips the usual queue rebuild redraw, and directly
updates the flag icon. This is because a rebuild could cause a different
card to appear, or the answer side to switch back to the question side,
neither of which the user expects when they flag a card.

The current behaviour was broken: the queue rebuilding was still happening
on the backend, and the frontend was just failing to reflect it.

I initially tried to special-case Op::SetFlag, having it skip the queue
rebuild, and having set_card_flag() update the mtimes in the active
queue. But those mutations weren't captured by the undo log, so they
didn't get undone when undoing the set flag operation. We could perhaps
work around it by adding a separate undo entry to capture the mutation,
but it started to feel like it would be a pain to maintain moving forward.

By skipping the undo queue and retaining the same mtime, no queue
rebuild is required. Because we're setting usn, the cards will still
sync, but as mtime is not bumped, in the case of a conflict, an older
unsynced change from another client may revert the flag change.

Fixes https://forums.ankiweb.net/t/anki-2-1-50-beta-1-2/15608/145
2022-02-13 16:27:33 +10:00
..
.cargo initial Bazel conversion 2020-11-01 14:26:58 +10:00
benches New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
build Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
cargo V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
i18n V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
i18n_helpers V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
linkchecker V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
src don't put flag changes in the undo queue, and don't bump mtime 2022-02-13 16:27:33 +10:00
tests/support move linkchecker into separate crate 2021-12-20 17:27:43 +10:00
.gitignore initial Bazel conversion 2020-11-01 14:26:58 +10:00
bench.sh New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
BUILD.bazel V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
Cargo.toml V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
empty.rs Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
README.md add some code editing/completion docs 2020-12-16 14:16:08 +10:00
rustfmt.bzl update to the latest rules_rust + security framework update 2021-03-27 19:28:19 +10:00
rustfmt.toml tidy up Rust imports 2021-04-18 18:38:54 +10:00

Anki's Rust code.

backend.proto stores the interfaces used to communicate backend messages between Rust, Python and TypeScript.