Skip to content

Commit

Permalink
Add assembly preprocessing (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillp authored Sep 10, 2024
1 parent f8fbd69 commit a0c7e55
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/specter/assembly.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ type PipelineBuilder struct {

SourceLoaders []SourceLoader
UnitLoaders []UnitLoader
UnitPreprocessors []UnitPreprocessor
UnitProcessors []UnitProcessor
ArtifactProcessors []ArtifactProcessor
ArtifactRegistry ArtifactRegistry

SourceLoadingStageHooks SourceLoadingStageHooks
UnitLoadingStageHooks UnitLoadingStageHooks
UnitPreprocessingStageHooks UnitPreprocessingStageHooks
UnitProcessingStageHooks UnitProcessingStageHooks
ArtifactProcessingStageHooks ArtifactProcessingStageHooks
}
Expand Down Expand Up @@ -54,6 +56,12 @@ func (b PipelineBuilder) WithUnitLoaders(loaders ...UnitLoader) PipelineBuilder
return b
}

// WithUnitPreprocessors configures the UnitPreprocessors of a Pipeline instance.
func (b PipelineBuilder) WithUnitPreprocessors(preprocessors ...UnitPreprocessor) PipelineBuilder {
b.UnitPreprocessors = preprocessors
return b
}

// WithUnitProcessors configures the UnitProcess of a Pipeline instance.
func (b PipelineBuilder) WithUnitProcessors(processors ...UnitProcessor) PipelineBuilder {
b.UnitProcessors = processors
Expand Down Expand Up @@ -82,6 +90,11 @@ func (b PipelineBuilder) WithUnitLoadingStageHooks(h UnitLoadingStageHooks) Pipe
return b
}

func (b PipelineBuilder) WithUnitPreprocessingStageHooks(hooks UnitPreprocessingStageHooks) PipelineBuilder {
b.UnitPreprocessingStageHooks = hooks
return b
}

func (b PipelineBuilder) WithUnitProcessingStageHooks(h UnitProcessingStageHooks) PipelineBuilder {
b.UnitProcessingStageHooks = h
return b
Expand All @@ -99,6 +112,10 @@ func (b PipelineBuilder) Build() Pipeline {
SourceLoaders: b.SourceLoaders,
Hooks: b.SourceLoadingStageHooks,
},
UnitPreprocessingStage: unitPreprocessingStage{
Preprocessors: b.UnitPreprocessors,
Hooks: b.UnitPreprocessingStageHooks,
},
UnitLoadingStage: unitLoadingStage{
Loaders: b.UnitLoaders,
Hooks: b.UnitLoadingStageHooks,
Expand Down

0 comments on commit a0c7e55

Please sign in to comment.