59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package stage
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
|
|
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
|
)
|
|
|
|
const placeholderMessage = "placeholder stage: no real work executed"
|
|
|
|
type placeholderStage struct {
|
|
name string
|
|
}
|
|
|
|
func (s placeholderStage) Name() string { return s.name }
|
|
|
|
func (s placeholderStage) Declares() IODecl {
|
|
return IODecl{
|
|
Inputs: []artifacts.Ref{{Kind: "artifact", Category: "input", RelativePath: s.name + ".input.placeholder"}},
|
|
Outputs: []artifacts.Ref{{Kind: "artifact", Category: "output", RelativePath: s.name + ".output.placeholder"}},
|
|
}
|
|
}
|
|
|
|
func (s placeholderStage) Run(_ context.Context, _ *Env, _ *manifest.Manifest) (*StageResult, error) {
|
|
return &StageResult{
|
|
Metadata: map[string]any{
|
|
"placeholder": true,
|
|
"stage": s.name,
|
|
"message": placeholderMessage,
|
|
},
|
|
}, nil
|
|
}
|
|
|
|
// All returns the canonical ordered stage list for full pipeline execution.
|
|
func All() []Stage {
|
|
return []Stage{
|
|
placeholderStage{name: "prepare"},
|
|
placeholderStage{name: "transcribe"},
|
|
placeholderStage{name: "normalize"},
|
|
placeholderStage{name: "merge"},
|
|
placeholderStage{name: "polish"},
|
|
placeholderStage{name: "analyze"},
|
|
placeholderStage{name: "archive"},
|
|
placeholderStage{name: "notify"},
|
|
}
|
|
}
|
|
|
|
// Select returns one stage by exact name from the canonical stage set.
|
|
func Select(name string) (Stage, error) {
|
|
for _, s := range All() {
|
|
if s.Name() == name {
|
|
return s, nil
|
|
}
|
|
}
|
|
return nil, fmt.Errorf("unknown stage %q", name)
|
|
}
|