clonehistory

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: 13 Imported by: 0

Documentation

Overview

Package clonehistory owns durable metadata for save points imported by repository clone. It deliberately avoids clone orchestration.

Index

Constants

View Source
const (
	ManifestSchemaVersion = 1

	OperationRepoClone = "repo_clone"
	SavePointsModeAll  = "all"
)

Variables

This section is empty.

Functions

func ComputeImportedSavePointsEvidence

func ComputeImportedSavePointsEvidence(ids []model.SnapshotID) (int, string)

ComputeImportedSavePointsEvidence returns the canonical count and checksum for imported save point IDs. It is exposed for tests and low-level recovery tools that need to construct raw manifest fixtures without going through WriteManifest.

func ManifestPath

func ManifestPath(repoRoot string) string

ManifestPath returns the durable imported clone history manifest path.

func ValidateManifest

func ValidateManifest(repoRoot string, manifest *Manifest) error

ValidateManifest verifies manifest identity, shape, and referenced save point publish state. A validation error means cleanup and doctor must fail closed.

func WriteManifest

func WriteManifest(repoRoot string, manifest Manifest) error

WriteManifest validates and atomically writes the imported clone history manifest.

Types

type Manifest

type Manifest struct {
	SchemaVersion      int                `json:"schema_version"`
	Operation          string             `json:"operation"`
	SourceRepoID       string             `json:"source_repo_id"`
	TargetRepoID       string             `json:"target_repo_id"`
	SavePointsMode     string             `json:"save_points_mode"`
	RuntimeStateCopied bool               `json:"runtime_state_copied"`
	ProtectionReason   string             `json:"protection_reason"`
	ImportedSavePoints []model.SnapshotID `json:"imported_save_points"`
	// ImportedSavePointsCount and ImportedSavePointsChecksum are durable
	// self-evidence for the canonical imported save point set.
	ImportedSavePointsCount    int    `json:"imported_save_points_count"`
	ImportedSavePointsChecksum string `json:"imported_save_points_checksum"`
}

Manifest records imported all-clone save points that must remain protected from reviewed cleanup.

func LoadManifest

func LoadManifest(repoRoot string) (*Manifest, bool, error)

LoadManifest reads the imported clone history manifest if present. Malformed or unsafe manifest storage returns an error so callers can fail closed.

func LoadValidatedManifest

func LoadValidatedManifest(repoRoot string) (*Manifest, bool, error)

LoadValidatedManifest reads and validates the manifest if present.

Jump to

Keyboard shortcuts

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