1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! Command execution engine for mongosh
//!
//! This module provides the execution layer that processes parsed commands
//! and performs the corresponding MongoDB operations. It has been refactored
//! into separate sub-modules for better organization:
//!
//! ## Module Structure
//!
//! - `context`: ExecutionContext for managing state and connections
//! - `result`: Result types (ExecutionResult, ResultData, ExecutionStats)
//! - `router`: CommandRouter for dispatching commands to executors
//! - `confirmation`: User confirmation for dangerous operations
//! - `query`: QueryExecutor for CRUD operations
//! - `admin`: AdminExecutor for administrative commands
//! - `utility`: UtilityExecutor for utility commands
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────┐
//! │ Command │
//! └──────┬──────┘
//! │
//! ▼
//! ┌─────────────────┐
//! │ CommandRouter │
//! └────────┬────────┘
//! │
//! ┌─────┴─────┬──────────┬─────────┐
//! ▼ ▼ ▼ ▼
//! ┌──────┐ ┌───────┐ ┌───────┐ ┌────────┐
//! │Query │ │Admin │ │Utility│ │Help │
//! │Exec │ │Exec │ │Exec │ │ │
//! └──────┘ └───────┘ └───────┘ └────────┘
//! │ │ │ │
//! └──────────┴──────────┴──────────┘
//! │
//! ▼
//! ┌──────────────┐
//! │ExecutionResult│
//! └──────────────┘
//! ```
//!
//! ## Usage Example
//!
//! ```rust,no_run
//! use mongosh::executor::ExecutionContext;
//! use mongosh::connection::ConnectionManager;
//! use mongosh::repl::SharedState;
//! use mongosh::parser::Command;
//!
//! async fn example(conn: ConnectionManager, state: SharedState) {
//! let context = ExecutionContext::new(conn, state);
//! let command = Command::Help(None);
//! let result = context.execute(command).await.unwrap();
//! println!("{:?}", result);
//! }
//! ```
// Module declarations
// Re-export public types
pub use ExecutionContext;
pub use run_killable_command;
pub use ;
pub use CommandRouter;
// ExecutionStats is part of the public API (used in lib and tests)
// but not directly used by the bin target, so we suppress the bin warning
pub use ExecutionStats;
// Re-export for convenience
use crateResult;
use crateCommand;