migration

package
v0.10.3-0...-f06509b Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Role = "migration"
)

Variables

Functions

This section is empty.

Types

type Migration

type Migration interface {
	// Validate if migration can be executed. For example, higher version to lower version is not allowed.
	Validate() error
	// CheckCompatible check if target is compatible with source. If compatible, no migration should be executed.
	CheckCompatible() bool
	// CheckSessions check if any sessions are alive. Abort migration if any.
	CheckSessions() error
	// RegisterSession register session to avoid any other migration is also running, registered session will be deleted
	// as soon as possible after migration is done.
	RegisterSession() error
	// Backup source meta information.
	Backup() error
	// Migrate to target backend.
	Migrate() error
	// Rollback migration.
	Rollback() error
	// Stop complete the migration overflow.
	Stop()
}

type Migrator

type Migrator interface {
	Migrate(metas *meta.Meta) (*meta.Meta, error)
}

func NewMigrator

func NewMigrator(sourceVersion, targetVersion string) (Migrator, error)

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(ctx context.Context, cfg *configs.Config) *Runner

func (*Runner) Backup

func (r *Runner) Backup() error

func (*Runner) CheckCompatible

func (r *Runner) CheckCompatible() bool

func (*Runner) CheckSessions

func (r *Runner) CheckSessions() error

func (*Runner) Migrate

func (r *Runner) Migrate() error

func (*Runner) RegisterSession

func (r *Runner) RegisterSession() error

func (*Runner) Rollback

func (r *Runner) Rollback() error

func (*Runner) Stop

func (r *Runner) Stop()

func (*Runner) Validate

func (r *Runner) Validate() error

func (*Runner) WatchSessions

func (r *Runner) WatchSessions()

Jump to

Keyboard shortcuts

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