feat: 跨实例同步移植 WIP 检查点(第1轮+2a+2b+synced_servers)
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:
AxTps committed 2026-10-03 22:18:37 +08:00
1 parent 5a289c3a15
commit ed61a5942c
43 files changed
+10607

No files matched your search

+21
View File
@@ -67,6 +67,9 @@ pub use self::mr_auth::*;
mod legacy_converter;
mod game_options;
pub use self::game_options::*;
pub mod attached_world_data;
pub mod server_join_log;
@@ -148,6 +151,9 @@ pub struct State {
configured_http_client_update: AsyncMutex<()>,
pub(crate) file_watcher: FileWatcher,
pub(crate) synced_options_lock: Arc<AsyncMutex<()>>,
pub(crate) game_locale_indexer: crate::api::instance::synced_options::game_options::locales::GameLocaleIndexer,
}
#[derive(Default)]
@@ -555,6 +561,12 @@ impl State {
))
}
pub(crate) async fn lock_synced_options(
&self,
) -> tokio::sync::OwnedMutexGuard<()> {
self.synced_options_lock.clone().lock_owned().await
}
pub fn initialized() -> bool {
LAUNCHER_STATE.initialized()
}
@@ -969,6 +981,13 @@ impl State {
}
}
pub(crate) async fn instance_has_running_process(
instance_id: &str,
state: &State,
) -> crate::Result<bool> {
Ok(state.process_manager.has_instance_process(instance_id))
}
#[cfg(test)]
pub(crate) async fn test_state(
directories: DirectoryInfo,
@@ -1016,6 +1035,8 @@ pub(crate) async fn test_state(
configured_http_client: RwLock::new(configured_http_client),
configured_http_client_update: AsyncMutex::new(()),
file_watcher,
synced_options_lock: Arc::new(AsyncMutex::new(())),
game_locale_indexer: Default::default(),
}))
}