feat: 跨实例同步移植 WIP 检查点(第1轮+2a+2b+synced_servers)
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
从 Axolotl 移植跨实例同步子系统,当前进度: - 第1轮:synced_options/files.rs + mod.rs 骨架,state 层补齐 SyncedOption/InstanceSyncedOptions/CanonicalValue/GameOptionKind 等 - 2a:game_options 的 api_types/options_file/catalog(10文件) - 2b:game_options 除 resource_pack_options/local_settings_editor 外的全部(settings_editor/write_shared_settings/fullscreen/launch_overrides/instance_support/read_instance_changes/pack_updates/source_selection + locales/5文件);State 补 synced_options_lock/game_locale_indexer/lock_synced_options - synced_servers:6 文件全部搬入 - 35+20 处 sqlx::query! 宏改写为非宏 query+bind 已知未完成:synced_servers::operations 依赖 synced_options::instance_option_supported(属 orchestration,第5轮),当前编译不通。
This commit is contained in:
1 parent
5a289c3a15
commit
ed61a5942c
43 files changed
+10607
No files matched your search
@@ -0,0 +1,52 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", content = "value", rename_all = "snake_case")]
|
||||
pub enum CanonicalValue {
|
||||
Bool(bool),
|
||||
Integer(i64),
|
||||
Decimal(String),
|
||||
Enum(String),
|
||||
Text(String),
|
||||
StringList(Vec<String>),
|
||||
KeyBinding(String),
|
||||
ExternalRaw(String),
|
||||
}
|
||||
|
||||
impl CanonicalValue {
|
||||
pub(crate) fn type_name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Bool(_) => "bool",
|
||||
Self::Integer(_) => "integer",
|
||||
Self::Decimal(_) => "decimal",
|
||||
Self::Enum(_) => "enum",
|
||||
Self::Text(_) => "text",
|
||||
Self::StringList(_) => "string_list",
|
||||
Self::KeyBinding(_) => "key_binding",
|
||||
Self::ExternalRaw(_) => "external_raw",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum GameOptionKind {
|
||||
Vanilla,
|
||||
External,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct StoredOption {
|
||||
pub(crate) option_id: String,
|
||||
pub(crate) kind: GameOptionKind,
|
||||
pub(crate) raw_key: Option<String>,
|
||||
pub(crate) value: Option<CanonicalValue>,
|
||||
pub(crate) seeded: bool,
|
||||
pub(crate) revision: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct StoredPreference {
|
||||
pub(crate) enabled: bool,
|
||||
pub(crate) revision: u64,
|
||||
}
|
||||
Reference in new issue
Block a user