Documentation ¶
Index ¶
- func KeyToRegisterID(key ledger.Key) (flow.RegisterID, error)
- func MigrateAccountUsage(payloads []ledger.Payload, nWorker int) ([]ledger.Payload, error)
- func MigrateByAccount(migrator AccountMigrator, allPayloads []ledger.Payload, nWorker int) ([]ledger.Payload, error)
- func MigrateGroupConcurrently(migrator AccountMigrator, payloadsByAccount map[string][]ledger.Payload, ...) ([]ledger.Payload, error)
- func MigrateGroupSequentially(migrator AccountMigrator, payloadsByAccount map[string][]ledger.Payload) ([]ledger.Payload, error)
- func NoOpMigration(p []ledger.Payload) ([]ledger.Payload, error)
- func PayloadToAccount(p ledger.Payload) (string, bool, error)
- func PruneMigration(payload []ledger.Payload) ([]ledger.Payload, error)
- func StorageFeesMigration(payload []ledger.Payload) ([]ledger.Payload, error)
- type AccountMigrator
- type AccountUsageMigrator
- type AccountsAtreeLedger
- func (a *AccountsAtreeLedger) AllocateStorageIndex(owner []byte) (atree.StorageIndex, error)
- func (a *AccountsAtreeLedger) GetValue(owner, key []byte) ([]byte, error)
- func (a *AccountsAtreeLedger) SetValue(owner, key, value []byte) error
- func (a *AccountsAtreeLedger) ValueExists(owner, key []byte) (exists bool, err error)
- type PayloadGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyToRegisterID ¶
func KeyToRegisterID(key ledger.Key) (flow.RegisterID, error)
func MigrateAccountUsage ¶
func MigrateByAccount ¶
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 ¶
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 ¶
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 PayloadToAccount ¶
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 ¶
PruneMigration removes all the payloads with empty value this prunes the trie for values that has been deleted
Types ¶
type AccountMigrator ¶
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 ¶
type AccountUsageMigrator struct{}
func (AccountUsageMigrator) MigratePayloads ¶
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 ¶
type AccountsAtreeLedger struct {
Accounts environment.Accounts
}
func NewAccountsAtreeLedger ¶
func NewAccountsAtreeLedger(accounts environment.Accounts) *AccountsAtreeLedger
func (*AccountsAtreeLedger) AllocateStorageIndex ¶
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 ¶
func (a *AccountsAtreeLedger) GetValue(owner, key []byte) ([]byte, error)
func (*AccountsAtreeLedger) SetValue ¶
func (a *AccountsAtreeLedger) SetValue(owner, key, value []byte) error
func (*AccountsAtreeLedger) ValueExists ¶
func (a *AccountsAtreeLedger) ValueExists(owner, key []byte) (exists bool, err error)
type PayloadGroup ¶
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 ¶
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