Documentation
¶
Overview ¶
GORM-backed maintenance scheduling.
GormService runs background jobs for provider plugins against context-taking dependencies. It owns no tables: jobs stay in-memory (the lastRun/running maps). Auth flow state has no table: expiry is enforced by the dashboard readers, and no cleanup pass exists.
Index ¶
- type GormService
- func (s *GormService) RunJob(ctx context.Context, providerID, jobName string) error
- func (s *GormService) RunStartupRefresh(ctx context.Context)
- func (s *GormService) SetModelInfoService(refresher modelInfoRefresher)
- func (s *GormService) SetVirtualSyncer(syncer VirtualSyncer)
- func (s *GormService) Start(ctx context.Context)
- func (s *GormService) WithInterval(duration time.Duration) *GormService
- type PluginJobs
- type ProviderInventory
- type VirtualSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormService ¶ added in v0.4.0
type GormService struct {
// contains filtered or unexported fields
}
GormService runs background jobs for provider plugins against GORM-compatible dependencies. Scheduling semantics: bounded workers, overlap skips, startup bypass, auto-sync gate.
func NewGormService ¶ added in v0.4.0
func NewGormService(jobBackend PluginJobs, providerSource ProviderInventory, logger *slog.Logger) *GormService
NewGormService constructs a GORM-backed maintenance service with the default check interval. Construction performs no I/O. SetModelInfoService wires model metadata refresh for providers with config.models_auto_sync enabled.
func (*GormService) RunJob ¶ added in v0.4.0
func (s *GormService) RunJob(ctx context.Context, providerID, jobName string) error
RunJob triggers one job for one provider on demand (dashboard). Unknown jobs fail loudly; running jobs report busy.
func (*GormService) RunStartupRefresh ¶ added in v0.4.0
func (s *GormService) RunStartupRefresh(ctx context.Context)
RunStartupRefresh runs startup jobs synchronously. It never fails startup: every outcome logs inside the pass, and cancellation only stops launching new workers.
func (*GormService) SetModelInfoService ¶ added in v0.4.0
func (s *GormService) SetModelInfoService(refresher modelInfoRefresher)
SetModelInfoService wires model metadata refresh for providers with config.models_auto_sync enabled.
func (*GormService) SetVirtualSyncer ¶ added in v0.4.0
func (s *GormService) SetVirtualSyncer(syncer VirtualSyncer)
SetVirtualSyncer wires managed virtual model rebuilds after a successful automatic model sync. A nil syncer skips the rebuild.
func (*GormService) Start ¶ added in v0.4.0
func (s *GormService) Start(ctx context.Context)
Start launches the maintenance loop in a background goroutine. It stops when ctx is cancelled.
func (*GormService) WithInterval ¶ added in v0.4.0
func (s *GormService) WithInterval(duration time.Duration) *GormService
WithInterval overrides the check interval (useful for testing).
type PluginJobs ¶ added in v0.4.0
type PluginJobs interface {
Jobs(typeKey string) map[string]luaplugin.JobSpec
RunJob(ctx context.Context, typeKey, jobName, reason, providerID string, providerConfig map[string]any) error
}
PluginJobs is the luaplugin surface the maintenance path needs: job schedules plus one job execution. The luaplugin Service satisfies it; the registry and RunJob signatures are storage-agnostic, so no luaplugin statement runs here.
type ProviderInventory ¶ added in v0.4.0
type ProviderInventory interface {
Get(ctx context.Context, identifier string) (*models.ProviderInstance, error)
List(ctx context.Context) ([]*models.ProviderInstance, error)
}
ProviderInventory is the provider surface the maintenance path needs: one row for manual triggers plus the full list for ticks. Signatures match the provider GORM service.
type VirtualSyncer ¶ added in v0.4.0
type VirtualSyncer interface {
SyncProviderModels(ctx context.Context, providerID string) ([]virtual.ProviderVMGroup, error)
}
VirtualSyncer rebuilds managed virtual models from the warmed model cache after an automatic sync. The virtual GORM service satisfies it; sync failures log and continue like every other maintenance outcome.