manager

package
v1.5.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplianceConfigure = "ApplianceConfigure"
	ContainerConfigure = "ContainerConfigure"

	ApplianceVersionKey = "guestinfo.vice./init/version/PluginVersion"
	ContainerVersionKey = "guestinfo.vice./version/PluginVersion"
)

Variables

View Source
var (
	Migrator = NewDataMigrator()
)

Functions

This section is empty.

Types

type DataMigration

type DataMigration interface {
	// Register plugin to data migration system
	Register(version int, target string, plugin Plugin) error
	// Migrate data with current version ID, return maximum ID number of executed plugins
	Migrate(ctx context.Context, s *session.Session, target string, currentVersion int, data interface{}) (int, error)
	// LatestVersion return the latest plugin version for specified target
	LatestVersion(target string) int
}

func NewDataMigrator

func NewDataMigrator() DataMigration

type DataMigrator

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

func (*DataMigrator) LatestVersion

func (m *DataMigrator) LatestVersion(target string) int

LatestVersion return the latest plugin version for specified target

func (*DataMigrator) Migrate

func (m *DataMigrator) Migrate(ctx context.Context, s *session.Session, target string, currentVersion int, data interface{}) (int, error)

Migrate data with current version ID, return true if has any plugin executed

func (*DataMigrator) Register

func (m *DataMigrator) Register(ver int, target string, plugin Plugin) error

Register plugin to data migration system

type Plugin

type Plugin interface {
	Migrate(ctx context.Context, s *session.Session, data interface{}) error
}

Jump to

Keyboard shortcuts

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