myxce/src/frontend/apiserver/backend/stub.go
Rongsong Shen ffc5b20cdb 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
2026-04-17 14:12:40 +00:00

43 lines
1.6 KiB
Go

//go:build !cgo
package backend
import (
"apiserver/models"
"context"
"errors"
)
var errNoCGO = errors.New("backend requires CGO: rebuild with CGO_ENABLED=1 and libxce")
// RegisterToBackend stub — real implementation in clib.go (requires CGO).
func RegisterToBackend(config *BackendConfig) error { return errNoCGO }
// StartNotificationListener stub — real implementation in clib.go (requires CGO).
func StartNotificationListener(handler NotificationHandler) error { return errNoCGO }
// GenerateJobID stub — real implementation in clib.go (requires CGO).
func GenerateJobID(clusterID, apiserverID int, arraySize int) (uint64, error) {
return 0, errNoCGO
}
// SubmitJob stub — real implementation in clib.go (requires CGO).
func SubmitJob(job *models.JobInfo, arraySize int) error { return errNoCGO }
// ControlJob stub — real implementation in clib.go (requires CGO).
func ControlJob(jobid uint64, action int, content string) error { return errNoCGO }
// ControlQueue stub — real implementation in clib.go (requires CGO).
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) {}
// 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() {}