file

package
v0.1.0-dev.20260216090256 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(reg *execution.ActionRegistry)

Register registers all file actions with the given registry.

Types

type Backup

type Backup struct{ Impl *Provider }

Backup moves the existing file at "path" slot to a timestamped backup. Returns the backup path as Result.

func (*Backup) Do

func (*Backup) Name

func (o *Backup) Name() string

func (*Backup) Undo

func (o *Backup) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Copy

type Copy struct{ Impl *Provider }

Copy writes content to "path" slot (consumer: reads content from slot, checksums).

func (*Copy) Do

func (o *Copy) Do(ctx *execution.Context, slots map[string]any) (execution.Result, execution.UndoState, error)

func (*Copy) Name

func (o *Copy) Name() string

func (*Copy) Undo

func (o *Copy) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error
type Link struct{ Impl *Provider }

Link creates a symlink from "path" slot pointing to "source" slot.

func (*Link) Do

func (o *Link) Do(ctx *execution.Context, slots map[string]any) (execution.Result, execution.UndoState, error)

func (*Link) Name

func (o *Link) Name() string

func (*Link) Undo

func (o *Link) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Mkdir

type Mkdir struct{ Impl *Provider }

Mkdir creates a directory at "path" slot.

func (*Mkdir) Do

func (*Mkdir) Name

func (o *Mkdir) Name() string

func (*Mkdir) Undo

func (o *Mkdir) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Move

type Move struct{ Impl *Provider }

Move moves a file from "source" slot to "path" slot.

func (*Move) Do

func (o *Move) Do(ctx *execution.Context, slots map[string]any) (execution.Result, execution.UndoState, error)

func (*Move) Name

func (o *Move) Name() string

func (*Move) Undo

func (o *Move) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Provider

type Provider struct{}

Provider provides file system operations. Each method receives all inputs as parameters — no execution context, no node access.

func (*Provider) Backup

func (p *Provider) Backup(path, backupSuffix string) (string, error)

Backup moves the file at path to a timestamped backup location. Returns the backup path.

func (*Provider) Copy

func (p *Provider) Copy(path string, mode os.FileMode, content []byte) (string, error)

Copy writes content to path with the given mode. Returns the SHA256 checksum of the written content.

func (p *Provider) Link(source, path string) error

Link creates a symlink at path pointing to source. Idempotent: if the symlink already points correctly, it's a no-op.

func (*Provider) Mkdir

func (p *Provider) Mkdir(path string, mode os.FileMode) error

Mkdir creates a directory (and parents) with the given mode.

func (*Provider) Move

func (p *Provider) Move(gitMv func(src, dst string) error, source, path string) error

Move moves a file from source to path. Uses gitMv if provided (preserves git history), falling back to os.Rename.

func (*Provider) Remove

func (p *Provider) Remove(path string, prune bool, pruneBoundary string) error

Remove deletes the file at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary.

func (*Provider) Source

func (p *Provider) Source(path string) ([]byte, error)

Source reads a file and returns its contents.

func (p *Provider) Unlink(path string, prune bool, pruneBoundary string) error

Unlink removes a symlink at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary.

func (*Provider) Write

func (p *Provider) Write(content, path string, mode os.FileMode) error

Write writes inline content to path with the given mode.

type Remove

type Remove struct{ Impl *Provider }

Remove deletes the file at "path" slot.

func (*Remove) Do

func (*Remove) Name

func (o *Remove) Name() string

func (*Remove) Undo

func (o *Remove) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Source

type Source struct{ Impl *Provider }

Source reads a file and returns its content as Result for downstream nodes.

func (*Source) Do

func (*Source) Name

func (o *Source) Name() string

func (*Source) Undo

func (o *Source) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error
type Unlink struct{ Impl *Provider }

Unlink removes a symlink at "path" slot.

func (*Unlink) Do

func (*Unlink) Name

func (o *Unlink) Name() string

func (*Unlink) Undo

func (o *Unlink) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

type Write

type Write struct{ Impl *Provider }

Write writes content from "content" slot to "path" slot.

func (*Write) Do

func (*Write) Name

func (o *Write) Name() string

func (*Write) Undo

func (o *Write) Undo(_ *execution.Context, _ map[string]any, _ execution.UndoState) error

Jump to

Keyboard shortcuts

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