File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1- 260209.0
1+ 260209.1
Original file line number Diff line number Diff line change 77} ;
88
99mod deploy;
10+ mod maintenance;
1011mod migration;
1112mod operator;
1213mod ownership;
@@ -39,6 +40,10 @@ enum Command {
3940 #[ command( subcommand) ]
4041 Migration ( migration:: Command ) ,
4142
43+ /// Maintenance scheduling
44+ #[ command( subcommand) ]
45+ Maintenance ( maintenance:: Command ) ,
46+
4247 /// Cluster settings management
4348 #[ command( subcommand) ]
4449 Settings ( settings:: Command ) ,
@@ -137,6 +142,7 @@ async fn main() -> anyhow::Result<()> {
137142 Command :: View ( args) => view:: execute ( args) . await ,
138143 Command :: Operator ( cmd) => operator:: execute ( cmd) . await ,
139144 Command :: Migration ( cmd) => migration:: execute ( cmd) . await ,
145+ Command :: Maintenance ( cmd) => maintenance:: execute ( cmd) . await ,
140146 Command :: Settings ( cmd) => settings:: execute ( cmd) . await ,
141147 Command :: Ownership ( cmd) => ownership:: execute ( cmd) . await ,
142148 }
Original file line number Diff line number Diff line change 1+ use { crate :: ClusterArgs , anyhow:: Context , clap:: Subcommand } ;
2+
3+ #[ derive( Debug , Subcommand ) ]
4+ pub ( super ) enum Command {
5+ /// Start maintenance
6+ Start ( ClusterArgs ) ,
7+
8+ /// Finish maintenance
9+ Finish ( ClusterArgs ) ,
10+ }
11+
12+ pub ( super ) async fn execute ( cmd : Command ) -> anyhow:: Result < ( ) > {
13+ match cmd {
14+ Command :: Start ( args) => start_maintenance ( args) . await ,
15+ Command :: Finish ( args) => finish_maintenance ( args) . await ,
16+ }
17+ }
18+
19+ async fn start_maintenance ( args : ClusterArgs ) -> anyhow:: Result < ( ) > {
20+ args. connect ( )
21+ . await ?
22+ . start_maintenance ( )
23+ . await
24+ . context ( "Cluster::start_maintenance" )
25+ }
26+
27+ async fn finish_maintenance ( args : ClusterArgs ) -> anyhow:: Result < ( ) > {
28+ args. connect ( )
29+ . await ?
30+ . finish_maintenance ( )
31+ . await
32+ . context ( "Cluster::finish_maintenance" )
33+ }
You can’t perform that action at this time.
0 commit comments