Documentation
¶
Overview ¶
Package recovery manages durable recovery plans for restore operations.
Index ¶
- Constants
- Variables
- func BackupMissingIsSafe(plan *Plan) bool
- func CurrentEvidence(repoRoot string, plan *Plan) (string, error)
- func NewPlanID() string
- func SetRestoreBackupCloneHookForTest(hook func(src, dst string) error) func()
- func SetWriteHookForTest(hook func(string, []byte, os.FileMode) error) func()
- func SetWriteWorktreeConfigHookForTest(hook func(repoRoot, name string, cfg *model.WorktreeConfig) error) func()
- func VerifyMissingBackupRecoveryPoint(repoRoot string, plan *Plan) error
- type Backup
- type BackupEntry
- type BackupScope
- type BackupState
- type CurrentState
- type Manager
- func (m *Manager) ActiveForWorkspace(workspace string) ([]Plan, error)
- func (m *Manager) CreateActiveForRestore(preview *restoreplan.Plan, backupPath string) (*Plan, error)
- func (m *Manager) List() ([]Plan, error)
- func (m *Manager) Load(planID string) (*Plan, error)
- func (m *Manager) MarkResolved(planID string) error
- func (m *Manager) RemoveBackup(plan *Plan) error
- func (m *Manager) RemoveBackupPath(plan *Plan, backupPath string) error
- func (m *Manager) RestoreBackup(plan *Plan) error
- func (m *Manager) Write(plan *Plan) error
- type Operation
- type Phase
- type Plan
- type RecognizedState
- type Status
- type VisiblePlanWriteUncertainError
- type WorktreeState
Constants ¶
View Source
const SchemaVersion = 1
Variables ¶
View Source
var (
ErrBackupMissing = errors.New("recovery backup is missing")
)
Functions ¶
func BackupMissingIsSafe ¶
func SetWriteHookForTest ¶
func SetWriteWorktreeConfigHookForTest ¶
func SetWriteWorktreeConfigHookForTest(hook func(repoRoot, name string, cfg *model.WorktreeConfig) error) func()
Types ¶
type Backup ¶
type Backup struct {
Path string `json:"path"`
Scope BackupScope `json:"scope"`
State BackupState `json:"state,omitempty"`
TouchedPaths []string `json:"touched_paths,omitempty"`
Entries []BackupEntry `json:"entries,omitempty"`
PayloadRolledBack bool `json:"payload_rolled_back,omitempty"`
}
type BackupEntry ¶
type BackupScope ¶
type BackupScope string
const ( BackupScopeWhole BackupScope = "whole" BackupScopePath BackupScope = "path" )
type BackupState ¶
type BackupState string
const ( BackupStatePending BackupState = "pending" BackupStateRequired BackupState = "required" BackupStateRolledBack BackupState = "rolled_back" )
type CurrentState ¶
type CurrentState struct {
State RecognizedState
Evidence string
}
func RecognizeCurrentState ¶
func RecognizeCurrentState(repoRoot string, plan *Plan) (CurrentState, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ActiveForWorkspace ¶
func (*Manager) CreateActiveForRestore ¶
func (*Manager) MarkResolved ¶
func (*Manager) RemoveBackup ¶
func (*Manager) RemoveBackupPath ¶
func (*Manager) RestoreBackup ¶
type Plan ¶
type Plan struct {
SchemaVersion int `json:"schema_version"`
RepoID string `json:"repo_id"`
PlanID string `json:"plan_id"`
Status Status `json:"status"`
Operation Operation `json:"operation"`
RestorePlanID string `json:"restore_plan_id"`
Workspace string `json:"workspace"`
Folder string `json:"folder"`
SourceSavePoint model.SnapshotID `json:"source_save_point"`
Path string `json:"path,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
PreWorktreeState WorktreeState `json:"pre_worktree_state"`
Backup Backup `json:"backup"`
Phase Phase `json:"phase,omitempty"`
PreRecoveryEvidence string `json:"pre_recovery_evidence,omitempty"`
RecoveryEvidence string `json:"recovery_evidence,omitempty"`
LastError string `json:"last_error,omitempty"`
CompletedSteps []string `json:"completed_steps,omitempty"`
PendingSteps []string `json:"pending_steps,omitempty"`
RecommendedNextCommand string `json:"recommended_next_command"`
CleanupProtectionPinIDs []string `json:"cleanup_protection_pin_ids,omitempty"`
CleanupProtectionPins []model.Pin `json:"cleanup_protection_pins,omitempty"`
RestoreOptions restoreplan.Options `json:"restore_options,omitempty"`
}
type RecognizedState ¶
type RecognizedState string
const ( RecognizedPlanEvidence RecognizedState = "plan_evidence" RecognizedPreMutation RecognizedState = "pre_mutation" RecognizedRestoreTarget RecognizedState = "restore_target" RecognizedBackupPayloadRestored RecognizedState = "backup_payload_restored" )
type VisiblePlanWriteUncertainError ¶
func (*VisiblePlanWriteUncertainError) Error ¶
func (e *VisiblePlanWriteUncertainError) Error() string
func (*VisiblePlanWriteUncertainError) Unwrap ¶
func (e *VisiblePlanWriteUncertainError) Unwrap() error
type WorktreeState ¶
type WorktreeState struct {
Name string `json:"name"`
RealPath string `json:"real_path,omitempty"`
BaseSnapshotID model.SnapshotID `json:"base_snapshot_id,omitempty"`
HeadSnapshotID model.SnapshotID `json:"head_snapshot_id,omitempty"`
LatestSnapshotID model.SnapshotID `json:"latest_snapshot_id,omitempty"`
PathSources model.PathSources `json:"path_sources,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
func (WorktreeState) WorktreeConfig ¶
func (s WorktreeState) WorktreeConfig() *model.WorktreeConfig
Click to show internal directories.
Click to hide internal directories.