Documentation
¶
Index ¶
- Constants
- Variables
- func CacheDir() (string, error)
- func CachePath(name string) (string, error)
- func ConfigDir() (string, error)
- func CopyTree(source, destination string) error
- func DataDir() (string, error)
- func EffectiveConfigPath(name string) (string, error)
- func EffectiveDataDir(markers ...string) (string, error)
- func EffectiveDataPath(name string, markers ...string) (string, error)
- func LegacyDir() (string, error)
- func MergeTree(source, destination string) (conflicted bool, err error)
- type MigrationItem
- type MigrationOptions
- type MigrationResult
- type PathCategory
Constants ¶
const AppDirName = "agent-deck"
Variables ¶
var ErrMigrationConflict = errors.New("migration destination conflict")
Functions ¶
func CopyTree ¶ added in v1.9.63
CopyTree copies source to destination, refusing to overwrite any destination leaf that already exists (atomic O_EXCL/Link publish). It returns ErrMigrationConflict if a leaf already exists, so callers can treat a pre-existing destination as a conflict to preserve rather than a hard error. Use for the no-prior-destination fast path; use MergeTree when the destination may already hold (newer) data to merge into.
func EffectiveConfigPath ¶
func EffectiveDataDir ¶
func MergeTree ¶ added in v1.9.63
MergeTree merges source into destination using the same non-destructive, no-clobber semantics as the legacy layout migration: an existing destination file/symlink is PRESERVED (the source copy is skipped and reported via conflicted=true), directories are merged recursively, and a TOCTOU race on a leaf surfaces as a conflict rather than a truncation. It never removes the destination tree. Exposed for reuse by conductor dir relocation, which needs the identical "newer destination wins, report conflicts" guarantee.
Types ¶
type MigrationItem ¶
type MigrationItem struct {
Name string
Category PathCategory
Source string
Destination string
Directory bool
}
type MigrationOptions ¶
type MigrationResult ¶
type MigrationResult struct {
DryRun bool
Copied []MigrationItem
Skipped []MigrationItem
Conflicts []MigrationItem
}
func MigrateLegacyLayout ¶
func MigrateLegacyLayout(opts MigrationOptions) (*MigrationResult, error)
type PathCategory ¶
type PathCategory string
const ( CategoryConfig PathCategory = "config" CategoryData PathCategory = "data" CategoryCache PathCategory = "cache" )