resident

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package resident owns resident-root policy and path anchoring: the closed table of repository-wide roots awf owns at the primary control root, the predicate that recognises a path or a render kind as resident, the Roots value that resolves an output path against the right anchor, and the resident lifecycle operations. The sync core depends on this package; this package never depends on the core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollisionsAt

func CollisionsAt(root string, planned []string) ([]string, error)

CollisionsAt filters planned project-relative paths to those that already exist under root and are not recorded in root's lock (not awf-managed). Split from InitCollisions so init's pre-prompt probe can plan outputs in a throwaway scaffold and test them against the real root; the ADR-0016 collision semantics are unchanged.

func InspectRoots

func InspectRoots(root string) ([]string, error)

InspectRoots examines direct children only. It never traverses a dynamic resident tree; a descendant other than the managed .gitignore keeps its root intact. Publisher's read-only inspection owns its existing host-path seam. InspectRoots is the read-only inspection entry point used by Publisher.

func IsResidentKind

func IsResidentKind(kind string) bool

IsResidentKind reports whether a render kind is one of the resident roots' self-ignoring render units, so a caller never spells the names to decide it.

func IsResidentPath

func IsResidentPath(path string) bool

IsResidentPath reports whether a config-relative slash path names a resident root or something below one.

func PreserveRemoval

func PreserveRemoval(path string, preserved []string) bool

PreserveRemoval reports whether a lock-relative path lies inside a resident root the inspection found to hold dynamic data, so removal must skip it.

func RootNames

func RootNames() []string

RootNames returns the owned root names in table order. It hands back a copy so the single declaration above stays the only writable home of the set.

Types

type Backup added in v0.36.0

type Backup struct {
	Path string
	Bak  string
}

Backup records one local document preserved during uninstall. Both paths are lock-relative and Bak is the exact first-free sibling chosen by Backup.

type PartialUninstallError added in v0.41.0

type PartialUninstallError struct {
	Report   UninstallReport
	Cause    error
	Recovery []string
}

PartialUninstallError retains the committed uninstall report when a later removal fails. It preserves the mechanism error for errors.Is/As and names the convergent recovery the resident operation owns.

func (*PartialUninstallError) Document added in v0.41.0

func (*PartialUninstallError) Error added in v0.41.0

func (e *PartialUninstallError) Error() string

func (*PartialUninstallError) Unwrap added in v0.41.0

func (e *PartialUninstallError) Unwrap() error

type Roots

type Roots struct {
	Tracked  string
	Resident string
}

Roots anchors output paths. Tracked is the invoking checkout that owns every tracked output; Resident is the primary control root that owns the dynamic resident trees. Both are construction inputs, fixed when a project opens.

func NewRoots

func NewRoots(tracked, resident string) Roots

NewRoots pairs the tracked and resident anchors into the value that owns output-path resolution.

func (Roots) ResolveOutput

func (r Roots) ResolveOutput(path string) string

ResolveOutput resolves resident root artifacts at the primary control root while leaving every tracked output anchored at the invoking checkout.

type UninstallReport

type UninstallReport struct {
	Removed          int
	RemovedGenerated []string
	PreservedRoots   []string
	Backups          []Backup
	RemovedEmptyDirs []string
	LockRemoved      bool
}

UninstallReport records every stable root-relative effect committed by an uninstall. Removed remains the compatibility summary; callers that need to recover or present the result use the exact effect lists.

func UninstallLeased added in v0.41.0

func UninstallLeased(ctx context.Context, root string, preserveTemplate func(string) bool, lease *filesystem.Lease) (UninstallReport, error)

UninstallLeased removes awf's generated footprint while preserving dynamic resident state. The caller supplies the live dual-root lease acquired before authority loading; this operation verifies it before reading the lock.

func (UninstallReport) Document

func (r UninstallReport) Document() (presentation.Document, error)

Document maps an uninstall result into its complete ordinary presentation.

func (UninstallReport) PartialDocument added in v0.41.0

func (r UninstallReport) PartialDocument() (presentation.Document, error)

PartialDocument retains every completed uninstall fact when a later removal fails and gives the caller a convergent retry action.

Jump to

Keyboard shortcuts

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