prefetcher

package
v0.0.0-...-d02ee6a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrefetchAccounts

func PrefetchAccounts(ctx context.Context, l Ledger, rnd basics.Round, txnGroups [][]transactions.SignedTxnWithAD, feeSinkAddr basics.Address, consensusParams config.ConsensusParams) <-chan LoadedTransactionGroup

PrefetchAccounts loads the account data for the provided transaction group list. It also loads the feeSink account and add it to the first returned transaction group. The order of the transaction groups returned by the channel is identical to the one in the input array.

Types

type GroupTaskError

type GroupTaskError struct {
	GroupIdx       int64
	Address        *basics.Address
	CreatableIndex basics.CreatableIndex
	CreatableType  basics.CreatableType
	// contains filtered or unexported fields
}

GroupTaskError indicates the group index of the unfulfilled resource

func (*GroupTaskError) Error

func (err *GroupTaskError) Error() string

Error satisfies builtin interface `error`

func (*GroupTaskError) Unwrap

func (err *GroupTaskError) Unwrap() error

Unwrap provides access to the underlying error

type Ledger

Ledger is a ledger interfaces for prefetcher.

type LoadedAccountDataEntry

type LoadedAccountDataEntry struct {
	Address *basics.Address
	Data    *ledgercore.AccountData
}

LoadedAccountDataEntry describes a loaded account.

type LoadedResourcesEntry

type LoadedResourcesEntry struct {
	// Resource is the loaded Resource entry. unless address is nil, Resource would always contain a valid ledgercore.AccountResource pointer.
	Resource *ledgercore.AccountResource
	// Address might be empty if the resource does not exist. In that case creatableIndex and creatableType would still be valid while resource would be nil.
	Address        *basics.Address
	CreatableIndex basics.CreatableIndex
	CreatableType  basics.CreatableType
}

LoadedResourcesEntry describes a loaded resource.

type LoadedTransactionGroup

type LoadedTransactionGroup struct {
	// the transaction group
	TxnGroup []transactions.SignedTxnWithAD

	// Accounts is a list of all the Accounts balance records that the transaction group refer to and are needed.
	Accounts []LoadedAccountDataEntry

	// the following four are the Resources used by the account
	Resources []LoadedResourcesEntry

	// Err indicates whether any of the balances in this structure have failed to load. In case of an error, at least
	// one of the entries in the balances would be uninitialized.
	Err *GroupTaskError
}

LoadedTransactionGroup is a helper struct to allow asynchronous loading of the account data needed by the transaction groups

Jump to

Keyboard shortcuts

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