planner

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actuator

type Actuator interface {
	// Execute the plan.
	Execute(ctx context.Context, p Plan, executionID string) (int, error)
}

Actuator will execute the given plan.

func NewActuator

func NewActuator() Actuator

NewActuator creates a new actuator.

type Plan

type Plan interface {
	// Name is the name of the plan.
	Name() string

	// Create will perform the plan and will return a list of operations/procedures
	// that need to be run to accomplish the plan
	Create(ctx context.Context) ([]Procedure, error)

	// Finalise will set final status fields when the Plan is complete
	Finalise(state models.MicroVMState)
}

Plan represents an interface for a plan of operations.

type Procedure

type Procedure interface {
	// Name is the name of the procedure/operation.
	Name() string
	// Do will perform the operation/procedure.
	Do(ctx context.Context) ([]Procedure, error)
	// ShouldDo determines if this procedure should be executed
	ShouldDo(ctx context.Context) (bool, error)
	// Verify the state after Do. Most cases it can return nil
	// without doing anything, but in special cases we want to measure
	// resources if they are in the desired state.
	// Example: When we start MicroVM, it may does not tell us if it was
	// successful or not, in Verify we can verify if it's running or not
	// and report back an error if the state is not the desired state.
	Verify(ctx context.Context) error
}

Procedure represents a procedure/operation that will be carried out as part of executing a plan. All procedures must be idempotent, so they need to measure and then act.

Jump to

Keyboard shortcuts

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