Refactor CLI: birdc-style help, collapsed nouns, ReloadConfig, bug fixes
maglevc - Rewrite '?' handler (birdc-style): show full command paths from current position to every leaf, right-aligned help column, dynamic slot values displayed as an indented block when cursor is at a slot position. - Collapse show frontends/frontend, backends/backend, healthchecks/healthcheck into single plural-noun nodes with an optional <name> slot. Allows 'sh ba' (list all) and 'sh ba nginx0' (show one) without ambiguity. - Add 'config reload' command. - Fix tabwriter ANSI alignment: continuation lines in transition output now carry the same label() byte overhead as the header line. - Fix broken Walk for 'set frontend' command: setFrontendPoolName and setWeightValue were fixed-word nodes that couldn't capture user input; mark them as slot nodes with dynNone. - Add tree_test.go covering expandPaths, cycle detection, prefix matching, and the full weight-command walk. gRPC / proto - Add ReloadConfig RPC: checks config then applies it to the running checker, returning ok/parse_error/semantic_error/reload_error. - Add logging to CheckConfig (config-check-start/config-check-done at INFO level). maglevd - SIGHUP handler now calls maglevServer.TriggerReload(), sharing the same code path as the gRPC ReloadConfig RPC. docs - Collapse show command documentation to use [<name>] optional syntax. - Remove developer-facing 'Command tree and parser' section. - Document 'config reload'.
This commit is contained in:
@@ -19,6 +19,7 @@ service Maglev {
|
||||
rpc SetFrontendPoolBackendWeight(SetWeightRequest) returns (FrontendInfo);
|
||||
rpc WatchEvents(WatchRequest) returns (stream Event);
|
||||
rpc CheckConfig(CheckConfigRequest) returns (CheckConfigResponse);
|
||||
rpc ReloadConfig(ReloadConfigRequest) returns (ReloadConfigResponse);
|
||||
}
|
||||
|
||||
// ---- requests ---------------------------------------------------------------
|
||||
@@ -53,6 +54,15 @@ message CheckConfigResponse {
|
||||
string semantic_error = 3; // set when YAML is valid but semantically incorrect
|
||||
}
|
||||
|
||||
message ReloadConfigRequest {}
|
||||
|
||||
message ReloadConfigResponse {
|
||||
bool ok = 1;
|
||||
string parse_error = 2; // set when YAML cannot be read or parsed
|
||||
string semantic_error = 3; // set when YAML is valid but semantically incorrect
|
||||
string reload_error = 4; // set when config is valid but the reload itself failed
|
||||
}
|
||||
|
||||
message SetWeightRequest {
|
||||
string frontend = 1;
|
||||
string pool = 2;
|
||||
|
||||
Reference in New Issue
Block a user