Mountain/ApplicationState/State/mod.rs
1//! # State Module (ApplicationState)
2//!
3//! ## RESPONSIBILITIES
4//! Contains all state management sub-modules for the Mountain application.
5//! Each submodule represents a distinct domain-specific state area.
6//!
7//! ## KEY COMPONENTS
8//! - WorkspaceState: Workspace folders, trust, active document
9//! - ConfigurationState: Configuration, memento storage
10//! - ExtensionState: Extension registry, providers, scanned extensions
11//! - FeatureState: Diagnostics, documents, terminals, webviews, etc.
12//! - UIState: Pending UI requests
13//! - ApplicationState: Main state container (for backward compatibility)
14//!
15//! ## ARCHITECTURAL ROLE
16//! The State module is the **state organization layer** that groups related
17//! state components into logical domains:
18//!
19//! ```text
20//! ApplicationState
21//! │
22//! ├── WorkspaceState - Workspace folders, trust, active document
23//! ├── ConfigurationState - Configuration, memento storage
24//! ├── ExtensionState - Extension registry, providers, scanned extensions
25//! ├── FeatureState - Diagnostics, documents, terminals, webviews, etc.
26//! └── UIState - Pending UI requests
27//! ```
28//!
29//! ## KEY COMPONENTS
30//! - **WorkspaceState**: Workspace-related state
31//! - **ConfigurationState**: Configuration and storage state
32//! - **ExtensionState**: Extension management state (composite)
33//! - **FeatureState**: Feature-specific state (composite)
34//! - **UIState**: User interface request state
35//!
36//! ## ERROR HANDLING
37//! All state operations use `Arc<Mutex<...>>` for thread-safety with proper
38//! error handling via `MapLockError` helpers.
39//!
40//! ## LOGGING
41//! State operations are logged at appropriate levels (debug, info, warn,
42//! error).
43//!
44//! ## PERFORMANCE CONSIDERATIONS
45//! - Lock mutexes briefly and release immediately
46//! -Avoid nested locks to prevent deadlocks
47//! - Use `Arc` for shared ownership across threads
48//!
49//! ## TODO
50//! - [ ] Add state validation invariants
51//! - [ ] Implement state metrics collection
52//! - [ ] Add state diffing for debugging
53
54//! Workspace state management.
55pub mod WorkspaceState;
56
57/// Configuration and storage state.
58pub mod ConfigurationState;
59
60/// Extension management state.
61pub mod ExtensionState;
62
63/// Feature-specific state management.
64pub mod FeatureState;
65
66/// User interface request state.
67pub mod UIState;
68
69/// Main ApplicationState container for backward compatibility.
70pub mod ApplicationState;
71
72/// Re-export for backward compatibility
73pub use ApplicationState::*;