{"modulePath":"github.com/onflow/flow-archive","version":"v0.31.9-decrease-wait-interval","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package loader\n\n## Variables\n\n```go\nvar DefaultConfig = Config{\n\tTrieInitializer: FromScratch(),\n\tExcludeHeight:   ExcludeNone(),\n}\n```\nDefaultConfig sets the default configuration for the index loader. It is used when no options are specified.\n\n## Types\n\n```go\ntype Checkpoint struct {\n\t// contains filtered or unexported fields\n}\n```\nCheckpoint is a loader that loads a trie from a LedgerWAL checkpoint file.\n\n```go\nfunc FromCheckpointFile(filepath string, log *zerolog.Logger) *Checkpoint\n```\nFromCheckpointFile creates a loader which loads the trie from the provided reader, which should represent a LedgerWAL checkpoint file.\n\n```go\nfunc (c *Checkpoint) Trie() (*trie.MTrie, error)\n```\nTrie loads the execution state trie from the LedgerWAL root checkpoint.\n\n```go\ntype Config struct {\n\tTrieInitializer mapper.Loader\n\tExcludeHeight   func(uint64) bool\n}\n```\nConfig contains the configuration options for the index loader.\n\n```go\ntype Empty struct {\n}\n```\nEmpty is a loader that loads as empty execution state trie.\n\n```go\nfunc FromScratch() *Empty\n```\nFromScratch creates a new loader which loads an empty execution state trie.\n\n```go\nfunc (e *Empty) Trie() (*trie.MTrie, error)\n```\nTrie returns a freshly initialized empty execution state trie.\n\n```go\ntype Exclude func(uint64) bool\n```\nExclude is a function that returns true when a certain height should be excluded from the index trie restoration.\n\n```go\nfunc ExcludeAtOrBelow(threshold uint64) Exclude\n```\nExcludeAtOrBelow 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.\n\n```go\nfunc ExcludeNone() Exclude\n```\nExcludeNone is an exclude function that processes all heights for index trie restoration.\n\n```go\ntype Option func(*Config)\n```\nOption is a configuration option for the index loader. It can be passed to the index loader's construction function to set optional parameters.\n\n```go\nfunc WithExclude(exclude Exclude) Option\n```\nWithExclude 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.\n\n```go\nfunc WithInitializer(load mapper.Loader) Option\n```\nWithInitializer 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.\n\n","path":"github.com/onflow/flow-archive/service/loader","name":"loader","synopsis":"","isRedistributable":true}
