{"modulePath":"github.com/onflow/flow-archive","version":"v0.31.9-decrease-wait-interval","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package mapper\n\n## Variables\n\n```go\nvar DefaultConfig = Config{\n\tBootstrapState: false,\n\tSkipRegisters:  false,\n\tWaitInterval:   10 * time.Millisecond,\n}\n```\nDefaultConfig is the default configuration for the Mapper.\n\n## Functions\n\n```go\nfunc WithTransition(status Status, transition TransitionFunc) func(*FSM)\n```\nWithTransition specifies which TransitionFunc should be used when the state machine has the given status.\n\n## Types\n\n```go\ntype Config struct {\n\tBootstrapState bool\n\tSkipRegisters  bool\n\tWaitInterval   time.Duration\n}\n```\nConfig contains optional parameters for the Mapper.\n\n```go\ntype FSM struct {\n\t// contains filtered or unexported fields\n}\n```\nFSM is a finite state machine which is used to map block data from multiple sources into the DPS index.\n\n```go\nfunc NewFSM(state *State, options ...func(*FSM)) *FSM\n```\nNewFSM returns a new FSM using the given state and options.\n\n```go\nfunc (f *FSM) Run() error\n```\nRun starts the state machine.\n\n```go\nfunc (f *FSM) Stop() error\n```\nStop gracefully stops the state machine.\n\n```go\ntype Loader interface {\n\tTrie() (*trie.MTrie, error)\n}\n```\nLoader represents something that loads its checkpoint and builds it into a trie.\n\n```go\ntype Option func(*Config)\n```\nOption is an option that can be given to the mapper to configure optional parameters on initialization.\n\n```go\nfunc WithBootstrapState(bootstrap bool) Option\n```\nWithBootstrapState makes the mapper bootstrap the state from a root checkpoint. If not set, it will resume indexing from a previous trie.\n\n```go\nfunc WithSkipRegisters(skip bool) Option\n```\nWithSkipRegisters makes the mapper skip indexing of all ledger registers, which speeds up the run significantly and can be used for debugging purposes.\n\n```go\nfunc WithWaitInterval(interval time.Duration) Option\n```\nWithWaitInterval sets the wait interval that we will wait before retrying to retrieve a trie update when it wasn't available.\n\n```go\ntype State struct {\n\t// contains filtered or unexported fields\n}\n```\nState is the state machine's state for the current block being processed\n\n```go\nfunc EmptyState(checkpointFile string) *State\n```\nEmptyState returns a new empty state\n\n```go\ntype Status uint8\n```\nStatus is a representation of the state machine's status.\n\n```go\nconst (\n\tStatusInitialize Status = iota + 1\n\tStatusBootstrap\n\tStatusResume\n\tStatusIndex\n\tStatusUpdate\n\tStatusCollect\n\tStatusMap\n\tStatusForward\n)\n```\nThe following is an enumeration of all possible statuses the state machine can have.\n\n```go\nfunc (s Status) String() string\n```\nString implements the Stringer interface.\n\n```go\ntype TransitionFunc func(*State) error\n```\nTransitionFunc is a function that is applied onto the state machine's state.\n\n```go\ntype Transitions struct {\n\t// contains filtered or unexported fields\n}\n```\nTransitions is what applies transitions to the state of an FSM.\n\n```go\nfunc NewTransitions(log zerolog.Logger, chain archive.Chain, updates TrieUpdates, read archive.Reader, write archive.Writer, options ...Option) *Transitions\n```\nNewTransitions returns a Transitions component using the given dependencies and using the given options\n\n```go\nfunc (t *Transitions) BootstrapState(s *State) error\n```\nBootstrapState bootstraps the state by loading the checkpoint if there is one and initializing the elements subsequently used by the FSM.\n\n```go\nfunc (t *Transitions) CollectRegisters(s *State) error\n```\nCollectRegisters reads the payloads for the next block to be indexed from the state's forest, unless payload indexing is disabled.\n\n```go\nfunc (t *Transitions) ForwardHeight(s *State) error\n```\nForwardHeight increments the height at which the mapping operates, and updates the last indexed height.\n\n```go\nfunc (t *Transitions) IndexChain(s *State) error\n```\nIndexChain indexes chain data for the current height.\n\n```go\nfunc (t *Transitions) InitializeMapper(s *State) error\n```\nInitializeMapper initializes the mapper by either going into bootstrapping or into resuming, depending on the configuration.\n\n```go\nfunc (t *Transitions) MapRegisters(s *State) error\n```\nMapRegisters maps the collected registers to the current block.\n\n```go\nfunc (t *Transitions) ResumeIndexing(s *State) error\n```\nResumeIndexing resumes indexing the data from a previous run.\n\n```go\nfunc (t *Transitions) UpdateTree(s *State) error\n```\nUpdateTree gets all trie updates and stores it in the state\n\n```go\ntype TrieUpdates interface {\n\tAllUpdates() ([]*ledger.TrieUpdate, error)\n}\n```\nTrieUpdates represents something to get trie updates in block-height order.\n\n","path":"github.com/onflow/flow-archive/service/mapper","name":"mapper","synopsis":"","isRedistributable":true}
