migrations

package
v1.0.0-M10 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStorage

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

func NewAccountStorage

func NewAccountStorage(storage *runtime.Storage, address common.Address) AccountStorage

NewAccountStorage constructs an `AccountStorage` for a given account.

func (*AccountStorage) MigrateStorageMap

func (i *AccountStorage) MigrateStorageMap(
	inter *interpreter.Interpreter,
	domain string,
	migrate StorageMapKeyMigrator,
	atreeKeyToStorageMapKey func(atree.Value) interpreter.StorageMapKey,
)

func (*AccountStorage) MigrateStringKeys

func (i *AccountStorage) MigrateStringKeys(
	inter *interpreter.Interpreter,
	key string,
	migrate StorageMapKeyMigrator,
)

func (*AccountStorage) MigrateUint64Keys

func (i *AccountStorage) MigrateUint64Keys(
	inter *interpreter.Interpreter,
	key string,
	migrate StorageMapKeyMigrator,
)

type AddressIterator

type AddressIterator interface {
	NextAddress() common.Address
	Reset()
}

type AddressSliceIterator

type AddressSliceIterator struct {
	Addresses []common.Address
	// contains filtered or unexported fields
}

func (*AddressSliceIterator) NextAddress

func (a *AddressSliceIterator) NextAddress() common.Address

func (*AddressSliceIterator) Reset

func (a *AddressSliceIterator) Reset()

type DomainMigration

type DomainMigration interface {
	Name() string
	Migrate(
		addressPath interpreter.AddressPath,
	)
}

type LegacyCharacterValue

type LegacyCharacterValue struct {
	interpreter.CharacterValue
}

LegacyCharacterValue simulates the old character-value which uses the un-normalized string for hashing.

func (*LegacyCharacterValue) HashInput

func (*LegacyCharacterValue) StoredValue

func (v *LegacyCharacterValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (*LegacyCharacterValue) Transfer

func (v *LegacyCharacterValue) Transfer(
	interpreter *interpreter.Interpreter,
	_ interpreter.LocationRange,
	_ atree.Address,
	remove bool,
	storable atree.Storable,
	_ map[atree.StorageID]struct{},
) interpreter.Value

type LegacyIntersectionType

type LegacyIntersectionType struct {
	*interpreter.IntersectionStaticType
}

LegacyIntersectionType simulates the old, incorrect restricted-type type-ID generation, which did not sort the type IDs of the interface types.

func (*LegacyIntersectionType) ID

type LegacyPrimitiveStaticType

type LegacyPrimitiveStaticType struct {
	interpreter.PrimitiveStaticType
}

LegacyPrimitiveStaticType simulates the old primitive-static-type which uses the old type-ids for hashing.

func (LegacyPrimitiveStaticType) ID

type LegacyReferenceType

type LegacyReferenceType struct {
	*interpreter.ReferenceStaticType
}

LegacyReferenceType simulates the old reference type with the old typeID generation.

func (*LegacyReferenceType) Encode

func (t *LegacyReferenceType) Encode(e *cbor.StreamEncoder) error

func (*LegacyReferenceType) ID

type LegacyStringValue

type LegacyStringValue struct {
	*interpreter.StringValue
}

LegacyStringValue simulates the old string-value which uses the un-normalized string for hashing.

func (*LegacyStringValue) HashInput

func (v *LegacyStringValue) HashInput(_ *interpreter.Interpreter, _ interpreter.LocationRange, scratch []byte) []byte

func (*LegacyStringValue) StoredValue

func (v *LegacyStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (*LegacyStringValue) Transfer

func (v *LegacyStringValue) Transfer(
	interpreter *interpreter.Interpreter,
	_ interpreter.LocationRange,
	_ atree.Address,
	remove bool,
	storable atree.Storable,
	_ map[atree.StorageID]struct{},
) interpreter.Value

type Reporter

type Reporter interface {
	Migrated(
		storageKey interpreter.StorageKey,
		storageMapKey interpreter.StorageMapKey,
		migration string,
	)
	Error(err error)
}

type StorageMapKeyMigrator

type StorageMapKeyMigrator func(
	inter *interpreter.Interpreter,
	storageKey interpreter.StorageKey,
	storageMap *interpreter.StorageMap,
	storageMapKey interpreter.StorageMapKey,
)

func NewValueConverterPathMigrator

func NewValueConverterPathMigrator(convertValue ValueConverter) StorageMapKeyMigrator

type StorageMigration

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

func NewStorageMigration

func NewStorageMigration(
	interpreter *interpreter.Interpreter,
	storage *runtime.Storage,
) *StorageMigration

func (*StorageMigration) Commit

func (m *StorageMigration) Commit() error

func (*StorageMigration) Migrate

func (m *StorageMigration) Migrate(
	addressIterator AddressIterator,
	migrate StorageMapKeyMigrator,
)

func (*StorageMigration) MigrateAccount

func (m *StorageMigration) MigrateAccount(
	address common.Address,
	migrate StorageMapKeyMigrator,
)

func (*StorageMigration) MigrateNestedValue

func (m *StorageMigration) MigrateNestedValue(
	storageKey interpreter.StorageKey,
	storageMapKey interpreter.StorageMapKey,
	value interpreter.Value,
	valueMigrations []ValueMigration,
	reporter Reporter,
) (migratedValue interpreter.Value)

func (*StorageMigration) NewValueMigrationsPathMigrator

func (m *StorageMigration) NewValueMigrationsPathMigrator(
	reporter Reporter,
	valueMigrations ...ValueMigration,
) StorageMapKeyMigrator

type StorageMigrationError

type StorageMigrationError struct {
	StorageKey    interpreter.StorageKey
	StorageMapKey interpreter.StorageMapKey
	Migration     string
	Err           error
	Stack         []byte
}

func (StorageMigrationError) Error

func (e StorageMigrationError) Error() string

type ValueConverter

type ValueConverter func(
	storageKey interpreter.StorageKey,
	storageMapKey interpreter.StorageMapKey,
	value interpreter.Value,
) interpreter.Value

type ValueMigration

type ValueMigration interface {
	Name() string
	Migrate(
		storageKey interpreter.StorageKey,
		storageMapKey interpreter.StorageMapKey,
		value interpreter.Value,
		interpreter *interpreter.Interpreter,
	) (newValue interpreter.Value, err error)
	CanSkip(valueType interpreter.StaticType) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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