Documentation ¶
Overview ¶
Package upgrader xxx
Index ¶
- Constants
- func CompareVersion(version1, version2 string) int
- func RegisterUpgrade(version string, handlerFunc func(context.Context, UpgradeHelper) error)
- func RunUpgrade(ctx context.Context, helper *Helper) (currentVersion string, finishedUpgrades []string, err error)
- func ValidateVersionFormat(version string) error
- type Helper
- type HelperOpt
- type Upgrade
- type UpgradeHelper
- type UpgradeResponse
- type Upgrader
- type Version
- type VersionInfo
Constants ¶
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 ¶
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 ¶
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 ¶
NewUpgradeHelper new a Helper instance
func (*Helper) HelperName ¶
HelperName xxx Name is the method of Helper to implement interface UpgradeHelper
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
type Version ¶
Version define a version object
func ParseVersion ¶
ParseVersion parse the string type to Version type