Documentation ¶
Index ¶
- Variables
- type ExecuteResult
- func (r ExecuteResult) Add(op Operation) ExecuteResult
- func (r ExecuteResult) AddWithErr(op Operation, err error) ExecuteResult
- func (r ExecuteResult) Error() error
- func (r ExecuteResult) Errored() bool
- func (r ExecuteResult) Name() string
- func (r ExecuteResult) NotReady() bool
- func (r ExecuteResult) Object() client.Object
- func (r ExecuteResult) ProcessingOps() []string
- func (r ExecuteResult) Ready() bool
- func (r ExecuteResult) Skipped() bool
- type Executor
- type Operation
Constants ¶
This section is empty.
Variables ¶
var ( MissingHandlerResourcesErr = errors.New("missing handler resources, cannot perform handling") OperationNotReadyErr = errors.New("operation not ready yet") )
Functions ¶
This section is empty.
Types ¶
type ExecuteResult ¶
type ExecuteResult struct {
// contains filtered or unexported fields
}
ExecuteResult defines a wrapper for multiple Operations performed by Executor.Execute.
func (ExecuteResult) Add ¶
func (r ExecuteResult) Add(op Operation) ExecuteResult
Add adds a successful Operation to ExecuteResult
func (ExecuteResult) AddWithErr ¶
func (r ExecuteResult) AddWithErr(op Operation, err error) ExecuteResult
AddWithErr adds a failed Operation with its error to ExecuteResult
func (ExecuteResult) Error ¶
func (r ExecuteResult) Error() error
Error returns the errored operation
func (ExecuteResult) Errored ¶
func (r ExecuteResult) Errored() bool
func (ExecuteResult) Name ¶
func (r ExecuteResult) Name() string
func (ExecuteResult) NotReady ¶
func (r ExecuteResult) NotReady() bool
func (ExecuteResult) Object ¶
func (r ExecuteResult) Object() client.Object
func (ExecuteResult) ProcessingOps ¶
func (r ExecuteResult) ProcessingOps() []string
ProcessingOps returns processing operations performed.
func (ExecuteResult) Ready ¶
func (r ExecuteResult) Ready() bool
func (ExecuteResult) Skipped ¶
func (r ExecuteResult) Skipped() bool
type Executor ¶
type Executor[T client.Object] struct { Name string FetchFunc func(ctx context.Context, obj T) error CreateFunc func(ctx context.Context, obj T) error UpdateFunc func(ctx context.Context, obj T) (bool, error) IsReady func(ctx context.Context, obj T) bool // contains filtered or unexported fields }
Executor simplifies synchronization logic for a requested resource. It exposes a simple Execute method which processes resource lifecycle.
func NopExecutor ¶
NopExecutor is noop executor for workflows. It can be used to indicate that requested operation is valid, but nothing to execute.
func (*Executor[T]) Execute ¶
func (h *Executor[T]) Execute(ctx context.Context, obj T) ExecuteResult
Execute performs the resource execution by invoking Executor functions in ordered manner. Returns an error if data is missing or for runtime operations. Returns all the operations performed during execution.