indexer

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrefixAddressOutputMappingStorage defines the storage prefix for the AddressOutputMapping object storage.
	PrefixAddressOutputMappingStorage byte = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressOutputMapping

type AddressOutputMapping struct {
	model.StorableReference[AddressOutputMapping, *AddressOutputMapping, devnetvm.Address, utxo.OutputID] `serix:"0"`
}

AddressOutputMapping is a mapping from an Address to an OutputID than enables lookups of stored Outputs.

func NewAddressOutputMapping

func NewAddressOutputMapping(address devnetvm.Address, outputID utxo.OutputID) *AddressOutputMapping

NewAddressOutputMapping creates a new AddressOutputMapping.

func (*AddressOutputMapping) Address

func (a *AddressOutputMapping) Address() devnetvm.Address

Address returns the Address of the AddressOutputMapping.

func (*AddressOutputMapping) OutputID

func (a *AddressOutputMapping) OutputID() utxo.OutputID

OutputID returns the OutputID of the AddressOutputMapping.

type Indexer

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

Indexer is a component that indexes the Outputs of a ledger for easier lookups.

func New

func New(ledger *ledger.Ledger, options ...Option) (new *Indexer)

New returns a new Indexer instance with the given options.

func (*Indexer) CachedAddressOutputMappings

func (i *Indexer) CachedAddressOutputMappings(address devnetvm.Address) (cachedAddressOutputMappings objectstorage.CachedObjects[*AddressOutputMapping])

CachedAddressOutputMappings retrieves all AddressOutputMappings for a particular address

func (*Indexer) IndexOutput

func (i *Indexer) IndexOutput(output devnetvm.Output)

IndexOutput stores the AddressOutputMapping dependent on which type of output it is.

func (*Indexer) Prune

func (i *Indexer) Prune() (err error)

Prune resets the database and deletes all entities.

func (*Indexer) RemoveAddressOutputMapping

func (i *Indexer) RemoveAddressOutputMapping(address devnetvm.Address, outputID utxo.OutputID)

RemoveAddressOutputMapping removes the address-output mapping.

func (*Indexer) Shutdown

func (i *Indexer) Shutdown()

Shutdown shuts down the KVStore used to persist data.

func (*Indexer) StoreAddressOutputMapping

func (i *Indexer) StoreAddressOutputMapping(address devnetvm.Address, outputID utxo.OutputID)

StoreAddressOutputMapping stores the address-output mapping.

type Option

type Option func(*options)

Option represents the return type of optional parameters that can be handed into the constructor of the Ledger to configure its behavior.

func WithAddressOutputMappingCacheTime

func WithAddressOutputMappingCacheTime(addressOutputMappingCacheTime time.Duration) (option Option)

WithAddressOutputMappingCacheTime is an Option for the Ledger that allows to configure how long AddressOutputMapping objects stay cached after they have been released.

func WithCacheTimeProvider

func WithCacheTimeProvider(cacheTimeProvider *database.CacheTimeProvider) (option Option)

WithCacheTimeProvider is an Option for the Ledger that allows to configure which CacheTimeProvider is supposed to be used.

func WithStore

func WithStore(store kvstore.KVStore) (option Option)

WithStore is an Option for the Ledger that allows to configure which KVStore is supposed to be used to persist data (the default option is to use a MapDB).

Jump to

Keyboard shortcuts

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