installtxn

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package installtxn provides the cross-process filesystem transaction used by plugin and skill installation. Callers stage content before taking the lock, then commit the content swap and lockfile update together while holding it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitDir

func CommitDir(target string, staged string, publish func() error) error

CommitDir replaces target with staged and runs publish while retaining the previous target. If either the swap or publish fails, the previous target is restored (or the new target is removed for a first install).

The caller must hold the install-root lock returned by Lock.

func Lock

func Lock(dir string) (func(), error)

Lock takes the per-install-root cross-process lock. It blocks until any other installer or remover using dir has completed.

func RemoveDir

func RemoveDir(target string, publish func() error) error

RemoveDir removes target and runs publish while retaining the target until publish succeeds. A publish failure restores the directory.

The caller must hold the install-root lock returned by Lock.

func StageDir

func StageDir(dir string) (stage string, cleanup func(), err error)

StageDir creates an install workspace on the target filesystem. Content must be built and validated in the returned stage directory before CommitDir is called. cleanup is always safe to call.

func WriteFileAtomically

func WriteFileAtomically(path string, data []byte, perm os.FileMode) error

WriteFileAtomically publishes data by renaming a complete sibling temporary file over path. The caller is responsible for any surrounding transaction lock.

Types

This section is empty.

Jump to

Keyboard shortcuts

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