feat: implement handle_upgrade_config() (gated), push_config_to_standbys(), create_lost_and_found() stub

- Add do_upgrade_config_with_bytes() helper with full validate/decode/
  re-encode/save/push/restart logic gated by CONF_ENABLE_UPGRADE_CONFIG
- Add push_config_to_standbys() stub: logs connected standbys and returns
  0; full parallel fan-out deferred to Task 11 (typemap byte shims needed)
- Add send_upgrade_error() private helper for consistent error replies
- Expand create_lost_and_found() stub with WARN log explaining Phase 2
  deferral; core config-replication feature works without it
- Declare push_config_to_standbys() in config_repl.h
This commit is contained in:
Rongsong Shen 2026-05-13 18:12:32 +00:00
parent a95476be4e
commit 5ef14a2717
2 changed files with 274 additions and 5 deletions

View file

@ -99,10 +99,21 @@ void create_lost_and_found(cluster_t *c);
*/
int handle_config_request(cluster_t *c, endpoint_t *ep, xce_request_t *req);
/*
* push_config_to_standbys: fan-out a new config blob to all connected standby
* controllers in parallel. Best-effort — standbys that miss the push will
* pull on reconnect via handle_config_request().
* Returns the number of standbys that successfully received the push.
* Only meaningful when CONF_ENABLE_UPGRADE_CONFIG is set, but always declared
* so callers can reference it without an #if guard.
*/
int push_config_to_standbys(cluster_t *c, const uint8_t *bytes, size_t blen,
const uint8_t sha256[32], uint64_t new_tag);
/*
* handle_upgrade_config: handle an OP_upgradeConfig request from an admin tool.
* Validates, stores, and fans out the new config blob; triggers restart.
* Stub for Task 9. Only callable when CONF_ENABLE_UPGRADE_CONFIG is set.
* Only callable when CONF_ENABLE_UPGRADE_CONFIG is set.
*/
int handle_upgrade_config(cluster_t *c, endpoint_t *ep, xce_request_t *req);