Anki/proto/anki/collection.proto
Damien Elmes 5004cd332b
Integrate FSRS into Anki (#2654)
* Pack FSRS data into card.data

* Update FSRS card data when preset or weights change

+ Show FSRS stats in card stats

* Show a warning when there's a limited review history

* Add some translations; tweak UI

* Fix default requested retention

* Add browser columns, fix calculation of R

* Property searches

eg prop:d>0.1

* Integrate FSRS into reviewer

* Warn about long learning steps

* Hide minimum interval when FSRS is on

* Don't apply interval multiplier to FSRS intervals

* Expose memory state to Python

* Don't set memory state on new cards

* Port Jarret's new tests; add some helpers to make tests more compact

https://github.com/open-spaced-repetition/fsrs-rs/pull/64

* Fix learning cards not being given memory state

* Require update to v3 scheduler

* Don't exclude single learning step when calculating memory state

* Use relearning step when learning steps unavailable

* Update docstring

* fix single_card_revlog_to_items (#2656)

* not need check the review_kind for unique_dates

* add email address to CONTRIBUTORS

* fix last first learn & keep early review

* cargo fmt

* cargo clippy --fix

* Add Jarrett to about screen

* Fix fsrs_memory_state being initialized to default in get_card()

* Set initial memory state on graduate

* Update to latest FSRS

* Fix experiment.log being empty

* Fix broken colpkg imports

Introduced by "Update FSRS card data when preset or weights change"

* Update memory state during (re)learning; use FSRS for graduating intervals

* Reset memory state when cards are manually rescheduled as new

* Add difficulty graph; hide eases when FSRS enabled

* Add retrievability graph

* Derive memory_state from revlog when it's missing and shouldn't be

---------

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
2023-09-16 16:09:26 +10:00

158 lines
4 KiB
Protocol Buffer

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
syntax = "proto3";
option java_multiple_files = true;
package anki.collection;
import "anki/generic.proto";
import "anki/sync.proto";
service CollectionService {
rpc CheckDatabase(generic.Empty) returns (CheckDatabaseResponse);
rpc GetUndoStatus(generic.Empty) returns (UndoStatus);
rpc Undo(generic.Empty) returns (OpChangesAfterUndo);
rpc Redo(generic.Empty) returns (OpChangesAfterUndo);
rpc AddCustomUndoEntry(generic.String) returns (generic.UInt32);
rpc MergeUndoEntries(generic.UInt32) returns (OpChanges);
rpc LatestProgress(generic.Empty) returns (Progress);
rpc SetWantsAbort(generic.Empty) returns (generic.Empty);
}
// Implicitly includes any of the above methods that are not listed in the
// backend service.
service BackendCollectionService {
rpc OpenCollection(OpenCollectionRequest) returns (generic.Empty);
rpc CloseCollection(CloseCollectionRequest) returns (generic.Empty);
// Create a no-media backup. Caller must ensure there is no active
// transaction. Unlike a collection export, does not require reopening the DB,
// as there is no downgrade step.
// Returns false if it's not time to make a backup yet.
rpc CreateBackup(CreateBackupRequest) returns (generic.Bool);
// If a backup is running, wait for it to complete. Will return an error
// if the backup encountered an error.
rpc AwaitBackupCompletion(generic.Empty) returns (generic.Empty);
rpc LatestProgress(generic.Empty) returns (Progress);
rpc SetWantsAbort(generic.Empty) returns (generic.Empty);
}
message OpenCollectionRequest {
string collection_path = 1;
string media_folder_path = 2;
string media_db_path = 3;
}
message CloseCollectionRequest {
bool downgrade_to_schema11 = 1;
}
message CheckDatabaseResponse {
repeated string problems = 1;
}
message OpChanges {
bool card = 1;
bool note = 2;
bool deck = 3;
bool tag = 4;
bool notetype = 5;
bool config = 6;
bool deck_config = 11;
bool mtime = 12;
bool browser_table = 7;
bool browser_sidebar = 8;
// editor and displayed card in review screen
bool note_text = 9;
// whether to call .reset() and getCard()
bool study_queues = 10;
}
// Allows frontend code to extract changes from other messages like
// ImportResponse without decoding other potentially large fields.
message OpChangesOnly {
collection.OpChanges changes = 1;
}
message OpChangesWithCount {
OpChanges changes = 1;
uint32 count = 2;
}
message OpChangesWithId {
OpChanges changes = 1;
int64 id = 2;
}
message UndoStatus {
string undo = 1;
string redo = 2;
uint32 last_step = 3;
}
message OpChangesAfterUndo {
OpChanges changes = 1;
string operation = 2;
int64 reverted_to_timestamp = 3;
UndoStatus new_status = 4;
uint32 counter = 5;
}
message Progress {
message FullSync {
uint32 transferred = 1;
uint32 total = 2;
}
message NormalSync {
string stage = 1;
string added = 2;
string removed = 3;
}
message DatabaseCheck {
string stage = 1;
uint32 stage_total = 2;
uint32 stage_current = 3;
}
oneof value {
generic.Empty none = 1;
sync.MediaSyncProgress media_sync = 2;
string media_check = 3;
FullSync full_sync = 4;
NormalSync normal_sync = 5;
DatabaseCheck database_check = 6;
string importing = 7;
string exporting = 8;
ComputeWeightsProgress compute_weights = 9;
ComputeRetentionProgress compute_retention = 10;
ComputeMemoryProgress compute_memory = 11;
}
}
message ComputeWeightsProgress {
uint32 current = 1;
uint32 total = 2;
uint32 fsrs_items = 3;
}
message ComputeRetentionProgress {
uint32 current = 1;
uint32 total = 2;
}
message ComputeMemoryProgress {
uint32 current_cards = 1;
uint32 total_cards = 2;
string label = 3;
}
message CreateBackupRequest {
string backup_folder = 1;
// Create a backup even if the configured interval hasn't elapsed yet.
bool force = 2;
bool wait_for_completion = 3;
}