migration

package
v1.8.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchemaVersion identifies the schema version of RDB
	SchemaVersion = "1.8.1"
)

Variables

This section is empty.

Functions

func VersionKey

func VersionKey(ns string) string

VersionKey returns the key of redis schema

Types

type BasicManager

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

BasicManager is the default implementation of manager interface

func (*BasicManager) Migrate

func (bm *BasicManager) Migrate() error

Migrate data

func (*BasicManager) Register

func (bm *BasicManager) Register(migratorFactory MigratorFactory)

Register the migrator to the chain

type Manager

type Manager interface {
	// Register the specified migrator to the execution chain
	Register(migratorFactory MigratorFactory)

	// Migrate data
	Migrate() error
}

Manager for managing the related migrators

func New

func New(pool *redis.Pool, ns string) Manager

New a basic manager

type MigratorChainNode

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

MigratorChainNode is a wrapper to append the migrator to the chain with a next reference

type MigratorFactory

type MigratorFactory func(pool *redis.Pool, namespace string) (RDBMigrator, error)

MigratorFactory is factory function to create RDBMigrator interface

type MigratorMeta

type MigratorMeta struct {
	FromVersion string
	ToVersion   string
	ObjectRef   string
}

MigratorMeta keeps the base info of the migrator

type PolicyMigrator

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

PolicyMigrator migrate the cron job policy to new schema

func (*PolicyMigrator) Metadata

func (pm *PolicyMigrator) Metadata() *MigratorMeta

Metadata returns the base information of this migrator

func (*PolicyMigrator) Migrate

func (pm *PolicyMigrator) Migrate() error

Migrate data

type RDBMigrator

type RDBMigrator interface {
	// Metadata info of the migrator
	Metadata() *MigratorMeta

	// Migrate executes the real migration work
	Migrate() error
}

RDBMigrator defines the action to migrate redis data

func PolicyMigratorFactory

func PolicyMigratorFactory(pool *redis.Pool, namespace string) (RDBMigrator, error)

PolicyMigratorFactory is a factory func to create PolicyMigrator

Jump to

Keyboard shortcuts

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