migration

package
v0.15.17-hotfix.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateMigrationVersion

func ValidateMigrationVersion(m MigrationVersion) error

ValidateMigrationVersion validates a stored metrics type.

Types

type MigrationVersion

type MigrationVersion uint

MigrationVersion is an enum that corresponds to the major and minor version number to migrate data files to.

const (
	// MigrationVersionNone indicates node should not attempt to perform any migrations.
	MigrationVersionNone MigrationVersion = iota
	// MigrationVersion_1_1 indicates node should attempt to migrate data files up to version 1.1.
	MigrationVersion_1_1
)

func ParseMigrationVersion

func ParseMigrationVersion(str string) (MigrationVersion, error)

ParseMigrationVersion parses a string for a MigrationVersion.

func (*MigrationVersion) String

func (m *MigrationVersion) String() string

func (*MigrationVersion) UnmarshalYAML

func (m *MigrationVersion) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a migrate version.

type NewTaskFn added in v0.15.10

type NewTaskFn func(opts TaskOptions) (Task, error)

NewTaskFn is a function that can create a new migration task.

func MigrationTask added in v0.15.10

func MigrationTask(info fs.ReadInfoFileResult) (NewTaskFn, bool)

MigrationTask returns true or false if a fileset should be migrated. If true, also returns a function that can be used to create a new migration task.

type Options

type Options interface {
	// Validate validates migration options.
	Validate() error

	// SetTargetMigrationVersion sets the target version for a migration
	SetTargetMigrationVersion(value MigrationVersion) Options

	// TargetMigrationVersion is the target version for a migration.
	TargetMigrationVersion() MigrationVersion

	// SetConcurrency sets the number of concurrent workers performing migrations.
	SetConcurrency(value int) Options

	// Concurrency gets the number of concurrent workers performing migrations.
	Concurrency() int
}

Options represents the options for migrations.

func NewOptions

func NewOptions() Options

NewOptions creates new migration options.

type Task added in v0.15.10

type Task interface {
	// Run is the set of steps to successfully complete a migration. Returns the potentially
	// updated ReadInfoFileResult or an error.
	Run() (fs.ReadInfoFileResult, error)
}

Task interface is implemented by tasks that wish to perform a data migration on a fileset. This typically involves updating files in a fileset that were created by a previous version of the database client.

func NewToVersion1_1Task added in v0.15.10

func NewToVersion1_1Task(opts TaskOptions) (Task, error)

NewToVersion1_1Task creates a task for migrating a fileset to version 1.1.

type TaskOptions added in v0.15.10

type TaskOptions interface {
	// Validate validates the options.
	Validate() error

	// SetNewMergerFn sets the function to create a new Merger.
	SetNewMergerFn(value fs.NewMergerFn) TaskOptions

	// NewMergerFn returns the function to create a new Merger.
	NewMergerFn() fs.NewMergerFn

	// SetInfoFileResult sets the info file resulted associated with this task.
	SetInfoFileResult(value fs.ReadInfoFileResult) TaskOptions

	// InfoFileResult gets the info file resulted associated with this task.
	InfoFileResult() fs.ReadInfoFileResult

	// SetShard sets the shard associated with this task.
	SetShard(value uint32) TaskOptions

	// Shard gets the shard associated with this task.
	Shard() uint32

	// SetNamespaceMetadata sets the namespace metadata associated with this task.
	SetNamespaceMetadata(value namespace.Metadata) TaskOptions

	// NamespaceMetadata gets the namespace metadata associated with this task.
	NamespaceMetadata() namespace.Metadata

	// SetPersistManager sets the persist manager used for this task.
	SetPersistManager(value persist.Manager) TaskOptions

	// PersistManager gets the persist manager use for this task.
	PersistManager() persist.Manager

	// SetStorageOptions sets the storage options associated with this task.
	SetStorageOptions(value storage.Options) TaskOptions

	// StorageOptions gets the storage options associated with this task.
	StorageOptions() storage.Options

	// SetFilesystemOptions sets the filesystem options.
	SetFilesystemOptions(value fs.Options) TaskOptions

	// FilesystemOptions returns the filesystem options.
	FilesystemOptions() fs.Options
}

TaskOptions represents options for individual migration tasks.

func NewTaskOptions added in v0.15.10

func NewTaskOptions() TaskOptions

NewTaskOptions creates new taskOptions.

Jump to

Keyboard shortcuts

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