Anki/proto/anki/config.proto
Jake Probst c6cb4e4373
load balancer! (#3230)
* start of load balancer

* add configuration options; option to load balance per deck

* formatting

* clippy

* add myself to contributors

* cleanup

* cargo fmt

* copyright header on load_balancer.rs

* remove extra space

* more formatting

* python formatting

* ignore this being None

only doing this cause python has awful lambdas and can't
loop in a meaningful way without doing this

* only calculate notes on each day if we are trying to avoid siblings

* don't fuzz intervals if the load balancer is enabled

* force generator to eval so this actually happens

* load balance instead of fuzzing, rather than in addition to

* use builtin fuzz_bounds rather than reinvent something new

* print some debug info on how its load balancing

* clippy

* more accurately load balance only when we want to fuzz

* incorrectly doublechecking the presence of the load balancer

* more printfs for debugging

* avoid siblings -> disperse siblings

* load balance learning graduating intervals

* load balancer: respect min/max intervals; graduating easy should be at least +1 good

* filter out after-days under minimum interval

* this is an inclusive check

* switch load balancer to caching instead of on the fly calculation

* handle case where load balancer would balance outside of its bounds

* disable lb when unselecting it in preferences

* call load_balancer in StateContext::with_review_fuzz instead of next to

* rebuild load balancer when card queue is rebuilt

* remove now-unused configuration options

* add note option to notetype to enable/disable sibling dispersion

* add options to exclude decks from load balancing

* theres a lint checking that the link actually exists so I guess I'll add the anchor back in later?

* how did I even update this

* move load balancer to cardqueue

* remove per-deck balancing options

* improve determining whether to disperse siblings when load balancing

* don't recalculate notes on days every time

* remove debug code

* remove all configuration; load balancer enabled by default; disperse siblings if bury_reviews is set

* didn't fully remove caring about decks from load balancer sql query

* load balancer should only count cards in the same preset

* fuzz interval if its outside of load balancer's range

* also check minimum when bailing out of load balancer

* cleanup; make tests happy

* experimental weight-based load balance fuzzing

* take into account interval when weighting as it seems to help

* if theres no cards the interval weight is just 1.0

* make load balancer disableable through debug console

* remove debug prints

* typo

* remove debugging print

* explain a bit how load balancer works

* properly balance per preset

* use inclusive range rather than +1

* -1 type cast

* move type hint somewhere less ugly; fix comment typo

* Reuse existing deck list from parent function (dae)

Minor optimisation
2024-08-17 12:50:54 +07:00

140 lines
3.6 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.config;
import "anki/generic.proto";
import "anki/collection.proto";
service ConfigService {
rpc GetConfigJson(generic.String) returns (generic.Json);
rpc SetConfigJson(SetConfigJsonRequest) returns (collection.OpChanges);
rpc SetConfigJsonNoUndo(SetConfigJsonRequest) returns (generic.Empty);
rpc RemoveConfig(generic.String) returns (collection.OpChanges);
rpc GetAllConfig(generic.Empty) returns (generic.Json);
rpc GetConfigBool(GetConfigBoolRequest) returns (generic.Bool);
rpc SetConfigBool(SetConfigBoolRequest) returns (collection.OpChanges);
rpc GetConfigString(GetConfigStringRequest) returns (generic.String);
rpc SetConfigString(SetConfigStringRequest) returns (collection.OpChanges);
rpc GetPreferences(generic.Empty) returns (Preferences);
rpc SetPreferences(Preferences) returns (collection.OpChanges);
}
// Implicitly includes any of the above methods that are not listed in the
// backend service.
service BackendConfigService {}
message ConfigKey {
enum Bool {
BROWSER_TABLE_SHOW_NOTES_MODE = 0;
PREVIEW_BOTH_SIDES = 3;
COLLAPSE_TAGS = 4;
COLLAPSE_NOTETYPES = 5;
COLLAPSE_DECKS = 6;
COLLAPSE_SAVED_SEARCHES = 7;
COLLAPSE_TODAY = 8;
COLLAPSE_CARD_STATE = 9;
COLLAPSE_FLAGS = 10;
SCHED_2021 = 11;
ADDING_DEFAULTS_TO_CURRENT_DECK = 12;
HIDE_AUDIO_PLAY_BUTTONS = 13;
INTERRUPT_AUDIO_WHEN_ANSWERING = 14;
PASTE_IMAGES_AS_PNG = 15;
PASTE_STRIPS_FORMATTING = 16;
NORMALIZE_NOTE_TEXT = 17;
IGNORE_ACCENTS_IN_SEARCH = 18;
RESTORE_POSITION_BROWSER = 19;
RESTORE_POSITION_REVIEWER = 20;
RESET_COUNTS_BROWSER = 21;
RESET_COUNTS_REVIEWER = 22;
RANDOM_ORDER_REPOSITION = 23;
SHIFT_POSITION_OF_EXISTING_CARDS = 24;
RENDER_LATEX = 25;
LOAD_BALANCER_ENABLED = 26;
}
enum String {
SET_DUE_BROWSER = 0;
SET_DUE_REVIEWER = 1;
DEFAULT_SEARCH_TEXT = 2;
CARD_STATE_CUSTOMIZER = 3;
}
}
message GetConfigBoolRequest {
ConfigKey.Bool key = 1;
}
message SetConfigBoolRequest {
ConfigKey.Bool key = 1;
bool value = 2;
bool undoable = 3;
}
message GetConfigStringRequest {
ConfigKey.String key = 1;
}
message SetConfigStringRequest {
ConfigKey.String key = 1;
string value = 2;
bool undoable = 3;
}
message OptionalStringConfigKey {
ConfigKey.String key = 1;
}
message SetConfigJsonRequest {
string key = 1;
bytes value_json = 2;
bool undoable = 3;
}
message Preferences {
message Scheduling {
enum NewReviewMix {
DISTRIBUTE = 0;
REVIEWS_FIRST = 1;
NEW_FIRST = 2;
}
uint32 rollover = 2;
uint32 learn_ahead_secs = 3;
NewReviewMix new_review_mix = 4;
// v2 only
bool new_timezone = 5;
bool day_learn_first = 6;
}
message Reviewing {
bool hide_audio_play_buttons = 1;
bool interrupt_audio_when_answering = 2;
bool show_remaining_due_counts = 3;
bool show_intervals_on_buttons = 4;
uint32 time_limit_secs = 5;
bool load_balancer_enabled = 6;
}
message Editing {
bool adding_defaults_to_current_deck = 1;
bool paste_images_as_png = 2;
bool paste_strips_formatting = 3;
string default_search_text = 4;
bool ignore_accents_in_search = 5;
bool render_latex = 6;
}
message BackupLimits {
uint32 daily = 1;
uint32 weekly = 2;
uint32 monthly = 3;
uint32 minimum_interval_mins = 4;
}
Scheduling scheduling = 1;
Reviewing reviewing = 2;
Editing editing = 3;
BackupLimits backups = 4;
}