planstate

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LabelExists

type LabelExists struct {
	Label string
}

LabelExists is the error returned by AppendLayer when a layer with that label already exists.

func (*LabelExists) Error

func (e *LabelExists) Error() string

type PlanChangedFunc

type PlanChangedFunc func(p *plan.Plan)

PlanChangedFunc is the function type used by AddChangeListener.

type PlanManager

type PlanManager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(s *state.State, runner *state.TaskRunner, pebbleDir string) (*PlanManager, error)

func (*PlanManager) AddChangeListener

func (m *PlanManager) AddChangeListener(f PlanChangedFunc)

AddChangeListener adds f to the list of functions that are called whenever a plan change event took place (Load, AppendLayer, CombineLayer). A plan change event does not guarantee that combined plan content has changed. Notification registration must be completed before the plan is loaded.

func (*PlanManager) AppendLayer

func (m *PlanManager) AppendLayer(layer *plan.Layer) error

AppendLayer takes a Layer, appends it to the plan's layers and updates the layer.Order field to the new order. If a layer with layer.Label already exists, return an error of type *LabelExists.

func (*PlanManager) CombineLayer

func (m *PlanManager) CombineLayer(layer *plan.Layer) error

CombineLayer takes a Layer, combines it to an existing layer that has the same label. If no existing layer has the label, append a new one. In either case, update the layer.Order field to the new order.

func (*PlanManager) Ensure

func (m *PlanManager) Ensure() error

Ensure implements StateManager.Ensure.

func (*PlanManager) Load

func (m *PlanManager) Load() error

Load reads plan layers from the pebble directory, combines and validates the final plan, and finally notifies registered managers of the plan update. In the case of a non-existent layers directory, or no layers in the layers directory, an empty plan is announced to change subscribers.

func (*PlanManager) Plan

func (m *PlanManager) Plan() *plan.Plan

Plan returns the combined configuration plan. Any change made to the plan will result in a new Plan instance, so the current design assumes a returned plan is never mutated by planstate (and may never be mutated by any consumer).

func (*PlanManager) SetServiceArgs

func (m *PlanManager) SetServiceArgs(serviceArgs map[string][]string) error

SetServiceArgs sets the service arguments provided by "pebble run --args" to their respective services. It adds a new layer in the plan, the layer consisting of services with commands having their arguments changed.

NOTE: This functionality should be redesigned (moved out of the plan manager) as the plan manager should not be concerned with schema section details.

Jump to

Keyboard shortcuts

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