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 ¶
- Variables
- func CreateBackup(ctx context.Context, request BackupRequest) (string, error)
- func VerifyBackup(ctx context.Context, path string, expected BackupRequest) error
- func VerifyGenerationAgainstBackup(ctx context.Context, generationPath, backupPath string) error
- type BackupRequest
- type Backuper
- type Detector
- type FullIndexer
- type Options
- type Rebuilder
- type Report
- type Restorer
- type RoleResolver
- type Stage
- type StageName
Constants ¶
This section is empty.
Variables ¶
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.
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 FullIndexer ¶
type FullIndexer func(context.Context, indexer.FullOptions) (facts.Set, indexer.FullReport, error)
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 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.
type Restorer ¶
type Restorer func(context.Context, string, generation.Config, string, generation.ValidateFunc) error
Restorer switches CURRENT to a retained generation after validation.
type RoleResolver ¶
RoleResolver resolves the generation pointers.