migrations

package
v0.29.7-access-client-... Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: AGPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyToRegisterID added in v0.23.2

func KeyToRegisterID(key ledger.Key) (flow.RegisterID, error)

func MigrateAccountUsage added in v0.29.0

func MigrateAccountUsage(payloads []ledger.Payload, nWorker int) ([]ledger.Payload, error)

func MigrateByAccount added in v0.29.0

func MigrateByAccount(migrator AccountMigrator, allPayloads []ledger.Payload, nWorker int) (
	[]ledger.Payload, error)

MigrateByAccount teaks a migrator function and all the payloads, and return the migrated payloads

func MigrateGroupConcurrently added in v0.29.0

func MigrateGroupConcurrently(
	migrator AccountMigrator,
	payloadsByAccount map[string][]ledger.Payload,
	nWorker int,
) (
	[]ledger.Payload, error)

MigrateGroupConcurrently migrate the payloads in the given payloadsByAccount map which using the migrator It's similar to MigrateGroupSequentially, except it will migrate different groups concurrently

func MigrateGroupSequentially added in v0.29.0

func MigrateGroupSequentially(
	migrator AccountMigrator,
	payloadsByAccount map[string][]ledger.Payload,
) (
	[]ledger.Payload, error)

MigrateGroupSequentially migrate the payloads in the given payloadsByAccount map which using the migrator

func NoOpMigration

func NoOpMigration(p []ledger.Payload) ([]ledger.Payload, error)

func PayloadToAccount added in v0.29.0

func PayloadToAccount(p ledger.Payload) (string, bool, error)

PayloadToAccount takes a payload and return: - (address, true, nil) if the payload is for an account, the account address is returned - ("", false, nil) if the payload is not for an account - ("", false, err) if running into any exception

func PruneMigration added in v0.16.2

func PruneMigration(payload []ledger.Payload) ([]ledger.Payload, error)

PruneMigration removes all the payloads with empty value this prunes the trie for values that has been deleted

func StorageFeesMigration added in v0.13.0

func StorageFeesMigration(payload []ledger.Payload) ([]ledger.Payload, error)

iterates through registers keeping a map of register sizes after it has reached the end it add storage used and storage capacity for each address

Types

type AccountMigrator added in v0.29.0

type AccountMigrator interface {
	MigratePayloads(account string, payloads []ledger.Payload) ([]ledger.Payload, error)
}

AccountMigrator takes all the payloads that belong to the given account and return the migrated payloads

type AccountUsageMigrator added in v0.29.0

type AccountUsageMigrator struct{}

func (AccountUsageMigrator) MigratePayloads added in v0.29.0

func (m AccountUsageMigrator) MigratePayloads(account string, payloads []ledger.Payload) ([]ledger.Payload, error)

AccountUsageMigrator iterate through each payload, and calculate the storage usage and update the accoutns status with the updated storage usage

type AccountsAtreeLedger added in v0.23.2

type AccountsAtreeLedger struct {
	Accounts environment.Accounts
}

func NewAccountsAtreeLedger added in v0.23.2

func NewAccountsAtreeLedger(accounts environment.Accounts) *AccountsAtreeLedger

func (*AccountsAtreeLedger) AllocateStorageIndex added in v0.23.2

func (a *AccountsAtreeLedger) AllocateStorageIndex(owner []byte) (atree.StorageIndex, error)

AllocateStorageIndex allocates new storage index under the owner accounts to store a new register

func (*AccountsAtreeLedger) GetValue added in v0.23.2

func (a *AccountsAtreeLedger) GetValue(owner, key []byte) ([]byte, error)

func (*AccountsAtreeLedger) SetValue added in v0.23.2

func (a *AccountsAtreeLedger) SetValue(owner, key, value []byte) error

func (*AccountsAtreeLedger) ValueExists added in v0.23.2

func (a *AccountsAtreeLedger) ValueExists(owner, key []byte) (exists bool, err error)

type PayloadGroup added in v0.29.0

type PayloadGroup struct {
	NonAccountPayloads []ledger.Payload
	Accounts           map[string][]ledger.Payload
}

PayloadGroup groups payloads by account. For global payloads, it's stored under NonAccountPayloads field

func PayloadGrouping added in v0.29.0

func PayloadGrouping(groups *PayloadGroup, payload ledger.Payload) (*PayloadGroup, error)

PayloadGrouping is a reducer function that adds the given payload to the corresponding group under its account

Jump to

Keyboard shortcuts

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