effects

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package effects provides the default implementation of actions.Performer — mode-aware filesystem and command primitives used by action handlers.

Spec 16 (docs-working/spec-16-unify-dryrun-execute.md) collapses each handler's parallel Execute / DryRun / Check methods into a single Run(ctx, step) method. Inside Run, handlers call Performer methods instead of os.* directly. The Performer consults the current mode and either performs the side effect (ModeExecute) or returns a prediction (ModePlan).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPerformer

func NewPerformer(modeFn ModeFunc, sudoPass string) actions.Performer

NewPerformer constructs an actions.Performer that performs real filesystem operations in ModeExecute and inspects state in ModePlan. modeFn is called once per primitive to decide the path; sudoPass is consulted when opts.Become is true.

Types

type ContentDiff

type ContentDiff struct {
	OldSize int    `json:"old_size"`
	NewSize int    `json:"new_size"`
	OldHash string `json:"old_hash"`
	NewHash string `json:"new_hash"`
}

ContentDiff is a small structured summary attached to Effect.Detail for WriteFile when content would change.

type ModeFunc

type ModeFunc func() actions.Mode

ModeFunc returns the current actions.Mode. The Performer calls it on each operation so callers can swap modes between calls (rare; typically pinned per execution context).

Jump to

Keyboard shortcuts

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