feat: P1-3 add heartbeat keep-alive goroutine

- add heartbeat.go with heartbeatIntervalSecs var, SetHeartbeatInterval, runHeartbeat (no build tag, CGO-free)
- add heartbeat_test.go with 5 tests covering interval validation and goroutine lifecycle
- add StartHeartbeat to clib.go (CGO impl calling xcecli_heartbeat)
- remove SetHeartbeatInterval stub from stub.go (now real code in heartbeat.go)
- remove TestSetHeartbeatInterval_StubNoOp from stub_funcs_test.go
- call SetHeartbeatInterval in OnClusterUpdated to track backend-pushed interval
- call backend.StartHeartbeat in cmd/main.go after backend registration
This commit is contained in:
Rongsong Shen 2026-04-17 14:12:40 +00:00
parent bc3103a6d5
commit ffc5b20cdb
7 changed files with 125 additions and 12 deletions

View file

@ -36,9 +36,6 @@ func ControlHost(hostname string, action int) error { return errNoCGO }
// StartHeartbeat stub — real implementation in clib.go (requires CGO).
func StartHeartbeat(_ context.Context) {}
// SetHeartbeatInterval stub — real implementation in clib.go (requires CGO).
func SetHeartbeatInterval(_ int) {}
// EvalSelectForHost stub — real implementation in clib.go (requires CGO).
func EvalSelectForHost(_, _ string) error { return errNoCGO }