Documentation
¶
Overview ¶
Package planner computes the desired file state for a profile apply or unapply. It reads the filesystem to check file existence and ownership but has no write side effects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conflict ¶
type Conflict struct {
ModFileVersionID int64
ProfileItemID int64
Entry RemappedEntry
Priority int64
Won bool
// Display fields for dry-run output and status reporting.
ModPageName string
FileLabel string
VersionString string // empty if not set
}
Conflict records a single mod's claim on a destination path.
type Plan ¶
type Plan struct {
GameInstallID int64
ProfileID int64 // 0 for unapply plans
TargetID int64
TargetRoot string
Files []PlanFile // one per destination path, apply plans only
Ops []PlanOp
Warnings []string
}
Plan is the full computed desired state for a profile apply or unapply. It has no disk side effects and can be used directly for dry-run output.
func BuildApplyPlan ¶
func BuildApplyPlan(ctx context.Context, q *dbq.Queries, gameInstallID, profileID int64, skipRecheck bool) (Plan, error)
BuildApplyPlan computes the desired file state for applying profileID to gameInstallID. It reads the filesystem to check file existence and ownership but does not modify anything.
type PlanFile ¶
type PlanFile struct {
DestPath string
ProfileItemID int64
Conflicts []Conflict // sorted priority desc; exactly one has Won=true
}
PlanFile is the resolved state for a single destination path. The winner is the Conflict where Won == true. All other entries in Conflicts lost.
type PlanOp ¶
type PlanOp struct {
Kind PlanOpKind
DestPath string
// File is set for Write, Overwrite ops.
File *PlanFile
// BackupSha256 is set for RestoreBackup ops.
BackupSha256 string
// NeedsBackup is true when a pre-existing non-tool-owned file must be
// backed up before being overwritten.
NeedsBackup bool
}
PlanOp is a single file operation the apply step will execute.
type PlanOpKind ¶
type PlanOpKind string
PlanOpKind describes what a single file operation will do.
const ( PlanOpWrite PlanOpKind = "write" PlanOpOverwrite PlanOpKind = "overwrite" PlanOpRemove PlanOpKind = "remove" PlanOpRestoreBackup PlanOpKind = "restore_backup" PlanOpNoop PlanOpKind = "noop" )
type RemappedEntry ¶
type RemappedEntry struct {
ArchiveSha256 string
Position int64
SourcePath string
DestPath string
SizeBytes int64
}
RemappedEntry is a single archive entry after remap rules have been applied.
type UninventoriedArchiveError ¶
type UninventoriedArchiveError struct {
ModFileVersionID int64
ModPageName string
FileLabel string
ArchiveSha256 string
}
UninventoriedArchiveError is returned when a profile item references an archive that has not yet been scanned.
func (*UninventoriedArchiveError) Error ¶
func (e *UninventoriedArchiveError) Error() string