index

package
v1.3.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	ConcurrentTransactions: 16,
}

Functions

func WithConcurrentTransactions

func WithConcurrentTransactions(concurrent uint) func(*Config)

Types

type Config

type Config struct {
	ConcurrentTransactions uint
}

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

func (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)

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) First

func (r *Reader) First() (uint64, error)

First returns the height of the first finalized block that was indexed.

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) Header

func (r *Reader) Header(height uint64) (*flow.Header, error)

Header returns the header for the finalized block at the given height.

func (*Reader) HeightForBlock

func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)

func (*Reader) HeightForTransaction added in v1.1.0

func (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)

func (*Reader) Last

func (r *Reader) Last() (uint64, error)

Last returns the height of the last finalized block that was indexed.

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) Seal added in v1.1.0

func (r *Reader) Seal(sealID flow.Identifier) (*flow.Seal, error)

Seal returns the seal with the given 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

func (r *Reader) Values(height uint64, paths []ledger.Path) ([]ledger.Value, error)

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

type Writer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

func (w *Writer) Close() error

func (*Writer) Collections

func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error

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

func (w *Writer) Events(height uint64, events []flow.Event) error

Events indexes the events, which should represent all events of the finalized block at the given height.

func (*Writer) First

func (w *Writer) First(height uint64) error

First indexes the height of the first finalized block.

func (*Writer) Guarantees added in v1.1.0

func (w *Writer) Guarantees(_ uint64, guarantees []*flow.CollectionGuarantee) error

func (*Writer) Header

func (w *Writer) Header(height uint64, header *flow.Header) error

Header indexes the given header of a finalized block 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) Last

func (w *Writer) Last(height uint64) error

Last indexes the height of the last finalized block.

func (*Writer) Payloads

func (w *Writer) Payloads(height uint64, paths []ledger.Path, payloads []*ledger.Payload) error

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

func (*Writer) Seals added in v1.1.0

func (w *Writer) Seals(height uint64, seals []*flow.Seal) error

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

Jump to

Keyboard shortcuts

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