fetch_ml/internal/worker/interfaces/manifest.go
Jeremie Fraeys ae0a370fb4
refactor: Phase 1 - Extract worker interfaces
Created interfaces package to break tight coupling:

1. internal/worker/interfaces/executor.go (30 lines)
   - JobExecutor interface for job execution
   - ExecutionEnv struct for execution context
   - ExecutionResult struct for results

2. internal/worker/interfaces/tracker.go (20 lines)
   - ProgressTracker interface for execution stages
   - StageStart, StageComplete, StageFailed methods
   - JobComplete for final status

3. internal/worker/interfaces/manifest.go (18 lines)
   - ManifestWriter interface for manifest operations
   - Upsert method for update/create
   - BuildInitial method for creating new manifests

These interfaces will enable:
- Dependency injection in future phases
- Mocking for unit tests
- Clean separation between orchestration and execution

Build status: Compiles successfully
2026-02-17 14:10:03 -05:00

17 lines
631 B
Go

// Package interfaces defines the contracts for worker components
package interfaces
import (
"github.com/jfraeys/fetch_ml/internal/manifest"
"github.com/jfraeys/fetch_ml/internal/queue"
)
// ManifestWriter defines the contract for writing run manifests
type ManifestWriter interface {
// Upsert updates or creates a manifest in the given directory
// The mutate function is called with the current or new manifest
Upsert(dir string, task *queue.Task, mutate func(*manifest.RunManifest))
// BuildInitial creates a new initial manifest for a task
BuildInitial(task *queue.Task, podmanImage string) *manifest.RunManifest
}