upgrade

package
v0.0.0-...-fab76b5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ErrUpgradeInProgress indicates that an upgrade is already in progress.
	ErrUpgradeInProgress = errors.ConstError("upgrade in progress")
)

Variables

View Source
var (
	ErrAlreadyAtState     = errors.ConstError("already at state")
	ErrUnableToTransition = errors.ConstError("unable to transition")
)
View Source
var States = map[State]string{
	Created:        "created",
	Started:        "started",
	DBCompleted:    "db-completed",
	StepsCompleted: "steps-completed",
	Error:          "error",
}

States holds all the possible states.

Functions

This section is empty.

Types

type Info

type Info struct {
	// UUID holds the upgrader's ID.
	UUID string
	// PreviousVersion holds the previous version.
	PreviousVersion string
	// TargetVersion holds the target version.
	TargetVersion string
	// State holds the current state of the upgrade.
	State State
}

Info holds the information about database upgrade

type State

type State int

State represents the state of the upgrade.

const (
	// Created is the initial state of an upgrade. All upgrades should start
	// in this initial state.
	Created State = iota
	// Started is the state of an upgrade after it has been started.
	Started
	// DBCompleted is the state of an upgrade after the database has been
	// upgraded.
	DBCompleted
	// StepsCompleted is the state of an upgrade after all the steps have
	// been completed.
	StepsCompleted
	// Error is the state of an upgrade after an error has occurred.
	Error
)

func ParseState

func ParseState(str string) (State, error)

ParseState returns the state from a string.

func (State) IsTerminal

func (s State) IsTerminal() bool

IsTerminal returns true if the state is terminal. A terminal state is one that cannot be transitioned from.

func (State) String

func (s State) String() string

func (State) TransitionTo

func (s State) TransitionTo(target State) error

TransitionTo returns an error if the transition is not allowed.

Jump to

Keyboard shortcuts

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