Anki is a smart spaced repetition flashcard program
Find a file
Damien Elmes 553303fc12
Refactor service generation (#2552)
* Automatically elide empty inputs and outputs to backend methods

* Refactor service generation

Despite the fact that the majority of our Protobuf service methods require
an open collection, they were not accessible with just a Collection
object. To access the methods (e.g. because we haven't gotten around to
exposing the correct API in Collection yet), you had to wrap the collection
in a Backend object, and pay a mutex-acquisition cost for each call, even
if you have exclusive access to the object.

This commit migrates the majority of service methods to the Collection, so
they can now be used directly, and improves the ergonomics a bit at the
same time.

The approach taken:

- The service generation now happens in rslib instead of anki_proto, which
avoids the need for trait constraints and associated types.
- Service methods are assumed to be collection-based by default. Instead of
implementing the service on Backend, we now implement it on Collection, which
means our methods no longer need to use self.with_col(...).
- We automatically generate methods in Backend which use self.with_col() to
delegate to the Collection method.
- For methods that are only appropriate for the backend, we add a flag in
the .proto file. The codegen uses this flag to write the method into a
BackendFooService instead of FooService, which the backend implements.
- The flag can also allows us to define separate implementations for collection
and backend, so we can e.g. skip the collection mutex in the i18n service
while also providing the service on a collection.
2023-06-19 15:33:40 +10:00
.buildkite Migrate pylib/anki qt/aqt to group syntax (eg pylib:anki) 2023-06-15 17:17:55 +10:00
.cargo Move protobuf generation into a separate crate; write .py interface in Rust 2023-06-12 09:52:00 +10:00
.config Update Rust deps 2023-03-31 14:38:24 +10:00
.github/ISSUE_TEMPLATE Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.vscode.dist Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
build Check for stale licenses.json in minilints 2023-06-17 14:01:27 +10:00
cargo Refactor service generation (#2552) 2023-06-19 15:33:40 +10:00
docs Migrate pylib/anki qt/aqt to group syntax (eg pylib:anki) 2023-06-15 17:17:55 +10:00
ftl Don't fail silently when an empty csv is imported 2023-06-15 17:47:46 +10:00
proto Refactor service generation (#2552) 2023-06-19 15:33:40 +10:00
pylib Refactor service generation (#2552) 2023-06-19 15:33:40 +10:00
python Update requests for CVE 2023-05-24 16:09:15 +10:00
qt Refactor progress handling (#2549) 2023-06-19 13:48:32 +10:00
rslib Refactor service generation (#2552) 2023-06-19 15:33:40 +10:00
sass Migrate to protobuf-es (#2547) 2023-06-14 22:47:37 +10:00
tools Include cmdline in error display; show cargo install progress 2023-06-17 14:55:55 +10:00
ts Fix two issues with MathJax editor (#2550) 2023-06-19 13:55:40 +10:00
.deny.toml Update Rust deps (#2332) 2023-01-18 22:24:29 +10:00
.dprint.json Experiment with disabling prettier whitespace sensitivity 2023-06-01 11:11:26 +10:00
.eslintrc.js Upgrade Svelte (#2506) 2023-05-18 17:04:58 +10:00
.gitattributes try again to improve GitHub's language stats 2021-01-20 13:20:45 +10:00
.gitignore Add support for using n2 instead of ninja 2023-06-15 17:17:56 +10:00
.gitmodules Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.isort.cfg Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.mypy.ini Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.pylintrc Add ability to restore a notetype to its original configuration (#2472) 2023-04-18 14:07:51 +10:00
.rustfmt-empty.toml Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.rustfmt.toml Move ascii_percent_encoding into a separate repo 2023-04-12 08:45:23 +10:00
.version Bump version 2023-06-05 09:20:00 +10:00
Cargo.lock Refactor service generation (#2552) 2023-06-19 15:33:40 +10:00
Cargo.toml Check for stale licenses.json in minilints 2023-06-17 14:01:27 +10:00
CONTRIBUTORS Issue #2546 Exclude Fabric's canvas dependency (#2551) 2023-06-19 13:50:13 +10:00
LICENSE move aqt_data into source folder; implement wheel building 2020-11-04 12:14:03 +10:00
ninja Add env var to enable sourcemaps 2022-12-04 11:37:16 +10:00
package.json Issue #2546 Exclude Fabric's canvas dependency (#2551) 2023-06-19 13:50:13 +10:00
pkgkey.asc add public key for release signing 2018-09-18 10:40:45 +10:00
README.md Add link to website in README 2023-05-31 13:49:19 +10:00
run Migrate pylib/anki qt/aqt to group syntax (eg pylib:anki) 2023-06-15 17:17:55 +10:00
run.bat Migrate pylib/anki qt/aqt to group syntax (eg pylib:anki) 2023-06-15 17:17:55 +10:00
rust-toolchain.toml Update to Rust 1.70 2023-06-07 14:52:31 +10:00
SECURITY.md add SECURITY.md 2021-09-22 22:55:19 +10:00
yarn.lock Issue #2546 Exclude Fabric's canvas dependency (#2551) 2023-06-19 13:50:13 +10:00

Anki

Build status

This repo contains the source code for the computer version of Anki.

If you'd like to try development builds of Anki but don't feel comfortable building the code, please see https://betas.ankiweb.net/

For more information on building, please see Development.