loader

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	TrieInitializer: FromScratch(),
	ExcludeHeight:   ExcludeNone(),
}

DefaultConfig sets the default configuration for the index loader. It is used when no options are specified.

Functions

This section is empty.

Types

type Checkpoint added in v1.4.0

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

Checkpoint is a loader that loads a trie from a LedgerWAL checkpoint file.

func FromCheckpoint added in v1.4.0

func FromCheckpoint(file io.Reader) *Checkpoint

FromCheckpoint creates a loader which loads the trie from the provided reader, which should represent a LedgerWAL checkpoint file.

func (*Checkpoint) Trie added in v1.4.0

func (c *Checkpoint) Trie() (*trie.MTrie, error)

Trie loads the execution state trie from the LedgerWAL root checkpoint.

type Config added in v1.4.3

type Config struct {
	TrieInitializer mapper.Loader
	ExcludeHeight   func(uint64) bool
}

Config contains the configuration options for the index loader.

type Empty added in v1.4.3

type Empty struct {
}

Empty is a loader that loads as empty execution state trie.

func FromScratch added in v1.4.3

func FromScratch() *Empty

FromScratch creates a new loader which loads an empty execution state trie.

func (*Empty) Trie added in v1.4.3

func (e *Empty) Trie() (*trie.MTrie, error)

Trie returns a freshly initialized empty execution state trie.

type Exclude added in v1.4.3

type Exclude func(uint64) bool

Exclude is a function that returns true when a certain height should be excluded from the index trie restoration.

func ExcludeAtOrBelow added in v1.4.3

func ExcludeAtOrBelow(threshold uint64) Exclude

ExcludeAtOrBelow is an exclude function that ignores heights at or below the given threshold height. It can be used with the root height of a protocol state to avoid processing the root checkpoint registers during restore.

func ExcludeNone added in v1.4.3

func ExcludeNone() Exclude

ExcludeNone is an exclude function that processes all heights for index trie restoration.

type Index added in v1.4.0

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

Index implements an execution state trie loader on top of a DPS index, able to restore an execution state trie from the index database.

func FromIndex added in v1.4.0

func FromIndex(log zerolog.Logger, lib dps.ReadLibrary, db *badger.DB, options ...Option) *Index

FromIndex creates a new index loader, which can restore the execution state from the given index database, using the given library for decoding ledger paths and payloads.

func (*Index) Trie added in v1.4.0

func (i *Index) Trie() (*trie.MTrie, error)

Trie restores the execution state trie from the DPS index database, as it was when indexing was stopped.

type Option added in v1.4.3

type Option func(*Config)

Option is a configuration option for the index loader. It can be passed to the index loader's construction function to set optional parameters.

func WithExclude added in v1.4.3

func WithExclude(exclude Exclude) Option

WithExclude injects a function to ignore ledger register updates in the index database for certain heights when restoring the execution state trie. It can be used to exclude the root height during restoration from the index when the root checkpoint is loaded from disk directly.

func WithInitializer added in v1.4.3

func WithInitializer(load mapper.Loader) Option

WithInitializer injects an initializer for the execution state trie. It will be used to initialize the execution state trie that serves as basis for the restore. It can be used with the root checkpoint loader in order to load the initial root checkpoint from the loader instead of the index.

Jump to

Keyboard shortcuts

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