conditioner

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package conditioner contains conditioner related logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRunConditionerManager

type DefaultRunConditionerManager struct {
}

DefaultRunConditionerManager is default implement for RunConditionerManager

func NewRunConditionManager

func NewRunConditionManager() DefaultRunConditionerManager

NewRunConditionManager initialize DefaultRunConditionManager

func (DefaultRunConditionerManager) CalculateRunConditons

func (manger DefaultRunConditionerManager) CalculateRunConditons(ctx context.Context, obj client.Object, list client.ObjectList, prepare func(client.ObjectList), conditioners []RunConditioner) ([]RunConditionHandler, error)

CalculateRunConditons return all the condition for different runConditioner

func (DefaultRunConditionerManager) GetAffected

GetAffected return all affected object base on different runConditioner

type PropertiesHandler

type PropertiesHandler interface {
	// Config return the configurations
	Config() string
	// Compare will compare two RawExtension and check whether they are different and return message users may interest
	Compare(old *runtime.RawExtension, new *runtime.RawExtension) (changed bool, message string, err error)
}

PropertiesHandler knows how to extract configuration and check the different between two properties

type RunConditionHandler

type RunConditionHandler struct {
	v1alpha1.RunCondition
	// PropertiesHandler stores the interface that decide how to handle information in properties
	PropertiesHandler
}

RunConditionHandler contains RunCondition and interface to handle properties

type RunConditioner

type RunConditioner interface {
	// Type return the condtioner type
	Type() v1alpha1.RunConditionerType
	// RunCondition return the condition details that indicate the condition status
	RunCondition(context.Context, client.Object, client.ObjectList) (RunConditionHandler, error)
	// GetAffected return objects which be affected if the current object completed
	GetAffected(context.Context, client.Object, client.ObjectList) (client.ObjectList, error)
}

RunConditioner indicate the state of the condition

type RunConditionerManager

type RunConditionerManager interface {
	// CalculateRunConditons return the unsatisfied condition
	CalculateRunConditons(ctx context.Context,
		obj client.Object,
		listrunList client.ObjectList,

		prepare func(client.ObjectList),
		conditions []RunConditioner) ([]RunConditionHandler, error)
	// GetAffected return all the affected objects that need handled after the current object completed
	GetAffected(ctx context.Context,
		obj client.Object,
		list client.ObjectList,

		prepare func(client.ObjectList),
		conditions []RunConditioner) (map[v1alpha1.RunConditionerType]client.ObjectList, error)
}

RunConditionerManager uesd for answering two questions 1. If run meets all the condition that run can go on 2. If return the left runs that should go on if the run has done CalculateRunConditons answer the first question by returning the unsatisfied condition GetAffected answer the second question by return the runs base on different condition

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL