Commit graph

101 commits

Author SHA1 Message Date
Damien Elmes
8bfcfda980 we can optimize the dependencies separately (to an extent) 2020-10-09 20:02:15 +10:00
Damien Elmes
375acae2c3 use a semi-optimized build during development
stock dev mode is too slow, but release mode is about 3x slower
than this middle ground
2020-10-09 19:51:46 +10:00
Damien Elmes
2ed1507162 bump version 2020-10-02 10:22:21 +10:00
Damien Elmes
1a619073d7 bump version 2020-09-24 10:52:24 +10:00
Aleksa Sarai
21769bfa68 rust: switch to stable compilers
The only dependency which required nightly compilers was pyo3, which
supports stable Rust (1.39.0 and later) since version 0.11.0. Supporting
stable Rust makes it easier to package Anki for distributions. No other
code changes were required.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:39:51 +10:00
Aleksa Sarai
96da137314 rs: remove most &mut references in BackendService
The previous implementation had some slightly questionable memory safety
properties (older versions of PyO3 didn't uphold the Rust aliasing rules
and would thus create multiple &mut references to #[pyclass] objects).
This explains why Backend has internal Mutex<T>s even though all of its
methods took &mut self.

The solution is to simply make all methods take &self, which luckily
doesn't pose too make issues -- most of the code inside Backend already
has sufficient locking. The only two things which needed to be
explicitly handled where:

1. "self.runtime" which was fairly easy to handle. All usages of
   the Runtime only require an immutable reference to create a new
   Handle, so we could switch to OnceCell which provides
   lazy-initialisation semantics without needing a more heavy-handed
   Mutex<tokio::runtime::Handle>.

2. "self.sync_abort" was simply wrapped in a Mutex<>, though some of the
   odd semantics of sync_abort (not being able to handle multiple
   processes synchronising at the same time) become pretty obvious with
   this change (for now we just log a warning in that case). In
   addition, switch to an RAII-style guard to make sure we don't forget
   to clear the abort_handle.

As a result, we now no longer break Rust's aliasing rules and we can
build with newer versions of PyO3 which have runtime checks for these
things (and build on stable Rust).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:37:59 +10:00
Damien Elmes
b234a92d8b default to true in want_release_gil() 2020-09-01 10:24:38 +10:00
Damien Elmes
999b659c3a reimplement congrats screen in Rust+Typescript 2020-09-01 10:24:38 +10:00
Damien Elmes
f3c6d565b0 bump version 2020-08-31 11:07:54 +10:00
Damien Elmes
41a47fcf01 fix some clippy lints 2020-08-26 19:02:56 +10:00
Damien Elmes
2f6d816cdc bump version 2020-08-26 08:05:45 +10:00
Damien Elmes
58c8609332 bump version 2020-08-24 11:28:22 +10:00
Damien Elmes
4629dd38fb bump version 2020-08-09 13:44:59 +10:00
Damien Elmes
d3653ab6d5 bump version 2020-07-28 12:59:56 +10:00
Damien Elmes
7e78d12b99 bump version 2020-07-21 15:54:14 +10:00
Damien Elmes
56833f0ac7 panic fix was merged into hyper 0.13.7 2020-07-16 09:09:13 +10:00
Damien Elmes
a7c3705d8c ensure sys crates work on older Macs 2020-07-13 13:35:09 +10:00
Damien Elmes
9a509f5e42 roll back pyo3 for now
0.9 will spit out BorrowMut errors when two concurrent backend
commands are received with allow_threads. The collection mutex protects
most methods, but other attributes like the abort handle are not
protected, so this code may need to be reworked in the future. We
could wrap the entire backend in a mutex, but that means the
long-running syncing code will need to be changed to run in the
background instead.
2020-07-12 20:06:04 +10:00
Damien Elmes
bbc75cdf5d update rslib/rspy deps 2020-07-12 11:38:25 +10:00
Damien Elmes
349eca843b get i18n working in typescript 2020-06-29 15:48:01 +10:00
Damien Elmes
fefc6dbdc2 bump rust nightly version 2020-06-29 15:48:01 +10:00
Damien Elmes
fd258d15c5 some initial work on updating the graphs 2020-06-29 15:48:00 +10:00
Damien Elmes
f5694a7e4a migrate card stats to backend
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
07874f8328 handle db errors the same way as other backend requests 2020-06-12 20:39:02 +10:00
Damien Elmes
dc8297644b pass db json back as bytes 2020-06-12 20:20:29 +10:00
Damien Elmes
4092da9dbe use vendored hyper for panic fix 2020-06-11 13:30:35 +10:00
Damien Elmes
e74e5c604b add daily count updating to backend 2020-06-05 19:49:53 +10:00
Damien Elmes
c5e65d02e1 add note/card removal to backend 2020-06-04 18:21:04 +10:00
Damien Elmes
ad3082d1c8 handle aborting normal sync
- Use a separate abort handle, as the media sync is running
in the background and we need to be able to target them separately.
The current progress handling is going to need a rethink if we introduce
any other background tasks in the future.
- Roll back the transaction when interrupting.
2020-06-01 13:57:10 +10:00
Damien Elmes
aaed0464e5 rework progress handling
- client now polls status instead of backend pushing it
- supports multiple threads
- update throttling happens in one place
2020-06-01 13:57:10 +10:00
Damien Elmes
c4032c0176 another snapshot of sync work
progress handler is going to need to be reworked to function across
threads
2020-06-01 13:57:10 +10:00
Damien Elmes
2114fdf6f5 more syncing work
no checks yet
2020-06-01 13:57:10 +10:00
Damien Elmes
91e3256e6a move dupe check to backend 2020-05-24 19:48:56 +10:00
Damien Elmes
bbcc566e6d migrate the remaining methods 2020-05-24 08:36:50 +10:00
Damien Elmes
93f18c14d4 migrate more scheduling/media/etc
almost there
2020-05-23 21:34:19 +10:00
Damien Elmes
8b93a0c19d migrate notetypes, update GIL list 2020-05-23 20:43:55 +10:00
Damien Elmes
36024ed086 start reworking protobuf handling
Will allow us to cut down on boilerplate by automatically generating
code from RPC service definitions
2020-05-22 20:56:15 +10:00
Damien Elmes
3e156fdb49 bump version 2020-05-18 12:50:20 +10:00
Damien Elmes
c92b450479 rebuild rspy on sql change 2020-05-12 21:13:33 +10:00
Damien Elmes
27d2fb148a bump version 2020-05-11 19:28:17 +10:00
evandrocoan
a84308b43b We should not call clippy on Mac OS when running make check 2020-05-02 19:44:51 -03:00
evandrocoan
d62787aa49 Fixed rspy check not being called
# Conflicts:
#	Makefile
2020-05-01 22:51:17 -03:00
Damien Elmes
c2223610f1 bump version 2020-05-02 10:22:00 +10:00
Damien Elmes
69abc2e11b Merge pull request #600 from evandroforks/add_missing_wheels_anki_dependency
Add missing aqt and anki modules dependency requirements
2020-05-02 09:02:21 +10:00
Damien Elmes
722df62452 fix some clippy lints 2020-05-02 08:55:27 +10:00
evandrocoan
c250292cb5 Removes duplicated maturin build flags on rspy/Makefile 2020-05-01 01:46:30 -03:00
Damien Elmes
91248aa8cf bump version 2020-04-28 08:57:56 +10:00
Damien Elmes
858d470cdb Merge pull request #582 from evandroforks/fix_make_clean
Fixed make clean rule not working on Windows
2020-04-27 19:10:21 +10:00
evandrocoan
e85c48298c Fixed make clean rule not working on Windows 2020-04-26 03:02:02 -03:00
Damien Elmes
d29679b070 use same cargo rspy target dir for wheel build 2020-04-25 10:08:24 +10:00