{"modulePath":"github.com/onflow/flow-archive","version":"v0.31.9-decrease-wait-interval","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package index\n\n## Constants\n\n```go\nconst ConcurrentPathReadLimit int = 1024\n```\nConcurrentPathReadLimit sets the number of concurrent paths in the Values lookup\n\n## Variables\n\n```go\nvar DefaultConfig = Config{\n\tConcurrentTransactions: 16,\n\tFlushInterval:          time.Second,\n}\n```\nDefaultConfig is the default configuration for the DPS index.\n\n## Functions\n\n```go\nfunc WithConcurrentTransactions(concurrent uint) func(*Config)\n```\nWithConcurrentTransactions specifies the maximum concurrent transactions that a DPS index should have.\n\n```go\nfunc WithFlushInterval(interval time.Duration) func(*Config)\n```\nWithFlushInterval sets a custom interval after which we will flush Badger transactions, to avoid long waits for DB updates in cases where there is not enough data to quickly fill them.\n\n## Types\n\n```go\ntype Config struct {\n\tConcurrentTransactions uint\n\tFlushInterval          time.Duration\n}\n```\nConfig is the configuration of a DPS index.\n\n```go\ntype Reader struct {\n\t// contains filtered or unexported fields\n}\n```\nReader implements the \\`index.Reader\\` interface on top of the DPS server's Badger database index.\n\n```go\nfunc NewReader(\n\tlog zerolog.Logger,\n\tdb *badger.DB,\n\tlib archive.ReadLibrary,\n\tlib2 archive.ReadLibrary2,\n) *Reader\n```\nNewReader creates a new index reader, using the given database as the underlying state repository. It is recommended to provide a read-only Badger database.\n\n```go\nfunc (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)\n```\nCollection returns the collection with the given ID.\n\n```go\nfunc (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)\n```\nCollectionsByHeight returns the collection IDs at the given height.\n\n```go\nfunc (r *Reader) Commit(height uint64) (flow.StateCommitment, error)\n```\nCommit returns the commitment of the execution state as it was after the execution of the finalized block at the given height.\n\n```go\nfunc (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)\n```\nEvents returns the events of all transactions that were part of the finalized block at the given height. It can optionally filter them by event type; if no event types are given, all events are returned.\n\n```go\nfunc (r *Reader) First() (uint64, error)\n```\nFirst returns the height of the first finalized block that was indexed.\n\n```go\nfunc (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)\n```\nGuarantee returns the guarantee with the given collection ID.\n\n```go\nfunc (r *Reader) Header(height uint64) (*flow.Header, error)\n```\nHeader returns the header for the finalized block at the given height.\n\n```go\nfunc (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)\n```\nHeightForBlock returns the height for the given block identifier.\n\n```go\nfunc (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)\n```\nHeightForTransaction returns the height of the block within which the given transaction identifier is.\n\n```go\nfunc (r *Reader) Last() (uint64, error)\n```\nLast returns the height of the last finalized block that was indexed.\n\n```go\nfunc (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)\n```\nResult returns the transaction result for the given transaction ID.\n\n```go\nfunc (r *Reader) Seal(sealID flow.Identifier) (*flow.Seal, error)\n```\nSeal returns the seal with the given ID.\n\n```go\nfunc (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)\n```\nSealsByHeight returns all of the seals that were part of the finalized block at the given height.\n\n```go\nfunc (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)\n```\nTransaction returns the transaction with the given ID.\n\n```go\nfunc (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)\n```\nTransactionsByHeight returns the transaction IDs within the block with the given ID.\n\n```go\nfunc (r *Reader) Values(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)\n```\nValues returns the Ledger values of the execution state at the given paths as they were after the execution of the finalized block at the given height. For compatibility with existing Flow execution node code, a path that is not found within the indexed execution state returns a nil value without error.\n\n```go\ntype Writer struct {\n\tsync.RWMutex\n\t// contains filtered or unexported fields\n}\n```\nWriter implements the \\`index.Writer\\` interface to write indexing data to an underlying Badger database.\n\n```go\nfunc NewWriter(\n\tdb *badger.DB,\n\tlib archive.WriteLibrary,\n\tlib2 archive.WriteLibrary2,\n\toptions ...func(*Config),\n) *Writer\n```\nNewWriter creates a new index writer that writes new indexing data to the given Badger database.\n\n```go\nfunc (w *Writer) Close() error\n```\nClose closes the writer and commits the pending transaction, if there is one.\n\n```go\nfunc (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error\n```\nCollections indexes the collections at the given height.\n\n```go\nfunc (w *Writer) Commit(height uint64, commit flow.StateCommitment) error\n```\nCommit indexes the given commitment of the execution state as it was after the execution of the finalized block at the given height.\n\n```go\nfunc (w *Writer) Events(height uint64, events []flow.Event) error\n```\nEvents indexes the events, which should represent all events of the finalized block at the given height.\n\n```go\nfunc (w *Writer) First(height uint64) error\n```\nFirst indexes the height of the first finalized block.\n\n```go\nfunc (w *Writer) Guarantees(_ uint64, guarantees []*flow.CollectionGuarantee) error\n```\nGuarantees indexes the guarantees at the given height.\n\n```go\nfunc (w *Writer) Header(height uint64, header *flow.Header) error\n```\nHeader indexes the given header of a finalized block at the given height.\n\n```go\nfunc (w *Writer) Height(blockID flow.Identifier, height uint64) error\n```\nHeight indexes the height for the given block ID.\n\n```go\nfunc (w *Writer) Last(height uint64) error\n```\nLast indexes the height of the last finalized block.\n\n```go\nfunc (w *Writer) Payloads(height uint64, payloads []*ledger.Payload) error\n```\nPayloads indexes the given payloads, which should represent a trie update of the execution state contained within the finalized block at the given height.\n\n```go\nfunc (w *Writer) Registers(height uint64, registers []*wal.LeafNode) error\n```\nRegisters writes the given registers in a batch to database\n\n```go\nfunc (w *Writer) Results(results []*flow.TransactionResult) error\n```\nResults indexes the transaction results at the given height.\n\n```go\nfunc (w *Writer) Seals(height uint64, seals []*flow.Seal) error\n```\nSeals indexes the seals, which should represent all seals in the finalized block at the given height.\n\n```go\nfunc (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error\n```\nTransactions indexes the transactions at the given height.\n\n","path":"github.com/onflow/flow-archive/service/index","name":"index","synopsis":"","isRedistributable":true}
