Documentation
¶
Overview ¶
Package maintenance implements the Provider Maintenance & Rotation Service.
Responsibilities:
- Periodically scanning all credentials for those that need refresh
- Delegating refresh to the appropriate provider backend
- Persisting updated credentials via the Credential Pool Service
Design principles:
- Flexible: no hardcoded refresh logic — each backend decides its own strategy
- Non-blocking: runs in a background goroutine; errors are logged, not fatal
- Jitter-free: each check interval is fixed; backends decide when NeedsRefresh is true
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service runs background maintenance tasks for provider credentials.
func New ¶
func New(credSvc *credential.Service, providerSvc *provider.Service, db *db.DB, logger *slog.Logger) *Service
New constructs a new maintenance Service with the default check interval.
func (*Service) RunStartupRefresh ¶ added in v0.3.7
RunStartupRefresh refreshes stale credentials and cleans expired auth flows synchronously. The server calls it before listening so a restarted router never exposes expired keys to live traffic. Model sync stays on the ticker. It never fails startup: every outcome logs inside the pass, and cancellation only stops launching new workers.
func (*Service) SetModelInfoService ¶
func (s *Service) SetModelInfoService(mi modelInfoRefresher)
SetModelInfoService wires model metadata refresh for providers with config.models_auto_sync enabled.