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 ¶
- func CommitDir(target string, staged string, publish func() error) error
- func Lock(dir string) (func(), error)
- func RemoveDir(target string, publish func() error) error
- func StageDir(dir string) (stage string, cleanup func(), err error)
- func WriteFileAtomically(path string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitDir ¶
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 ¶
Lock takes the per-install-root cross-process lock. It blocks until any other installer or remover using dir has completed.
func RemoveDir ¶
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.
Types ¶
This section is empty.