Documentation
¶
Index ¶
- type ApplyStage
- type BaseProcessor
- func (bp *BaseProcessor) AddChange(change Change)
- func (bp *BaseProcessor) AddError(err error)
- func (bp *BaseProcessor) AddMessage(message string)
- func (bp *BaseProcessor) GetChanges() []Change
- func (bp *BaseProcessor) GetConfig() *melange.Configuration
- func (bp *BaseProcessor) GetContext(key string) any
- func (bp *BaseProcessor) GetCurrentEpoch() int64
- func (bp *BaseProcessor) GetCurrentVersion() string
- func (bp *BaseProcessor) GetCurrentYAML() []byte
- func (bp *BaseProcessor) GetErrors() []error
- func (bp *BaseProcessor) GetFilePath() string
- func (bp *BaseProcessor) GetLatestVersion() string
- func (bp *BaseProcessor) GetLogger() *slog.Logger
- func (bp *BaseProcessor) GetMessages() []string
- func (bp *BaseProcessor) GetNewEpoch() int64
- func (bp *BaseProcessor) GetOptions() ProcessorOptions
- func (bp *BaseProcessor) GetOriginalYAML() []byte
- func (bp *BaseProcessor) GetPackageName() string
- func (bp *BaseProcessor) HasChanges() bool
- func (bp *BaseProcessor) HasFileChanges() bool
- func (bp *BaseProcessor) IsEpochChanged() bool
- func (bp *BaseProcessor) IsVersionChanged() bool
- func (bp *BaseProcessor) SetContext(key string, value any)
- func (bp *BaseProcessor) SetCurrentYAML(yaml []byte)
- func (bp *BaseProcessor) SetEpochUpdate(old, new int64)
- func (bp *BaseProcessor) SetOptions(opts ProcessorOptions)
- func (bp *BaseProcessor) SetVersionUpdate(old, new string)
- type BaseStage
- type Change
- type CheckStage
- type ExecutableStage
- type Pipeline
- type PipelineOptions
- type Processor
- type ProcessorOptions
- type Stage
- type StageRegistry
- type ValidatingStage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyStage ¶
ApplyStage applies modifications
type BaseProcessor ¶
type BaseProcessor struct {
// Core fields
FilePath string
PackageName string
Logger *slog.Logger
// Configuration
Config *melange.Configuration
OriginalYAML []byte
CurrentYAML []byte
// Version state
CurrentVersion string
LatestVersion string
VersionChanged bool
OldVersion string
NewVersion string
// Epoch state
CurrentEpoch int64
NewEpoch int64
EpochChanged bool
OldEpoch int64
// Change tracking
Changes []Change
Messages []string
Errors []error
// Options
Options ProcessorOptions
// Extensibility
Context map[string]any
}
BaseProcessor provides a base implementation that can be embedded
func NewBaseProcessor ¶
func NewBaseProcessor(filePath, packageName, currentVersion string, currentEpoch int64) *BaseProcessor
NewBaseProcessor creates a new base processor
func (*BaseProcessor) AddChange ¶
func (bp *BaseProcessor) AddChange(change Change)
func (*BaseProcessor) AddError ¶
func (bp *BaseProcessor) AddError(err error)
func (*BaseProcessor) AddMessage ¶
func (bp *BaseProcessor) AddMessage(message string)
func (*BaseProcessor) GetChanges ¶
func (bp *BaseProcessor) GetChanges() []Change
func (*BaseProcessor) GetConfig ¶
func (bp *BaseProcessor) GetConfig() *melange.Configuration
func (*BaseProcessor) GetContext ¶
func (bp *BaseProcessor) GetContext(key string) any
func (*BaseProcessor) GetCurrentEpoch ¶
func (bp *BaseProcessor) GetCurrentEpoch() int64
func (*BaseProcessor) GetCurrentVersion ¶
func (bp *BaseProcessor) GetCurrentVersion() string
func (*BaseProcessor) GetCurrentYAML ¶
func (bp *BaseProcessor) GetCurrentYAML() []byte
func (*BaseProcessor) GetErrors ¶
func (bp *BaseProcessor) GetErrors() []error
func (*BaseProcessor) GetFilePath ¶
func (bp *BaseProcessor) GetFilePath() string
Implementation of Processor interface
func (*BaseProcessor) GetLatestVersion ¶
func (bp *BaseProcessor) GetLatestVersion() string
func (*BaseProcessor) GetLogger ¶
func (bp *BaseProcessor) GetLogger() *slog.Logger
func (*BaseProcessor) GetMessages ¶
func (bp *BaseProcessor) GetMessages() []string
func (*BaseProcessor) GetNewEpoch ¶
func (bp *BaseProcessor) GetNewEpoch() int64
func (*BaseProcessor) GetOptions ¶
func (bp *BaseProcessor) GetOptions() ProcessorOptions
func (*BaseProcessor) GetOriginalYAML ¶
func (bp *BaseProcessor) GetOriginalYAML() []byte
func (*BaseProcessor) GetPackageName ¶
func (bp *BaseProcessor) GetPackageName() string
func (*BaseProcessor) HasChanges ¶
func (bp *BaseProcessor) HasChanges() bool
func (*BaseProcessor) HasFileChanges ¶
func (bp *BaseProcessor) HasFileChanges() bool
func (*BaseProcessor) IsEpochChanged ¶
func (bp *BaseProcessor) IsEpochChanged() bool
func (*BaseProcessor) IsVersionChanged ¶
func (bp *BaseProcessor) IsVersionChanged() bool
func (*BaseProcessor) SetContext ¶
func (bp *BaseProcessor) SetContext(key string, value any)
func (*BaseProcessor) SetCurrentYAML ¶
func (bp *BaseProcessor) SetCurrentYAML(yaml []byte)
func (*BaseProcessor) SetEpochUpdate ¶
func (bp *BaseProcessor) SetEpochUpdate(old, new int64)
func (*BaseProcessor) SetOptions ¶
func (bp *BaseProcessor) SetOptions(opts ProcessorOptions)
func (*BaseProcessor) SetVersionUpdate ¶
func (bp *BaseProcessor) SetVersionUpdate(old, new string)
type Change ¶
type Change struct {
Type string `json:"type"` // "version", "epoch", "pipeline", "security"
Field string `json:"field"` // specific field changed
OldValue string `json:"old_value"` // previous value
NewValue string `json:"new_value"` // new value
Description string `json:"description"` // human-readable description
Reason string `json:"reason"` // why the change was made
}
Change represents a modification made to the package
type CheckStage ¶
CheckStage performs checks without modifications
type ExecutableStage ¶
ExecutableStage is a stage that can be executed (generic execution)
type Pipeline ¶
type Pipeline struct {
Name string
Stages []Stage
Options PipelineOptions
Registry *StageRegistry
}
Pipeline represents a sequence of stages that operate on a processor
func (*Pipeline) SetOptions ¶
func (p *Pipeline) SetOptions(opts PipelineOptions)
SetOptions configures pipeline execution options
type PipelineOptions ¶
type PipelineOptions struct {
StopOnError bool // Stop execution if a stage fails
SkipValidation bool // Skip validation stages
ParallelExecution bool // Enable parallel execution of independent stages (future enhancement)
}
PipelineOptions configures pipeline behavior
type Processor ¶
type Processor interface {
// Identity
GetFilePath() string
GetPackageName() string
GetLogger() *slog.Logger
// Configuration
GetConfig() *melange.Configuration
GetOriginalYAML() []byte
GetCurrentYAML() []byte
SetCurrentYAML([]byte)
// Version tracking
GetCurrentVersion() string
GetLatestVersion() string
SetVersionUpdate(old, new string)
IsVersionChanged() bool
// Epoch tracking
GetCurrentEpoch() int64
GetNewEpoch() int64
SetEpochUpdate(old, new int64)
IsEpochChanged() bool
// Change tracking
AddChange(Change)
GetChanges() []Change
HasChanges() bool
HasFileChanges() bool
// Messaging
AddMessage(string)
AddError(error)
GetMessages() []string
GetErrors() []error
// Options
GetOptions() ProcessorOptions
SetOptions(ProcessorOptions)
// Context for custom data
GetContext(key string) any
SetContext(key string, value any)
}
Processor defines the core interface for all package processors
type ProcessorOptions ¶
type ProcessorOptions struct {
DryRun bool `json:"dry_run"`
Force bool `json:"force"`
BackupSuffix string `json:"backup_suffix"`
TempDir string `json:"temp_dir"`
}
ProcessorOptions contains configuration for package processing
type Stage ¶
type Stage interface {
Name() string
Description() string
// Conditional execution - stages can decide if they should run
ShouldRun(ctx context.Context, p Processor) (bool, error)
}
Stage represents a single processing step
type StageRegistry ¶
type StageRegistry struct {
// contains filtered or unexported fields
}
StageRegistry manages available stages and provides stage construction
func NewStageRegistry ¶
func NewStageRegistry() *StageRegistry
NewStageRegistry creates a new stage registry
func (*StageRegistry) Create ¶
func (r *StageRegistry) Create(name string) (Stage, error)
Create instantiates a stage by name
func (*StageRegistry) ListStages ¶
func (r *StageRegistry) ListStages() []string
ListStages returns all registered stage names
func (*StageRegistry) Register ¶
func (r *StageRegistry) Register(name string, constructor func() Stage)
Register adds a stage constructor to the registry