Documentation
¶
Overview ¶
Package worker provides background task scheduling for the control plane. Workers handle periodic operations like health checks, state reconciliation, garbage collection, and certificate renewal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertRenewer ¶
type CertRenewer struct {
// contains filtered or unexported fields
}
CertRenewer periodically checks for expiring TLS certificates and renews them.
func NewCertRenewer ¶
NewCertRenewer creates a new certificate renewer worker.
func (*CertRenewer) Interval ¶
func (c *CertRenewer) Interval() time.Duration
Interval returns how often the certificate renewer should run.
type GarbageCollector ¶
type GarbageCollector struct {
// contains filtered or unexported fields
}
GarbageCollector periodically removes stale data from the store.
func NewGarbageCollector ¶
func NewGarbageCollector(store store.Store, interval time.Duration) *GarbageCollector
NewGarbageCollector creates a new garbage collector worker.
func (*GarbageCollector) Interval ¶
func (g *GarbageCollector) Interval() time.Duration
Interval returns how often the garbage collector should run.
func (*GarbageCollector) Name ¶
func (g *GarbageCollector) Name() string
Name returns the worker name.
type HealthRunner ¶
type HealthRunner struct {
// contains filtered or unexported fields
}
HealthRunner periodically executes health checks for all instances.
func NewHealthRunner ¶
NewHealthRunner creates a new health runner worker.
func (*HealthRunner) Interval ¶
func (h *HealthRunner) Interval() time.Duration
Interval returns how often the health runner should run.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler compares desired state in the database with actual provider state and corrects any drift.
func NewReconciler ¶
func NewReconciler(instances instance.Store, providers *provider.Registry, events event.Bus, interval time.Duration) *Reconciler
NewReconciler creates a new reconciler worker.
func (*Reconciler) Interval ¶
func (r *Reconciler) Interval() time.Duration
Interval returns how often the reconciler should run.
func (*Reconciler) Run ¶
func (r *Reconciler) Run(_ context.Context) error
Run executes one reconciliation cycle. TODO: implement reconciliation logic. For each instance in the store, compare the desired state (DB) with the actual state reported by the provider. If drift is detected, issue corrective actions through the provider and publish events for any state changes.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages a set of workers, running each on its configured interval.
func NewScheduler ¶
func NewScheduler() *Scheduler
NewScheduler creates a new scheduler with an empty worker list.
type TelemetryCollector ¶
type TelemetryCollector struct {
// contains filtered or unexported fields
}
TelemetryCollector periodically gathers metrics and resource usage from providers.
func NewTelemetryCollector ¶
func NewTelemetryCollector(telemetry telemetry.Service, providers *provider.Registry, interval time.Duration) *TelemetryCollector
NewTelemetryCollector creates a new telemetry collector worker.
func (*TelemetryCollector) Interval ¶
func (t *TelemetryCollector) Interval() time.Duration
Interval returns how often the telemetry collector should run.
func (*TelemetryCollector) Name ¶
func (t *TelemetryCollector) Name() string
Name returns the worker name.
func (*TelemetryCollector) Run ¶
func (t *TelemetryCollector) Run(_ context.Context) error
Run executes one telemetry collection cycle. TODO: implement telemetry collection. Query each registered provider for current resource usage and metrics, then push the data through the telemetry service for storage and aggregation.
type Worker ¶
type Worker interface {
// Name identifies the worker.
Name() string
// Interval returns how often the worker should run.
// Return 0 for event-driven workers that do not run periodically.
Interval() time.Duration
// Run executes one cycle of the worker.
Run(ctx context.Context) error
}
Worker is a background task that runs periodically.