@@ -45,6 +45,21 @@ pub enum DaemonCliCommand {
4545 #[ clap( long, short = 'p' ) ]
4646 port : Option < u16 > ,
4747 } ,
48+ // These variants for Restart/Reload directly under DaemonCliCommand
49+ // are only for `graphdb-cli daemon restart` and `graphdb-cli daemon reload`.
50+ // The main `graphdb-cli restart` command uses RestartArgs/RestartAction.
51+ Restart {
52+ #[ clap( long, short = 'p' ) ]
53+ port : Option < u16 > ,
54+ #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
55+ cluster : Option < String > ,
56+ } ,
57+ Reload {
58+ #[ clap( long, short = 'p' ) ]
59+ port : Option < u16 > ,
60+ #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
61+ cluster : Option < String > ,
62+ } ,
4863 List ,
4964 ClearAll ,
5065}
@@ -203,67 +218,68 @@ pub enum ReloadAction {
203218 #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
204219 cluster : Option < String > ,
205220 #[ clap( long) ]
206- rest : Option < bool > ,
221+ rest : Option < bool > , // Should these apply to daemon? Usually not
207222 #[ clap( long) ]
208- storage : Option < bool > ,
223+ storage : Option < bool > , // Should these apply to daemon? Usually not
209224 } ,
210225 Rest {
211226 #[ clap( long, short = 'p' ) ]
212227 port : Option < u16 > ,
213228 #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
214- cluster : Option < String > ,
229+ cluster : Option < String > , // Cluster generally applies to storage/daemon, less to rest directly
215230 #[ clap( long) ]
216- daemon : Option < bool > ,
231+ daemon : Option < bool > , // Should these apply to rest? Usually not
217232 #[ clap( long) ]
218- storage : Option < bool > ,
233+ storage : Option < bool > , // Should these apply to rest? Usually not
219234 } ,
220235 Storage {
221236 #[ clap( long, short = 'p' ) ]
222237 port : Option < u16 > ,
223238 #[ clap( long, value_hint = clap:: ValueHint :: FilePath ) ]
224239 config_file : Option < PathBuf > ,
225240 #[ clap( long) ]
226- daemon : Option < bool > ,
241+ daemon : Option < bool > , // Should these apply to storage? Usually not
227242 #[ clap( long) ]
228- rest : Option < bool > ,
243+ rest : Option < bool > , // Should these apply to storage? Usually not
229244 } ,
230245 Cluster ,
231246}
232247
233248#[ derive( Debug , Args , PartialEq ) ]
234249pub struct RestartArgs {
235250 #[ clap( subcommand) ]
236- pub action : Option < RestartAction > ,
251+ pub action : Option < RestartAction > , // Make action optional to allow top-level flags
252+ // Top-level flags that apply if no subcommand is given (implies RestartAction::All)
237253 #[ clap( long, short = 'p' ) ]
238254 pub port : Option < u16 > ,
239255 #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
240256 pub cluster : Option < String > ,
241257 #[ clap( long) ]
242- pub config_file : Option < PathBuf > ,
258+ pub config_file : Option < PathBuf > , // General config for all or specific?
243259 #[ clap( long) ]
244- pub listen_port : Option < u16 > ,
260+ pub listen_port : Option < u16 > , // For daemon/rest
245261 #[ clap( long) ]
246- pub storage_port : Option < u16 > ,
262+ pub storage_port : Option < u16 > , // For storage
247263 #[ clap( long, value_hint = clap:: ValueHint :: FilePath ) ]
248- pub storage_config_file : Option < PathBuf > ,
264+ pub storage_config_file : Option < PathBuf > , // Specific for storage
249265 #[ clap( long, value_hint = clap:: ValueHint :: DirPath ) ]
250- pub data_directory : Option < String > ,
266+ pub data_directory : Option < String > , // Specific for storage
251267 #[ clap( long, value_hint = clap:: ValueHint :: DirPath ) ]
252- pub log_directory : Option < String > ,
268+ pub log_directory : Option < String > , // Specific for storage/daemon/rest
253269 #[ clap( long) ]
254- pub max_disk_space_gb : Option < u64 > ,
270+ pub max_disk_space_gb : Option < u64 > , // Specific for storage
255271 #[ clap( long) ]
256- pub min_disk_space_gb : Option < u64 > ,
272+ pub min_disk_space_gb : Option < u64 > , // Specific for storage
257273 #[ clap( long) ]
258- pub use_raft_for_scale : Option < bool > ,
274+ pub use_raft_for_scale : Option < bool > , // Specific for storage
259275 #[ clap( long) ]
260- pub storage_engine_type : Option < String > ,
276+ pub storage_engine_type : Option < String > , // Specific for storage
261277 #[ clap( long) ]
262- pub daemon : Option < bool > ,
278+ pub daemon : Option < bool > , // Used with `restart all` or top-level to explicitly target daemon
263279 #[ clap( long) ]
264- pub rest : Option < bool > ,
280+ pub rest : Option < bool > , // Used with `restart all` or top-level to explicitly target rest
265281 #[ clap( long) ]
266- pub storage : Option < bool > ,
282+ pub storage : Option < bool > , // Used with `restart all` or top-level to explicitly target storage
267283}
268284
269285#[ derive( Debug , Subcommand , PartialEq ) ]
@@ -305,8 +321,12 @@ pub enum RestartAction {
305321 port : Option < u16 > ,
306322 #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
307323 cluster : Option < String > ,
324+ // These fields (rest, storage) might be redundant/confusing under Daemon
325+ // as they imply restarting other services *from* the daemon command.
326+ // If the intent is `restart daemon --rest --storage`, it's better handled by `restart all --daemon --rest --storage`.
327+ // I'll leave them for now as they were in your previous version, but note the ambiguity.
308328 #[ clap( long) ]
309- daemon : Option < bool > ,
329+ daemon : Option < bool > , // Redundant, implied by Daemon subcommand
310330 #[ clap( long) ]
311331 rest : Option < bool > ,
312332 #[ clap( long) ]
@@ -316,11 +336,11 @@ pub enum RestartAction {
316336 #[ clap( long, short = 'p' ) ]
317337 port : Option < u16 > ,
318338 #[ clap( long, short = 'c' , alias = "join-cluster" ) ]
319- cluster : Option < String > ,
339+ cluster : Option < String > , // Cluster usually not directly relevant for REST but kept for consistency
320340 #[ clap( long) ]
321- daemon : Option < bool > ,
341+ daemon : Option < bool > , // Redundant here
322342 #[ clap( long) ]
323- storage : Option < bool > ,
343+ storage : Option < bool > , // Redundant here
324344 } ,
325345 Storage {
326346 #[ clap( long, short = 'p' ) ]
@@ -342,11 +362,11 @@ pub enum RestartAction {
342362 #[ clap( long) ]
343363 storage_engine_type : Option < String > ,
344364 #[ clap( long) ]
345- daemon : Option < bool > ,
365+ daemon : Option < bool > , // Redundant here
346366 #[ clap( long) ]
347- rest : Option < bool > ,
367+ rest : Option < bool > , // Redundant here
348368 } ,
349- Cluster ,
369+ Cluster , // A restart for the entire cluster (could imply specific actions on all nodes)
350370}
351371
352372#[ derive( Debug , Args , PartialEq ) ]
0 commit comments