Documentation
¶
Index ¶
- func Register(reg *execution.ActionRegistry)
- type Backup
- type Copy
- type Exists
- type IsDir
- type Link
- type Mkdir
- type Move
- type Provider
- func (p *Provider) Backup(path, backupSuffix string) (string, map[string]any, error)
- func (p *Provider) CompensateBackup(state map[string]any) error
- func (p *Provider) CompensateCopy(state map[string]any) error
- func (p *Provider) CompensateLink(state map[string]any) error
- func (p *Provider) CompensateMove(state map[string]any) error
- func (p *Provider) CompensateRemove(state map[string]any) error
- func (p *Provider) CompensateUnlink(state map[string]any) error
- func (p *Provider) CompensateWrite(state map[string]any) error
- func (p *Provider) Copy(path string, mode os.FileMode, content []byte) (string, map[string]any, error)
- func (p *Provider) Exists(path string) bool
- func (p *Provider) IsDir(path string) bool
- func (p *Provider) Link(source, path string) (map[string]any, error)
- func (p *Provider) Mkdir(path string, mode os.FileMode) error
- func (p *Provider) Move(gitMv func(src, dst string) error, source, path string) (map[string]any, error)
- func (p *Provider) Remove(path string, prune bool, pruneBoundary string) (map[string]any, error)
- func (p *Provider) Source(path string) ([]byte, error)
- func (p *Provider) Unlink(path string, prune bool, pruneBoundary string) (map[string]any, error)
- func (p *Provider) Write(content, path string, mode os.FileMode) (map[string]any, error)
- type Remove
- type Source
- type Unlink
- type Write
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 — Backup moves the file at path to a timestamped backup location. Returns the backup path and compensation state.
type Copy ¶
type Copy struct{ Impl *Provider }
Copy — Copy writes content to path with the given mode. Returns the SHA256 checksum of the written content and compensation state.
type Exists ¶
type Exists struct{ Impl *Provider }
Exists — Exists returns true if path exists on the filesystem.
type IsDir ¶
type IsDir struct{ Impl *Provider }
IsDir — IsDir returns true if path exists and is a directory.
type Link ¶
type Link struct{ Impl *Provider }
Link — Link creates a symlink at path pointing to source. Idempotent: if the symlink already points correctly, it's a no-op (returns nil state).
type Mkdir ¶
type Mkdir struct{ Impl *Provider }
Mkdir — Mkdir creates a directory (and parents) with the given mode.
type Move ¶
type Move struct{ Impl *Provider }
Move — Move moves a file from source to path. Uses gitMv if provided (preserves git history), falling back to os.Rename. Returns compensation state with paths for reverse move.
type Provider ¶
type Provider struct{}
Provider provides file system actions. Each method receives all inputs as parameters — no execution context, no node access.
Compensable Forward methods return (result, map[string]any, error). The map is the compensation receipt — opaque to the executor, meaningful only to the corresponding Compensate* Backward method.
func (*Provider) Backup ¶
Backup moves the file at path to a timestamped backup location. Returns the backup path and compensation state.
func (*Provider) CompensateBackup ¶
CompensateBackup undoes a Backup by moving the backup back to the original path.
func (*Provider) CompensateCopy ¶
CompensateCopy undoes a Copy action using the captured state.
func (*Provider) CompensateLink ¶
CompensateLink undoes a Link action using the captured state.
func (*Provider) CompensateMove ¶
CompensateMove undoes a Move by moving the file back from path to source.
func (*Provider) CompensateRemove ¶
CompensateRemove undoes a Remove by re-creating the file with saved content and mode.
func (*Provider) CompensateUnlink ¶
CompensateUnlink undoes an Unlink by re-creating the symlink.
func (*Provider) CompensateWrite ¶
CompensateWrite undoes a Write action using the captured state.
func (*Provider) Copy ¶
func (p *Provider) Copy(path string, mode os.FileMode, content []byte) (string, map[string]any, error)
Copy writes content to path with the given mode. Returns the SHA256 checksum of the written content and compensation state.
func (*Provider) Link ¶
Link creates a symlink at path pointing to source. Idempotent: if the symlink already points correctly, it's a no-op (returns nil state).
func (*Provider) Move ¶
func (p *Provider) Move(gitMv func(src, dst string) error, source, path string) (map[string]any, error)
Move moves a file from source to path. Uses gitMv if provided (preserves git history), falling back to os.Rename. Returns compensation state with paths for reverse move.
func (*Provider) Remove ¶
Remove deletes the file at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary. Returns compensation state with file content for re-creation.
type Remove ¶
type Remove struct{ Impl *Provider }
Remove — Remove deletes the file at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary. Returns compensation state with file content for re-creation.
type Source ¶
type Source struct{ Impl *Provider }
Source — Source reads a file and returns its contents.
type Unlink ¶
type Unlink struct{ Impl *Provider }
Unlink — Unlink removes a symlink at path. If prune is true and pruneBoundary is set, empty parent directories are removed up to the boundary. Returns compensation state with the symlink target for re-creation.