manager

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

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

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