Commit Graph

101 Commits

Author SHA1 Message Date
Damien Elmes
22d33a8000 we can optimize the dependencies separately (to an extent) 2020-10-09 20:02:15 +10:00
Damien Elmes
efc8e4fb28 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
53a984ba15 bump version 2020-10-02 10:22:21 +10:00
Damien Elmes
c125893eba bump version 2020-09-24 10:52:24 +10:00
Aleksa Sarai
16864e616f
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
312393e825
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
e4fa549af2 default to true in want_release_gil() 2020-09-01 10:24:38 +10:00
Damien Elmes
e5685254c6 reimplement congrats screen in Rust+Typescript 2020-09-01 10:24:38 +10:00
Damien Elmes
819dce3ab6 bump version 2020-08-31 11:07:54 +10:00
Damien Elmes
7bcec00ef4 fix some clippy lints 2020-08-26 19:02:56 +10:00
Damien Elmes
7e6a65ed3d bump version 2020-08-26 08:05:45 +10:00
Damien Elmes
7d7c791504 bump version 2020-08-24 11:28:22 +10:00
Damien Elmes
b380f304bf bump version 2020-08-09 13:44:59 +10:00
Damien Elmes
227703f9fa bump version 2020-07-28 12:59:56 +10:00
Damien Elmes
412f1777bd bump version 2020-07-21 15:54:14 +10:00
Damien Elmes
1205db6484 panic fix was merged into hyper 0.13.7 2020-07-16 09:09:13 +10:00
Damien Elmes
0ddcab4863 ensure sys crates work on older Macs 2020-07-13 13:35:09 +10:00
Damien Elmes
17edbd119d 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
75443b5171 update rslib/rspy deps 2020-07-12 11:38:25 +10:00
Damien Elmes
41d77b0255 get i18n working in typescript 2020-06-29 15:48:01 +10:00
Damien Elmes
0a0a61b7f8 bump rust nightly version 2020-06-29 15:48:01 +10:00
Damien Elmes
510f8b86cb some initial work on updating the graphs 2020-06-29 15:48:00 +10:00
Damien Elmes
b51f03085e 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
8e895aa247 handle db errors the same way as other backend requests 2020-06-12 20:39:02 +10:00
Damien Elmes
cf6d4f1cb9 pass db json back as bytes 2020-06-12 20:20:29 +10:00
Damien Elmes
10a1d06dce use vendored hyper for panic fix 2020-06-11 13:30:35 +10:00
Damien Elmes
1fe18718f7 add daily count updating to backend 2020-06-05 19:49:53 +10:00
Damien Elmes
4a69b55a90 add note/card removal to backend 2020-06-04 18:21:04 +10:00
Damien Elmes
90e19daec2 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
ee6d7f82e7 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
b254b1f722 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
f10d0ee0cb more syncing work
no checks yet
2020-06-01 13:57:10 +10:00
Damien Elmes
c8d13209cd move dupe check to backend 2020-05-24 19:48:56 +10:00
Damien Elmes
89dde3aeb0 migrate the remaining methods 2020-05-24 08:36:50 +10:00
Damien Elmes
4bf8175bcb migrate more scheduling/media/etc
almost there
2020-05-23 21:34:19 +10:00
Damien Elmes
a105037ec9 migrate notetypes, update GIL list 2020-05-23 20:43:55 +10:00
Damien Elmes
9c20d9a02b 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
8bd5d756e2 bump version 2020-05-18 12:50:20 +10:00
Damien Elmes
09db596009 rebuild rspy on sql change 2020-05-12 21:13:33 +10:00
Damien Elmes
74c97ad6d3 bump version 2020-05-11 19:28:17 +10:00
evandrocoan
e4698b9997 We should not call clippy on Mac OS when running make check 2020-05-02 19:44:51 -03:00
evandrocoan
2008f2b7bc Fixed rspy check not being called
# Conflicts:
#	Makefile
2020-05-01 22:51:17 -03:00
Damien Elmes
b337dda8df bump version 2020-05-02 10:22:00 +10:00
Damien Elmes
0080db4c94
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
d7cdb10aa8 fix some clippy lints 2020-05-02 08:55:27 +10:00
evandrocoan
b6e7ab6a99 Removes duplicated maturin build flags on rspy/Makefile 2020-05-01 01:46:30 -03:00
Damien Elmes
00cf4fc585 bump version 2020-04-28 08:57:56 +10:00
Damien Elmes
abb80231a5
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
26480fb13c Fixed make clean rule not working on Windows 2020-04-26 03:02:02 -03:00
Damien Elmes
359b9f5cd5 use same cargo rspy target dir for wheel build 2020-04-25 10:08:24 +10:00