Documentation ¶
Index ¶
- Variables
- func WithConcurrentTransactions(concurrent uint) func(*Config)
- func WithFlushInterval(interval time.Duration) func(*Config)
- type Config
- type MetricsWriter
- func (w *MetricsWriter) Collections(height uint64, collections []*flow.LightCollection) error
- func (w *MetricsWriter) Commit(height uint64, commit flow.StateCommitment) error
- func (w *MetricsWriter) Events(height uint64, events []flow.Event) error
- func (w *MetricsWriter) First(height uint64) error
- func (w *MetricsWriter) Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error
- func (w *MetricsWriter) Header(height uint64, header *flow.Header) error
- func (w *MetricsWriter) Height(blockID flow.Identifier, height uint64) error
- func (w *MetricsWriter) Last(height uint64) error
- func (w *MetricsWriter) Payloads(height uint64, paths []ledger.Path, payloads []*ledger.Payload) error
- func (w *MetricsWriter) Results(results []*flow.TransactionResult) error
- func (w *MetricsWriter) Seals(height uint64, seals []*flow.Seal) error
- func (w *MetricsWriter) Transactions(height uint64, transactions []*flow.TransactionBody) error
- type Reader
- func (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)
- func (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Commit(height uint64) (flow.StateCommitment, error)
- func (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)
- func (r *Reader) First() (uint64, error)
- func (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)
- func (r *Reader) Header(height uint64) (*flow.Header, error)
- func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
- func (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)
- func (r *Reader) Last() (uint64, error)
- func (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)
- func (r *Reader) Seal(sealID flow.Identifier) (*flow.Seal, error)
- func (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
- func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Values(height uint64, paths []ledger.Path) ([]ledger.Value, error)
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
- func (w *Writer) Commit(height uint64, commit flow.StateCommitment) error
- func (w *Writer) Events(height uint64, events []flow.Event) error
- func (w *Writer) First(height uint64) error
- func (w *Writer) Guarantees(_ uint64, guarantees []*flow.CollectionGuarantee) error
- func (w *Writer) Header(height uint64, header *flow.Header) error
- func (w *Writer) Height(blockID flow.Identifier, height uint64) error
- func (w *Writer) Last(height uint64) error
- func (w *Writer) Payloads(height uint64, paths []ledger.Path, payloads []*ledger.Payload) error
- func (w *Writer) Results(results []*flow.TransactionResult) error
- func (w *Writer) Seals(height uint64, seals []*flow.Seal) error
- func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ ConcurrentTransactions: 16, FlushInterval: time.Second, }
DefaultConfig is the default configuration for the DPS index.
Functions ¶
func WithConcurrentTransactions ¶
WithConcurrentTransactions specifies the maximum concurrent transactions that a DPS index should have.
func WithFlushInterval ¶ added in v1.4.0
WithFlushInterval 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.
Types ¶
type MetricsWriter ¶ added in v1.4.4
type MetricsWriter struct {
// contains filtered or unexported fields
}
MetricsWriter wraps the writer and records metrics for the data it writes.
func NewMetricsWriter ¶ added in v1.4.4
func NewMetricsWriter(write *Writer) *MetricsWriter
NewMetricsWriter creates a counter that counts indexed elements and exposes this information as prometheus counters.
func (*MetricsWriter) Collections ¶ added in v1.4.4
func (w *MetricsWriter) Collections(height uint64, collections []*flow.LightCollection) error
func (*MetricsWriter) Commit ¶ added in v1.4.4
func (w *MetricsWriter) Commit(height uint64, commit flow.StateCommitment) error
func (*MetricsWriter) Events ¶ added in v1.4.4
func (w *MetricsWriter) Events(height uint64, events []flow.Event) error
func (*MetricsWriter) First ¶ added in v1.4.4
func (w *MetricsWriter) First(height uint64) error
func (*MetricsWriter) Guarantees ¶ added in v1.4.4
func (w *MetricsWriter) Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error
func (*MetricsWriter) Header ¶ added in v1.4.4
func (w *MetricsWriter) Header(height uint64, header *flow.Header) error
func (*MetricsWriter) Height ¶ added in v1.4.4
func (w *MetricsWriter) Height(blockID flow.Identifier, height uint64) error
func (*MetricsWriter) Last ¶ added in v1.4.4
func (w *MetricsWriter) Last(height uint64) error
func (*MetricsWriter) Results ¶ added in v1.4.4
func (w *MetricsWriter) Results(results []*flow.TransactionResult) error
func (*MetricsWriter) Seals ¶ added in v1.4.4
func (w *MetricsWriter) Seals(height uint64, seals []*flow.Seal) error
func (*MetricsWriter) Transactions ¶ added in v1.4.4
func (w *MetricsWriter) Transactions(height uint64, transactions []*flow.TransactionBody) error
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements the `index.Reader` interface on top of the DPS server's Badger database index.
func NewReader ¶
func NewReader(db *badger.DB, lib dps.ReadLibrary) *Reader
NewReader creates a new index reader, using the given database as the underlying state repository. It is recommended to provide a read-only Badger database.
func (*Reader) Collection ¶ added in v1.1.0
func (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)
Collection returns the collection with the given ID.
func (*Reader) CollectionsByHeight ¶ added in v1.1.0
func (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)
CollectionsByHeight returns the collection IDs at the given height.
func (*Reader) Commit ¶
func (r *Reader) Commit(height uint64) (flow.StateCommitment, error)
Commit returns the commitment of the execution state as it was after the execution of the finalized block at the given height.
func (*Reader) Events ¶
Events 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.
func (*Reader) Guarantee ¶ added in v1.1.0
func (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)
Guarantee returns the guarantee with the given collection ID.
func (*Reader) HeightForBlock ¶
func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
HeightForBlock returns the height for the given block identifier.
func (*Reader) HeightForTransaction ¶ added in v1.1.0
func (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)
HeightForTransaction returns the height of the block within which the given transaction identifier is.
func (*Reader) Result ¶ added in v1.1.0
func (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)
Result returns the transaction result for the given transaction ID.
func (*Reader) SealsByHeight ¶ added in v1.1.0
func (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)
SealsByHeight returns all of the seals that were part of the finalized block at the given height.
func (*Reader) Transaction ¶
func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
Transaction returns the transaction with the given ID.
func (*Reader) TransactionsByHeight ¶
func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
TransactionsByHeight returns the transaction IDs within the block with the given ID.
func (*Reader) Values ¶
Values 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.
type Writer ¶
Writer implements the `index.Writer` interface to write indexing data to an underlying Badger database.
func NewWriter ¶
func NewWriter(db *badger.DB, lib dps.WriteLibrary, options ...func(*Config)) *Writer
NewWriter creates a new index writer that writes new indexing data to the given Badger database.
func (*Writer) Close ¶
Close closes the writer and commits the pending transaction, if there is one.
func (*Writer) Collections ¶
func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
Collections indexes the collections at the given height.
func (*Writer) Commit ¶
func (w *Writer) Commit(height uint64, commit flow.StateCommitment) error
Commit indexes the given commitment of the execution state as it was after the execution of the finalized block at the given height.
func (*Writer) Events ¶
Events indexes the events, which should represent all events of the finalized block at the given height.
func (*Writer) Guarantees ¶ added in v1.1.0
func (w *Writer) Guarantees(_ uint64, guarantees []*flow.CollectionGuarantee) error
Guarantees indexes the guarantees at the given height.
func (*Writer) Height ¶
func (w *Writer) Height(blockID flow.Identifier, height uint64) error
Height indexes the height for the given block ID.
func (*Writer) Payloads ¶
Payloads indexes the given payloads, which should represent a trie update of the execution state contained within the finalized block at the given height.
func (*Writer) Results ¶ added in v1.1.0
func (w *Writer) Results(results []*flow.TransactionResult) error
Results indexes the transaction results at the given height.
func (*Writer) Seals ¶ added in v1.1.0
Seals indexes the seals, which should represent all seals in the finalized block at the given height.
func (*Writer) Transactions ¶
func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Transactions indexes the transactions at the given height.