feat: P0-2d add no-CGO stubs for heartbeat, select, cleanup

Add four function stubs to backend/stub.go for the !cgo build path:
- StartHeartbeat(ctx context.Context) — no-op (heartbeat not available)
- SetHeartbeatInterval(secs int) — no-op (interval update not available)
- EvalSelectForHost(hostname, selectExpr string) error — returns errNoCGO
- Cleanup() — no-op (no C resources to release without CGO)

TDD: four tests in stub_funcs_test.go verify stubs behave correctly
(no-op functions don't panic, error stubs return errNoCGO). All backend
tests passing.
This commit is contained in:
Rongsong Shen 2026-04-17 10:02:11 +00:00
parent f354a5ec78
commit dc029a6d14
3 changed files with 58 additions and 3 deletions

View file

@ -4,6 +4,7 @@ package backend
import (
"apiserver/models"
"context"
"errors"
)
@ -31,3 +32,15 @@ func ControlQueue(queuename string, action int) error { return errNoCGO }
// ControlHost stub — real implementation in clib.go (requires CGO).
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 }
// Cleanup stub — real implementation in clib.go (requires CGO).
func Cleanup() {}