Commit graph

204 commits

Author SHA1 Message Date
Damien Elmes
1800f30776 correctly detect when we don't have a deck conf 2012-01-30 07:31:15 +09:00
Damien Elmes
3c995017fe force save after sync 2012-01-26 08:07:27 +09:00
Damien Elmes
19435068bb break removals into separate sync step 2011-12-14 11:42:19 +09:00
Damien Elmes
dc89e34410 fix deck conf syncing 2011-12-13 13:58:31 +09:00
Damien Elmes
bacbea13e0 conf() -> confForDid(); add getConf() 2011-12-13 13:56:05 +09:00
Damien Elmes
0a677fee56 sync tweaks 2011-12-13 10:44:50 +09:00
Damien Elmes
08660f6bf8 test db integrity before upload 2011-12-08 01:06:33 +09:00
Damien Elmes
6ce8c9b608 drop tags from sanity check
Since we rely on fixIntegrity() to garbage-collect tags and don't try to add
unused ones to the graves, after a check the tag counts will fall out of sync.
2011-12-07 18:33:43 +09:00
Damien Elmes
593e45a9bb decrease timeout to 30; httplib2 retries for us 2011-12-07 18:08:15 +09:00
Damien Elmes
4b190c3586 run all sync requests through one function 2011-12-07 17:57:07 +09:00
Damien Elmes
9b76a4669c compress zip, add media sanity check 2011-12-06 23:36:01 +09:00
Damien Elmes
fabec6e920 more sync resuming changes
The server now returns the next usn after every addFiles(), so an interrupted
upload doesn't cause the uploaded material to be sent back down.
2011-12-06 23:04:26 +09:00
Damien Elmes
be66c960a9 rework media syncing so we can resume 2011-12-06 22:18:41 +09:00
Damien Elmes
c0edcae238 fix some sync bugs
- don't send server graves graves back on the next sync
- make sure we update usns of models/tags/decks as well on upload
- don't die when updating decks after current deck deleted
- report counts when sanity check fails
2011-12-06 01:35:54 +09:00
Damien Elmes
4a88885e83 default to compression level 6 2011-12-06 00:05:39 +09:00
Damien Elmes
8308c79fa6 minor refactor of count handling
- drop lrnCount; rename lrnRepCount to lrnCount
- on card fetch, decr count by card.left
- drop cardCounts(), rename repCounts() to just counts()
- fix lrn count bugs
2011-12-05 19:15:46 +09:00
Damien Elmes
41636f41f8 tweak sync error handling 2011-12-05 17:44:54 +09:00
Damien Elmes
0395047579 initial usn is 0, so distinguish between 0 and false 2011-12-05 15:27:06 +09:00
Damien Elmes
b33c2e99c0 return false, not 'continue', when not finished 2011-12-05 14:43:32 +09:00
Damien Elmes
1ec747dbb4 tweak sync hooks 2011-12-04 15:56:38 +09:00
Damien Elmes
6bad4cc8c2 fix sanity check 2011-12-04 15:23:43 +09:00
Damien Elmes
9d5357f7a6 after a save, revert to unmodified state; sync tweaks 2011-12-04 14:56:12 +09:00
Damien Elmes
8fff05618c check download before overwrite 2011-12-03 22:15:36 +09:00
Damien Elmes
6965a9c102 sync tweaks 2011-12-03 21:06:27 +09:00
Damien Elmes
d148a6cf1b bundle ssl certs; share con across all sync types 2011-12-03 16:38:45 +09:00
Damien Elmes
92352d4725 convert guid to base 91 string
Because JSON doesn't support 64 bit numbers, we need to either convert the 64
bit numbers to a string during transport, or store the ids as a string. At
base 91 a 64 bit number only takes an extra two bytes, and it means we can
dump DB results directly into JSON without having to apply any transformation.
2011-12-03 14:25:18 +09:00
Damien Elmes
b5c0b1f2c7 drop required/unique field properties
Instead of having required and unique flags for every field, enforce both
requirements on the first field, and neither on the rest. This mirrors the
subject/body format people are used to in note-taking apps. The subject
defines the object being learnt, and the remaining fields represent properties
of that object.

In the past, duplicate checking served two purposes: it quickly notified the
user that they're entering the same fact twice, and it notified the user if
they'd accidentally mistyped a secondary field. The former behaviour is
important for avoiding wasted effort, and so it should be done in real time.
The latter behaviour is not essential however - a typo is not wasted effort,
and it could be fixed in a periodic 'find duplicates' function. Given that
some users ended up with sluggish decks due to the overhead a large number of
facts * a large number of unique fields caused, this seems like a change for
the better.

This also means Anki will let you add notes as long as as the first field has
been filled out. Again, this is not a big deal: Anki is still checking to make
sure one or more cards will be generated, and the user can easily add any
missing fields later.

As a bonus, this change simplifies field configuration somewhat. As the card
layout and field dialogs are a popular point of confusion, the more they can
be simplified, the better.
2011-11-24 22:16:03 +09:00
Damien Elmes
f7790275ce groups -> decks 2011-11-23 19:28:09 +09:00
Damien Elmes
279a942642 deck -> collection 2011-11-23 17:47:44 +09:00
Damien Elmes
6e4e8249fb facts -> notes 2011-11-23 12:37:21 +09:00
Damien Elmes
c6c6af4328 split remote sync tests into separate file 2011-11-07 16:21:29 +09:00
Damien Elmes
0c85acf3f7 refactor to support early exit when no media changes
- regular sync now receives a media USN as well
- server bumps media usn not only on sync but any other media change
- added local media.hasChanged()
2011-10-06 15:34:22 +09:00
Damien Elmes
b4fdf1c690 send 'continue' for multiple zips; test splitting 2011-10-06 13:51:44 +09:00
Damien Elmes
8c1f397459 ensure successive calls work 2011-10-06 13:25:01 +09:00
Damien Elmes
0a52f55e50 test removing too 2011-10-06 13:06:32 +09:00
Damien Elmes
eca6ef204f check file is added on remote test 2011-10-03 13:42:53 +09:00
Damien Elmes
49181ee738 fix media zipping and addFiles call 2011-10-03 12:59:35 +09:00
Damien Elmes
5da3bba1df initial work on media syncing 2011-10-03 12:45:08 +09:00
Damien Elmes
a8d2578be5 move common auth+upload code into base class 2011-10-01 22:16:56 +09:00
Damien Elmes
bf3bb9dd32 if sync server offline, abort sync tests 2011-10-01 20:44:35 +09:00
Damien Elmes
f131021c7e remote partial syncing working; fixed mod time on finish() 2011-10-01 14:24:39 +09:00
Damien Elmes
dd5b2056fb factor out file uploads; use for incremental sync too 2011-09-30 21:09:10 +09:00
Damien Elmes
20d753591d add timestamp & common error checks to meta(); kill old code 2011-09-29 22:18:36 +09:00
Damien Elmes
aabc884341 start work on remote syncing; full up/down implemented 2011-09-29 20:58:42 +09:00
Damien Elmes
22df2790f9 refactor media change logging 2011-09-25 06:33:57 +09:00
Damien Elmes
9fdfac722d fixed bug in bundling 2011-09-24 14:46:42 +09:00
Damien Elmes
667b89ecc5 support partial syncs of arbitrary size
The full sync threshold was a hack to ensure we synced the deck in a
memory-efficient way if there was a lot of data to send. The problem is that
it's not easy for the user to predict how many changes there are, and so it
might come as a surprise to them when a sync suddenly switches to a full sync.

In order to be able to send changes in chunks rather than all at once, some
changes had to be made:

- Clients now set usn=-1 when they modify an object, which allows us to
  distinguish between objects that have been modified on the server, and ones
  that have been modified on the client. If we don't do this, we would have to
  buffer the local changes in a temporary location before adding the server
  changes.
- Before a client sends the objects to the server, it changes the usn to
  maxUsn both in the payload and the local storage.
- We do deletions at the start
- To determine which card or fact is newer, we have to fetch the modification
  time of the local version. We do this in batches rather than try to load the
  entire list in memory.
2011-09-24 12:42:02 +09:00
Damien Elmes
e7f416406d refactor learning
Rather than showing the user how many cards are in the learning queue, we want
to be able to show them the number of reps they have to do to clear the queue,
so they can better estimate the required time. Before we were counting up with
the grade column, but this means we can't quickly sum up the number of reps
left. So we invert it, and count down instead.

I also dropped the 'first time bonus' for now. If there's enough demand for
it, it can be added back by using the flags column, instead of a dedicated
cycles column.
2011-09-23 10:29:49 +09:00
Damien Elmes
3e5041f337 reduce default cache size
Use a more conservative 40MB for systems with a smaller amount of memory.
Ideally we should bump this up if we detect the running system has a decent
amount of memory.
2011-09-18 05:07:30 +09:00
Damien Elmes
2e628996a3 add flags back to cards, and fix syncing 2011-09-18 04:37:48 +09:00