Mountain/Binary/IPC/ConfigurationSyncCommand.rs
1//! # ConfigurationSyncCommand
2//!
3//! Synchronizes configuration across the application.
4//!
5//! ## RESPONSIBILITIES
6//!
7//! ### Configuration Synchronization
8//! - Trigger configuration synchronization
9//! - Coordinate between configuration sources
10//! - Return sync status and conflicts
11//! - Handle offline/online state
12//!
13//! ## ARCHITECTURAL ROLE
14//!
15//! ### Position in Mountain
16//! - IPC wrapper command in Binary subsystem
17//! - Configuration synchronization endpoint
18//!
19//! ### Dependencies
20//! - crate::IPC::ConfigurationBridge: Synchronization logic
21//! - tauri: IPC framework
22//! - serde_json: JSON serialization
23//!
24//! ### Dependents
25//! - Wind frontend: Triggers configuration sync
26//! - Tauri IPC handler: Routes sync requests
27//!
28//! ## SECURITY
29//!
30//! ### Considerations
31//! - Validate configuration during sync
32//! - Prevent sync of sensitive data without encryption
33//!
34//! ## PERFORMANCE
35//!
36//! ### Considerations
37//! - Sync may involve network operations
38//! - Implement conflict detection early
39//! - Consider incremental sync for large configs
40
41use serde_json::Value;
42use tauri::AppHandle;
43
44/// Synchronize configuration.
45///
46/// This command triggers a configuration synchronization between different
47/// configuration sources through the ConfigurationBridge.
48///
49/// # Arguments
50///
51/// * `app_handle` - Tauri application handle
52///
53/// # Returns
54///
55/// Returns a JSON response indicating sync status, or an error string.
56///
57/// # Errors
58///
59/// Returns an error if:
60/// - Sync process fails
61/// - Network connectivity issues
62/// - Configuration conflicts cannot be resolved
63#[tauri::command]
64pub async fn MountainSynchronizeConfiguration(app_handle:AppHandle) -> Result<Value, String> {
65 crate::IPC::ConfigurationBridge::mountain_synchronize_configuration(app_handle).await
66}