statemigration

package
v0.0.0-...-1f39044 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 1 module, 1 package

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

Index

Constants

This section is empty.

Variables

View Source
var ErrPendingRecovery = errors.New("old-schema pending recovery requires the corresponding previous SDK/binary; recover with it, then rerun migration dry-run and apply")

ErrPendingRecovery identifies persisted old-schema receipts and native intents that must be recovered with the corresponding previous SDK or binary.

View Source
var ErrPlanChanged = errors.New("state changed after review; rerun migrate-state --dry-run")

ErrPlanChanged refuses a migration whose reviewed bytes are no longer live.

Functions

This section is empty.

Types

type Migrator

type Migrator struct {
	LegacyPath string
	V2Store    statev2.Store
	Now        func() time.Time
	NewID      func() (string, error)
	Lock       ports.MutationLock
	// PendingCheck is strictly read-only. It refuses when any old-schema journal,
	// receipt or native intent needs the matching previous SDK or binary.
	PendingCheck func(context.Context) error
}

func (Migrator) Migrate

func (migrator Migrator) Migrate() (Report, error)

func (Migrator) MigrateCurrentV2

func (migrator Migrator) MigrateCurrentV2(ctx context.Context, expectedDigest string) (Report, error)

MigrateCurrentV2 performs the explicit schema 2-4 -> current migration in place. It is intentionally separate from MigrateExpected, which migrates the pre-v2 legacy store into a new authoritative file.

func (Migrator) MigrateExpected

func (migrator Migrator) MigrateExpected(expectedDigest string) (Report, error)

func (Migrator) Plan

func (migrator Migrator) Plan() (Plan, error)

func (Migrator) PlanCurrentV2

func (migrator Migrator) PlanCurrentV2() (Plan, error)

PlanCurrentV2 inspects authoritative schemas 2-4 without writing them. The digest is the token the apply step must recheck under the global mutation lock.

type Plan

type Plan struct {
	LegacyDigest  string `json:"legacy_digest"`
	Installations int    `json:"installations"`
	NeedsRebind   int    `json:"needs_rebind"`
	SourceSchema  int    `json:"source_schema,omitempty"`
}

type Report

type Report struct {
	BackupPath           string
	Migrated             int
	NeedsRebind          int
	LegacyStateUntouched bool
}

Jump to

Keyboard shortcuts

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