upgrade

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package upgrade migrates an incompatible canonical graph by rebuilding it from the registered source repositories. LadybugDB schemas are not altered in place: the old generation is backed up, a fresh canonical generation is validated, and publication remains atomic through generation.Store.

Index

Constants

This section is empty.

Variables

View Source
var ErrUpgradeFailed = errors.New("schema upgrade failed")

Functions

func CreateBackup

func CreateBackup(ctx context.Context, request BackupRequest) (string, error)

CreateBackup creates or verifies the deterministic backup location for a schema upgrade. It writes through a sibling temporary directory and atomically renames the completed copy into place.

func VerifyBackup

func VerifyBackup(ctx context.Context, path string, expected BackupRequest) error

VerifyBackup validates the manifest and every file digest in a backup. expected.SourcePath is intentionally ignored: the manifest is portable, while the generation and schema identities are checked.

func VerifyGenerationAgainstBackup

func VerifyGenerationAgainstBackup(ctx context.Context, generationPath, backupPath string) error

VerifyGenerationAgainstBackup proves that a retained generation still equals the immutable pre-upgrade backup before a pointer rollback.

Types

type BackupRequest

type BackupRequest struct {
	SourcePath        string
	DestinationRoot   string
	GenerationID      string
	FromSchemaVersion int
	ToSchemaVersion   int
}

BackupRequest identifies one schema-upgrade backup. The backup is a byte-for-byte copy of one immutable generation, not a live database copy.

type Backuper

type Backuper func(context.Context, BackupRequest) (string, error)

Backuper makes the immutable pre-upgrade copy.

type Detector

Detector identifies and validates the schema at one database path.

type FullIndexer

FullIndexer extracts authoritative facts from the registered repositories.

type Options

type Options struct {
	Root            string
	BackupRoot      string
	Store           generation.Config
	Full            indexer.FullOptions
	ResolverVersion string

	Roles   RoleResolver
	Detect  Detector
	Backup  Backuper
	Index   FullIndexer
	Rebuild Rebuilder
	Restore Restorer
}

type Rebuilder

type Rebuilder func(context.Context, rebuild.Options) (rebuild.Report, error)

Rebuilder publishes a candidate generation after its own integrity gates.

type Report

type Report struct {
	From                generation.Generation
	To                  generation.Generation
	FromSchema          ladybug.SchemaKind
	FromSchemaVersion   int
	TargetSchemaVersion int
	BackupPath          string
	Rebuild             rebuild.Report
	Stages              []Stage
	RolledBack          bool
	Passed              bool
}

Report accounts for detection, backup, migration, validation and rollback.

func Run

func Run(ctx context.Context, options Options) (Report, error)

Run upgrades an old canonical schema without mutating its database in place. The old schema is not converted by guessing column meanings: source repositories are re-indexed into a new canonical generation, which is the only authoritative reconstruction path for Kivgraph facts.

type Restorer

Restorer switches CURRENT to a retained generation after validation.

type RoleResolver

type RoleResolver func(context.Context, rebuild.LayoutOptions) (rebuild.Layout, error)

RoleResolver resolves the generation pointers.

type Stage

type Stage struct {
	Name   StageName
	Passed bool
	Detail string
}

Stage records one upgrade checkpoint, including skipped work.

type StageName

type StageName string

StageName identifies one observable upgrade checkpoint.

const (
	StageDetection  StageName = "detection"
	StageBackup     StageName = "backup"
	StageMigration  StageName = "migration"
	StageValidation StageName = "validation"
	StageRollback   StageName = "rollback"
)

Jump to

Keyboard shortcuts

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