Documentation ¶
Overview ¶
Package migrations implements upgrade migration handlers.
Index ¶
Constants ¶
View Source
const ( // ConsensusMaxAllowances16Handler is the name of the upgrade that sets the // staking max allowances consensus parameter to 16. ConsensusMaxAllowances16Handler = "consensus-max-allowances-16" )
View Source
const ( // ConsensusV62 is the name of the upgrade that enables multiple features added in Oasis Core // version 22.2.x, specifically PCS support for Intel SGX, remote attestation binding to node // identities and client freshness proofs. ConsensusV62 = "consensus-v62" )
View Source
const (
// DummyUpgradeHandler is the name of the dummy upgrade, for use in the upgrade descriptor.
DummyUpgradeHandler = "__e2e-test-valid"
)
View Source
const ( // EmptyHandler is the name of the upgrade handler that doesn't perform any updates. This is // useful for upgrades that bump protocol versions but don't need any state migrations. EmptyHandler = "empty" )
View Source
const (
// ModuleName is the migration module name.
ModuleName = "upgrade-migrations"
)
Variables ¶
View Source
var ( // ErrMissingMigrationHandler is error returned when a migration handler is not registered. ErrMissingMigrationHandler = fmt.Errorf("missing migration handler") )
View Source
var (
TestEntity entity.Entity
)
Functions ¶
func Register ¶
func Register(name upgradeApi.HandlerName, handler Handler)
Register registers a new migration handler, by upgrade name.
Types ¶
type Context ¶
type Context struct { // Upgrade is the currently pending upgrade structure. Upgrade *upgradeApi.PendingUpgrade // DataDir is the node's data directory. DataDir string Logger *logging.Logger }
Context defines the common context used by migration handlers.
func NewContext ¶
func NewContext(upgrade *upgradeApi.PendingUpgrade, dataDir string) *Context
NewContext returns a new upgrade migration context.
type Handler ¶
type Handler interface { // StartupUpgrade is called by the upgrade manager to perform // the node startup portion of the upgrade. StartupUpgrade() error // ConsensusUpgrade is called by the upgrade manager to perform // the consensus portion of the upgrade. The interface argument is // a private structure passed to Backend.ConsensusUpgrade by the // consensus backend. // // This method will be called twice, once in BeginBlock and once in // EndBlock. ConsensusUpgrade(interface{}) error }
Handler is the interface used by migration handlers.
func GetHandler ¶
func GetHandler(name upgradeApi.HandlerName) (Handler, error)
GetHandler returns the handler associated with the upgrade described in the context.
Click to show internal directories.
Click to hide internal directories.