osbuild2: separate input base types into new file

Keep input base types / interfaces separately from stages for
readability.
Cleaned up some unused interfaces in the process.
This commit is contained in:
Achilleas Koutsou 2021-07-06 15:26:48 +02:00 committed by Ondřej Budai
parent e85fc3b48c
commit 6debb62758
2 changed files with 26 additions and 30 deletions

View file

@ -0,0 +1,26 @@
package osbuild2
// Collection of Inputs for a Stage
type Inputs interface {
isStageInputs()
}
// Single Input for a Stage
type Input interface {
isInput()
}
// Fields shared between all Input types (should be embedded in each instance)
type inputCommon struct {
Type string `json:"type"`
// Origin should be either 'org.osbuild.source' or 'org.osbuild.pipeline'
Origin string `json:"origin"`
}
type StageInput interface {
isStageInput()
}
type References interface {
isReferences()
}

View file

@ -18,41 +18,11 @@ type Stage struct {
Mounts Mounts `json:"mounts,omitempty"`
}
// Collection of Inputs for a Stage
type Inputs interface {
isStageInputs()
}
// Single Input for a Stage
type Input interface {
isInput()
}
// Fields shared between all Input types (should be embedded in each instance)
type inputCommon struct {
Type string `json:"type"`
// Origin should be either 'org.osbuild.source' or 'org.osbuild.pipeline'
Origin string `json:"origin"`
// References References `json:"references"`
}
type StageInput interface {
isStageInput()
}
type References interface {
isReferences()
}
// StageOptions specify the operations of a given stage-type.
type StageOptions interface {
isStageOptions()
}
type InputOptions interface {
}
type rawStage struct {
Type string `json:"type"`
Options json.RawMessage `json:"options"`