feat: wire persist_init/recover/start/stop into cluster lifecycle (P0-F)

- Add `persist_t persist` field to cluster_t (cluster_def.h includes persist.h)
- Add `workdir` and `name` fields to myconf_t; main.c passes them through
- cluster_init: call persist_set_workdir, persist_init, persist_recover after apiserver_init
- cluster_start: call persist_start (launches fsync thread + registers WAL hooks)
- cluster_fini: call persist_stop + persist_fini before delaymgr/vtaskmgr teardown
- persist_init: store cluster back-pointer (replaces (void)c stub)
- persist_start: register persist_job/queue/worker_hook_fun via xce_add_hook when cluster != NULL
- Add test_cluster_persist.c: compile-time struct check + config defaults + workdir path derivation
- Register test in controller_test.c and meson.build

All controller tests pass (1/1 OK, 50s).
This commit is contained in:
Rongsong Shen 2026-05-07 13:07:47 +00:00
parent 3030012f51
commit b52fbef36d
9 changed files with 159 additions and 2 deletions

View file

@ -14,6 +14,7 @@
#include "myconf.h"
#include "mylock.h"
#include "netio.h"
#include "persist.h"
#include "vtaskmgr.h"
#include "xce/types.h"
#include "xlist.h"
@ -114,6 +115,7 @@ typedef struct cluster_s {
vtaskmgr_t vtaskmgr;
cbuf_t wbuf;
int running;
persist_t persist; /* Persistence module — P0-F */
} cluster_t;
#endif /* XCE_CLUSTER_DEF_H */