registers

package
v0.35.11-crescendo-pre... Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyChanges

func ApplyChanges(
	registers Registers,
	changes map[flow.RegisterID]flow.RegisterValue,
	expectedChangeAddresses map[flow.Address]struct{},
	logger zerolog.Logger,
) error

ApplyChanges applies the given changes to the given registers, and verifies that the changes are only for the expected addresses.

Types

type AccountRegisters

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

AccountRegisters represents the registers of an account

func NewAccountRegisters

func NewAccountRegisters(owner string) *AccountRegisters

func NewAccountRegistersFromPayloads

func NewAccountRegistersFromPayloads(owner string, payloads []*ledger.Payload) (*AccountRegisters, error)

func (*AccountRegisters) Count

func (a *AccountRegisters) Count() int

func (*AccountRegisters) ForEach

func (a *AccountRegisters) ForEach(f ForEachCallback) error

func (*AccountRegisters) ForEachKey

func (a *AccountRegisters) ForEachKey(f func(key string) error) error

func (*AccountRegisters) Get

func (a *AccountRegisters) Get(owner string, key string) ([]byte, error)

func (*AccountRegisters) Merge

func (a *AccountRegisters) Merge(other *AccountRegisters) error

Merge merges the registers from the other AccountRegisters into this AccountRegisters.

func (*AccountRegisters) Owner

func (a *AccountRegisters) Owner() string

func (*AccountRegisters) Payloads

func (a *AccountRegisters) Payloads() []*ledger.Payload

func (*AccountRegisters) Set

func (a *AccountRegisters) Set(owner string, key string, value []byte) error

type ByAccount

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

ByAccount represents the registers of all accounts

func NewByAccount

func NewByAccount() *ByAccount

func NewByAccountFromPayloads

func NewByAccountFromPayloads(payloads []*ledger.Payload) (*ByAccount, error)

func (*ByAccount) AccountCount

func (b *ByAccount) AccountCount() int

func (*ByAccount) AccountRegisters

func (b *ByAccount) AccountRegisters(owner string) *AccountRegisters

func (*ByAccount) Count

func (b *ByAccount) Count() int

func (*ByAccount) DestructIntoPayloads

func (b *ByAccount) DestructIntoPayloads(nWorker int) []*ledger.Payload

func (*ByAccount) ForEach

func (b *ByAccount) ForEach(f ForEachCallback) error

func (*ByAccount) ForEachAccount

func (b *ByAccount) ForEachAccount(f func(accountRegisters *AccountRegisters) error) error

func (*ByAccount) Get

func (b *ByAccount) Get(owner string, key string) ([]byte, error)

func (*ByAccount) HasAccountOwner

func (b *ByAccount) HasAccountOwner(owner string) bool

func (*ByAccount) Set

func (b *ByAccount) Set(owner string, key string, value []byte) error

func (*ByAccount) SetAccountRegisters

func (b *ByAccount) SetAccountRegisters(newAccountRegisters *AccountRegisters) *AccountRegisters

type ForEachCallback

type ForEachCallback func(owner string, key string, value []byte) error

type ReadOnlyLedger

type ReadOnlyLedger struct {
	Registers
}

ReadOnlyLedger adapts Registers to the atree.Ledger interface

func (ReadOnlyLedger) AllocateStorageIndex

func (l ReadOnlyLedger) AllocateStorageIndex(_ []byte) (atree.StorageIndex, error)

func (ReadOnlyLedger) GetValue

func (l ReadOnlyLedger) GetValue(owner, key []byte) (value []byte, err error)

func (ReadOnlyLedger) SetValue

func (l ReadOnlyLedger) SetValue(_, _, _ []byte) error

func (ReadOnlyLedger) ValueExists

func (l ReadOnlyLedger) ValueExists(owner, key []byte) (exists bool, err error)

type Registers

type Registers interface {
	Get(owner string, key string) ([]byte, error)
	Set(owner string, key string, value []byte) error
	ForEach(f ForEachCallback) error
	Count() int
}

type StorageSnapshot

type StorageSnapshot struct {
	Registers
}

StorageSnapshot adapts Registers to the snapshot.StorageSnapshot interface

func (StorageSnapshot) Get

Jump to

Keyboard shortcuts

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