plan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(plan Plan) error

Types

type Action

type Action struct {
	Type     ActionType `json:"type"`
	Path     string     `json:"path,omitempty"`
	LinkPath string     `json:"linkPath,omitempty"`
	Payload  string     `json:"payload,omitempty"`
	Target   string     `json:"target,omitempty"`
	Src      string     `json:"src,omitempty"`
	Dst      string     `json:"dst,omitempty"`
	Mode     string     `json:"mode,omitempty"`
	// contains filtered or unexported fields
}

func CopyAction

func CopyAction(src string, physicalSrc string, dst string, physicalDst string, mode string, overwrite bool, copyRecord state.Copy) Action

func ForgetCopyAction

func ForgetCopyAction(path string, copyRecord state.Copy) Action

func MkdirAction

func MkdirAction(path string, physicalPath string) Action

func MoveAction

func MoveAction(src string, physicalSrc string, dst string, physicalDst string) Action

func PackageConfigAction

func PackageConfigAction(path string, packageRoot string, config packages.PackageConfig) Action

func RemoveCopyAction

func RemoveCopyAction(path string, physicalPath string, copyRecord state.Copy) Action

func RemoveFileAction

func RemoveFileAction(path string, physicalPath string) Action

func RemoveSymlinkAction

func RemoveSymlinkAction(path string, physicalPath string) Action

func RmdirAction

func RmdirAction(path string, physicalPath string) Action

func SymlinkAction

func SymlinkAction(linkPath string, physicalLinkPath string, payload string, target string) Action

type ActionType

type ActionType string
const (
	ActionMkdir         ActionType = "mkdir"
	ActionRmdir         ActionType = "rmdir"
	ActionSymlink       ActionType = "symlink"
	ActionCopy          ActionType = "copy"
	ActionPackageConfig ActionType = "package_config"
	ActionRemoveFile    ActionType = "remove_file"
	ActionRemoveSymlink ActionType = "remove_symlink"
	ActionRemoveCopy    ActionType = "remove_copy"
	ActionForgetCopy    ActionType = "forget_copy"
	ActionMove          ActionType = "move"
)

type Conflict

type Conflict struct {
	Code    target.ConflictCode `json:"code"`
	Path    string              `json:"path"`
	Message string              `json:"message"`
	Package string              `json:"package,omitempty"`
}

func NewConflict

func NewConflict(code target.ConflictCode, path, pkg, message string) Conflict

type ErrPlan

type ErrPlan string
const (
	ErrApply ErrPlan = "plan apply failed"
)

func (ErrPlan) Error

func (e ErrPlan) Error() string

type Operation

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

func NewOperation

func NewOperation(options OperationOptions) (Operation, error)

func (*Operation) AddAction

func (op *Operation) AddAction(action Action)

func (*Operation) AddActions

func (op *Operation) AddActions(actions ...Action)

func (*Operation) AddConflict

func (op *Operation) AddConflict(conflict Conflict)

func (*Operation) AddPackage

func (op *Operation) AddPackage(identity string)

func (*Operation) Finalize

func (op *Operation) Finalize() (Plan, error)

func (Operation) HasConflicts

func (op Operation) HasConflicts() bool

func (Operation) Registry

func (op Operation) Registry() state.Registry

func (*Operation) ResolvePackages

func (op *Operation) ResolvePackages(refs []string, all bool) ([]packages.Resolved, error)

func (Operation) Scope

func (op Operation) Scope() domain.TargetScope

func (*Operation) SetPackages

func (op *Operation) SetPackages(identities ...string)

func (Operation) Source

func (op Operation) Source() state.Source

type OperationOptions

type OperationOptions struct {
	Context  string
	SourceID string
	Apply    bool
}

type Plan

type Plan struct {
	Context   string     `json:"-"`
	DryRun    bool       `json:"dryRun"`
	Applied   bool       `json:"applied"`
	Packages  []string   `json:"packages"`
	Privilege Privilege  `json:"privilege"`
	Actions   []Action   `json:"actions"`
	Conflicts []Conflict `json:"conflicts"`
}

func NewPlan

func NewPlan(context string, apply bool) Plan

type Privilege

type Privilege struct {
	Required  bool   `json:"required"`
	Satisfied *bool  `json:"satisfied,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

Jump to

Keyboard shortcuts

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