types

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeightPatchesList

func GetHeightPatchesList() map[int64]IHeightPatch

func GetUpgradesList

func GetUpgradesList() map[string]UpgradeInitFn

func MigrateValue

func MigrateValue(store sdk.KVStore, cdc codec.BinaryCodec, prefixBz []byte, migrator ValueMigrator) (err error)

MigrateValue is a helper function that migrates values stored in a KV store for the given key prefix using the given value migrator function.

func ModuleMigrations

func ModuleMigrations(module string, migrator Migrator, fn func(string, uint64, sdkmodule.MigrationHandler))

func ModuleVersion

func ModuleVersion(module string) uint64

func RegisterHeightPatch

func RegisterHeightPatch(height int64, patch IHeightPatch)

func RegisterMigration

func RegisterMigration(module string, version uint64, initFn NewMigrationFn)

func RegisterUpgrade

func RegisterUpgrade(name string, fn UpgradeInitFn)

Types

type IHeightPatch

type IHeightPatch interface {
	Name() string
	Begin(sdk.Context, *apptypes.AppKeepers)
}

IHeightPatch defines an interface for a non-software upgrade proposal Height Patch at a given height to implement. There is one time code that can be added for the start of the Patch, in `Begin`. Any other change in the code should be height-gated, if the goal is to have old and new binaries to be compatible prior to the upgrade height.

type IUpgrade

type IUpgrade interface {
	// StoreLoader add|rename|remove stores (aka modules)
	// function may return nil if there is changes to stores
	StoreLoader() *storetypes.StoreUpgrades
	UpgradeHandler() upgradetypes.UpgradeHandler
}

IUpgrade defines an interface to run a SoftwareUpgradeProposal

type Migration

type Migration interface {
	GetHandler() sdkmodule.MigrationHandler
}

type Migrator

type Migrator interface {
	StoreKey() sdk.StoreKey
	Codec() codec.BinaryCodec
}

type NewMigrationFn

type NewMigrationFn func(Migrator) Migration

type UpgradeInitFn

type UpgradeInitFn func(log.Logger, *apptypes.App) (IUpgrade, error)

type ValueMigrator

type ValueMigrator func(oldValueBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler

ValueMigrator migrates a value to the new protobuf type given its old protobuf serialized bytes.

Jump to

Keyboard shortcuts

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