restoreplan

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package restoreplan builds and persists preview plans for destructive restore operations.

Index

Constants

View Source
const (
	SchemaVersion = 1

	ScopeWhole = "whole"
	ScopePath  = "path"
)

Variables

This section is empty.

Functions

func InspectSourceReadOnly

func InspectSourceReadOnly(repoRoot string, sourceID model.SnapshotID) (*snapshot.PublishState, error)

func PathEvidence

func PathEvidence(repoRoot, workspaceName, normalizedPath string) (string, error)

func PathEvidenceFromRoot

func PathEvidenceFromRoot(root, normalizedPath string, excluded func(rel string) bool) (string, error)

PathEvidenceFromRoot computes path-level evidence for a managed payload root.

func SetCapacityGateForTest

func SetCapacityGateForTest(gate capacitygate.Gate) func()

func ValidatePathTarget

func ValidatePathTarget(repoRoot, workspaceName string, plan *Plan) error

func ValidateSource

func ValidateSource(repoRoot, workspaceName string, plan *Plan, engineType model.EngineType) error

func ValidateSourcePath

func ValidateSourcePath(repoRoot, workspaceName string, plan *Plan, engineType model.EngineType) error

func ValidateTarget

func ValidateTarget(repoRoot, workspaceName string, plan *Plan) error

func WorkspaceEvidence

func WorkspaceEvidence(repoRoot, workspaceName string) (string, error)

func Write

func Write(repoRoot string, plan *Plan) error

Types

type ChangeSummary

type ChangeSummary struct {
	Count   int      `json:"count"`
	Samples []string `json:"samples,omitempty"`
}

type ManagedFilesImpact

type ManagedFilesImpact struct {
	Overwrite ChangeSummary `json:"overwrite"`
	Delete    ChangeSummary `json:"delete"`
	Create    ChangeSummary `json:"create"`
}

func ComputeManagedImpact

func ComputeManagedImpact(repoRoot, workspaceName string, sourceID model.SnapshotID, engineType model.EngineType) (ManagedFilesImpact, error)

func ComputeManagedPathImpact

func ComputeManagedPathImpact(repoRoot, workspaceName string, sourceID model.SnapshotID, path string, engineType model.EngineType) (ManagedFilesImpact, error)

type Options

type Options struct {
	DiscardUnsaved bool `json:"discard_unsaved,omitempty"`
	SaveFirst      bool `json:"save_first,omitempty"`
}

type Plan

type Plan struct {
	SchemaVersion           int                `json:"schema_version"`
	RepoID                  string             `json:"repo_id"`
	PlanID                  string             `json:"plan_id"`
	CreatedAt               time.Time          `json:"created_at"`
	Scope                   string             `json:"scope,omitempty"`
	Folder                  string             `json:"folder"`
	Workspace               string             `json:"workspace"`
	SourceSavePoint         model.SnapshotID   `json:"source_save_point"`
	Path                    string             `json:"path,omitempty"`
	NewestSavePoint         *model.SnapshotID  `json:"newest_save_point"`
	HistoryHead             *model.SnapshotID  `json:"history_head"`
	ExpectedNewestSavePoint *model.SnapshotID  `json:"expected_newest_save_point"`
	ExpectedFolderEvidence  string             `json:"expected_folder_evidence,omitempty"`
	ExpectedPathEvidence    string             `json:"expected_path_evidence,omitempty"`
	Options                 Options            `json:"options,omitempty"`
	ManagedFiles            ManagedFilesImpact `json:"managed_files"`
	RunCommand              string             `json:"run_command"`
}

func Create

func Create(repoRoot, workspaceName string, sourceID model.SnapshotID, engineType model.EngineType, options Options) (*Plan, error)

func CreatePath

func CreatePath(repoRoot, workspaceName string, sourceID model.SnapshotID, path string, engineType model.EngineType, options Options) (*Plan, error)

func Load

func Load(repoRoot, planID string) (*Plan, error)

func (*Plan) EffectiveScope

func (p *Plan) EffectiveScope() string

Jump to

Keyboard shortcuts

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