restoreplan

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 22 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 IsChangedSincePreview added in v0.4.8

func IsChangedSincePreview(err error) bool

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 SetTransferPlannerForTest added in v0.4.7

func SetTransferPlannerForTest(planner transfer.EnginePlanner) func()

func ValidatePathTarget

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

func ValidateSource

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

func ValidateSourcePath

func ValidateSourcePath(repoRoot, workspaceName string, plan *Plan, engineType model.EngineType) (*transfer.Record, 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 ExpectedSeparatedContext added in v0.4.7

type ExpectedSeparatedContext struct {
	RepoID      string
	ControlRoot string
	PayloadRoot string
	Workspace   string
}

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"`
	Transfers               []transfer.Record  `json:"transfers,omitempty"`
	RunCommand              string             `json:"run_command"`
	DecisionOnly            bool               `json:"decision_only,omitempty"`
}

func Create

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

func CreateDecisionPreview added in v0.4.7

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

func CreateDecisionPreviewWithExpectedSeparatedContext added in v0.4.7

func CreateDecisionPreviewWithExpectedSeparatedContext(repoRoot, workspaceName string, sourceID model.SnapshotID, engineType model.EngineType, expected ExpectedSeparatedContext) (*Plan, error)

func CreatePath

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

func CreatePathDecisionPreview added in v0.4.7

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

func CreatePathDecisionPreviewWithExpectedSeparatedContext added in v0.4.7

func CreatePathDecisionPreviewWithExpectedSeparatedContext(repoRoot, workspaceName string, sourceID model.SnapshotID, path string, engineType model.EngineType, expected ExpectedSeparatedContext) (*Plan, error)

func CreatePathWithExpectedSeparatedContext added in v0.4.7

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

func CreateWithExpectedSeparatedContext added in v0.4.7

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

func Discard added in v0.4.8

func Discard(repoRoot, workspaceName, planID string) (*Plan, error)

func Load

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

func (*Plan) EffectiveScope

func (p *Plan) EffectiveScope() string

func (*Plan) IsRunnable added in v0.4.7

func (p *Plan) IsRunnable() bool

Jump to

Keyboard shortcuts

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