index

package
v0.0.0-...-1d8d417 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressTxsIndexer

type AddressTxsIndexer interface {
	// Accept is called when [txID] is accepted.
	// Persists data about [txID] and what balances it changed.
	// [inputUTXOs] are the UTXOs [txID] consumes.
	// [outputUTXOs] are the UTXOs [txID] creates.
	// If the error is non-nil, do not persist [txID] to disk as accepted in the VM
	Accept(
		txID ids.ID,
		inputUTXOs []*avax.UTXO,
		outputUTXOs []*avax.UTXO,
	) error

	// Read returns the IDs of transactions that changed [address]'s balance of [assetID].
	// The returned transactions are in order of increasing acceptance time.
	// The length of the returned slice <= [pageSize].
	// [cursor] is the offset to start reading from.
	Read(address []byte, assetID ids.ID, cursor, pageSize uint64) ([]ids.ID, error)
}

AddressTxsIndexer maintains information about which transactions changed the balances of which addresses. This includes both transactions that increase and decrease an address's balance. A transaction is said to change an address's balance if either is true: 1) A UTXO that the transaction consumes was at least partially owned by the address. 2) A UTXO that the transaction produces is at least partially owned by the address.

func NewIndexer

func NewIndexer(
	db database.Database,
	log logging.Logger,
	metricsNamespace string,
	metricsRegisterer prometheus.Registerer,
	allowIncompleteIndices bool,
) (AddressTxsIndexer, error)

NewIndexer Returns a new AddressTxsIndexer. The returned indexer ignores UTXOs that are not type secp256k1fx.TransferOutput.

func NewNoIndexer

func NewNoIndexer(db database.Database, allowIncomplete bool) (AddressTxsIndexer, error)

Jump to

Keyboard shortcuts

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