9bb4b09a04
CI / Lint + build + test (push) Has been cancelled
Post-repair hardware validation pipeline for Proxmox cluster hosts. Go orchestrator + in-image agent + mkosi live image + bundled dnsmasq PXE + SQLite + HTMX/SSE UI + notify registry + janitor + full docs.
34 lines
855 B
Go
34 lines
855 B
Go
package janitor
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"vetting/internal/logs"
|
|
"vetting/internal/store"
|
|
)
|
|
|
|
// StoreAdapter bridges the concrete orchestrator stores to the Janitor's
|
|
// dependency interface. Kept in the janitor package so the orchestrator
|
|
// wire-up stays a single-line: janitor.New(cfg, &janitor.StoreAdapter{...}).
|
|
type StoreAdapter struct {
|
|
Runs *store.Runs
|
|
Artifacts *store.Artifacts
|
|
Logs *logs.Hub
|
|
}
|
|
|
|
func (a *StoreAdapter) CompletedOlderThan(ctx context.Context, cutoff time.Time) ([]int64, error) {
|
|
return a.Runs.CompletedOlderThan(ctx, cutoff)
|
|
}
|
|
|
|
func (a *StoreAdapter) DeleteArtifactsForRun(ctx context.Context, runID int64) ([]store.Artifact, error) {
|
|
return a.Artifacts.DeleteForRun(ctx, runID)
|
|
}
|
|
|
|
func (a *StoreAdapter) LogPathFor(runID int64) string {
|
|
if a.Logs == nil {
|
|
return ""
|
|
}
|
|
return a.Logs.PathFor(runID)
|
|
}
|