state

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountNotFound          = errors.New("account not found")
	ErrAccountPublicKeyNotFound = errors.New("account public key not found")
)

Functions

func RegisterID

func RegisterID(owner, controller, key string) flow.RegisterID

Types

type Accounts

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

func NewAccounts

func NewAccounts(ledger Ledger, chain flow.Chain) *Accounts

func (*Accounts) AppendPublicKey

func (a *Accounts) AppendPublicKey(address flow.Address, publicKey flow.AccountPublicKey) error

func (*Accounts) Create

func (a *Accounts) Create(publicKeys []flow.AccountPublicKey) (flow.Address, error)

func (*Accounts) Exists

func (a *Accounts) Exists(address flow.Address) (bool, error)

func (*Accounts) Get

func (a *Accounts) Get(address flow.Address) (*flow.Account, error)

func (Accounts) GetAddressGeneratorState

func (a Accounts) GetAddressGeneratorState() (flow.AddressGenerator, error)

func (*Accounts) GetCode

func (a *Accounts) GetCode(address flow.Address) ([]byte, error)

func (*Accounts) GetPublicKey

func (a *Accounts) GetPublicKey(address flow.Address, keyIndex uint64) (flow.AccountPublicKey, error)

func (*Accounts) GetPublicKeyCount

func (a *Accounts) GetPublicKeyCount(address flow.Address) (uint64, error)

func (*Accounts) GetPublicKeys

func (a *Accounts) GetPublicKeys(address flow.Address) (publicKeys []flow.AccountPublicKey, err error)

func (Accounts) InitAddressGeneratorState

func (a Accounts) InitAddressGeneratorState()

func (Accounts) SetAddressGeneratorState

func (a Accounts) SetAddressGeneratorState(state flow.AddressGenerator)

func (*Accounts) SetAllPublicKeys

func (a *Accounts) SetAllPublicKeys(address flow.Address, publicKeys []flow.AccountPublicKey) error

func (*Accounts) SetCode

func (a *Accounts) SetCode(address flow.Address, code []byte) error

func (*Accounts) SetPublicKey

func (a *Accounts) SetPublicKey(
	address flow.Address,
	keyIndex uint64,
	publicKey flow.AccountPublicKey,
) (encodedPublicKey []byte, err error)

func (*Accounts) SetPublicKeyCount

func (a *Accounts) SetPublicKeyCount(address flow.Address, count uint64)

func (*Accounts) TouchCode

func (a *Accounts) TouchCode(address flow.Address)

type Ledger

type Ledger interface {
	Set(owner, controller, key string, value flow.RegisterValue)
	Get(owner, controller, key string) (flow.RegisterValue, error)
	Touch(owner, controller, key string)
	Delete(owner, controller, key string)
}

A Ledger is the storage interface used by the virtual machine to read and write register values.

type MapLedger

type MapLedger struct {
	Registers       map[string]flow.RegisterValue
	RegisterTouches map[string]bool
}

A MapLedger is a naive ledger storage implementation backed by a simple map.

This implementation is designed for testing purposes.

func NewMapLedger

func NewMapLedger() *MapLedger

func (MapLedger) Delete

func (m MapLedger) Delete(owner, controller, key string)

func (MapLedger) Get

func (m MapLedger) Get(owner, controller, key string) (flow.RegisterValue, error)

func (MapLedger) Set

func (m MapLedger) Set(owner, controller, key string, value flow.RegisterValue)

func (MapLedger) Touch

func (m MapLedger) Touch(owner, controller, key string)

type UUIDs

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

func NewUUIDs

func NewUUIDs(ledger Ledger) *UUIDs

func (*UUIDs) GetUUID

func (u *UUIDs) GetUUID() (uint64, error)

func (*UUIDs) SetUUID

func (u *UUIDs) SetUUID(uuid uint64)

Jump to

Keyboard shortcuts

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