upgrader

package
v1.29.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package upgrader xxx

Index

Constants

View Source
const (
	// SystemTypeVersion is a field representing version
	SystemTypeVersion = "version"
	// UpgraderTableName is the db table name for upgrader module
	UpgraderTableName = "bcs_upgrader"
	// VersionPrefix is the prefix for bcs upgrade program
	VersionPrefix = "u"
	// InitialVersion is the initial version for the first time to upgrade
	InitialVersion = "u1.21.199912121010"
)

Variables

This section is empty.

Functions

func CompareVersion

func CompareVersion(version1, version2 string) int

CompareVersion compares two upgrade program versions the compare priority order is Major > Minor > Patch eg:u2.22.202109151940 > u1.22.202109151940 > u1.21.202109151940 > u1.21.202108051940

func RegisterUpgrade

func RegisterUpgrade(version string, handlerFunc func(context.Context, UpgradeHelper) error)

RegisterUpgrade register upgrade programe

func RunUpgrade

func RunUpgrade(ctx context.Context, helper *Helper) (
	currentVersion string, finishedUpgrades []string, err error)

RunUpgrade upgrade the db data to newest version

func ValidateVersionFormat

func ValidateVersionFormat(version string) error

ValidateVersionFormat validate the format of version

Types

type Helper

type Helper struct {
	DB     drivers.DB
	Config options.HttpCliConfig
}

Helper is an implementation for interface UpgradeHelper

func NewUpgradeHelper

func NewUpgradeHelper(opt *HelperOpt) *Helper

NewUpgradeHelper new a Helper instance

func (*Helper) HelperName

func (h *Helper) HelperName() string

HelperName xxx Name is the method of Helper to implement interface UpgradeHelper

type HelperOpt

type HelperOpt struct {
	DB drivers.DB
	// contains filtered or unexported fields
}

HelperOpt is option for Helper

type Upgrade

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

Upgrade define a version upgrade

type UpgradeHelper

type UpgradeHelper interface {
	// HelperName return the name of the helper
	HelperName() string
}

UpgradeHelper is a helper for upgrade

type UpgradeResponse

type UpgradeResponse struct {
	Msg              string   `json:"msg"`
	PreVersion       string   `json:"pre_version"`
	CurrentVersion   string   `json:"current_version"`
	FinishedVersions []string `json:"finished_migrations"`
}

UpgradeResponse is the response of upgrade

type Upgrader

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

Upgrader is a data struct of bcs upgrader server

func NewUpgrader

func NewUpgrader(op *options.UpgraderOptions) (*Upgrader, error)

NewUpgrader create upgrader server object

func (*Upgrader) Start

func (u *Upgrader) Start() error

Start to run upgrader server

func (*Upgrader) Upgrade

func (u *Upgrader) Upgrade(req *restful.Request, resp *restful.Response)

Upgrade is to upgrade version

type Version

type Version struct {
	Major int64
	Minor int64
	Patch string
}

Version define a version object

func ParseVersion

func ParseVersion(version string) (Version, error)

ParseVersion parse the string type to Version type

type VersionInfo

type VersionInfo struct {
	Type           string    `bson:"type"`
	PreVersion     string    `bson:"pre_version"`
	CurrentVersion string    `bson:"current_version"`
	Edition        string    `bson:"edition"`
	LastTime       time.Time `bson:"last_time"`
}

VersionInfo is bcs version info

Jump to

Keyboard shortcuts

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