index

package
v0.38.0-preview.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventsIndex

type EventsIndex struct {
	*Reporter
	// contains filtered or unexported fields
}

EventsIndex implements a wrapper around `storage.Events` ensuring that needed data has been synced and is available to the client. Note: read detail how `Reporter` is working

func NewEventsIndex

func NewEventsIndex(reporter *Reporter, events storage.Events) *EventsIndex

func (*EventsIndex) ByBlockID

func (e *EventsIndex) ByBlockID(blockID flow.Identifier, height uint64) ([]flow.Event, error)

ByBlockID checks data availability and returns events for a block Expected errors:

  • indexer.ErrIndexNotInitialized if the `EventsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound if result cannot be provided by storage due to the absence of data.

func (*EventsIndex) ByBlockIDTransactionID

func (e *EventsIndex) ByBlockIDTransactionID(blockID flow.Identifier, height uint64, transactionID flow.Identifier) ([]flow.Event, error)

ByBlockIDTransactionID checks data availability and return events for the given block ID and transaction ID Expected errors:

  • indexer.ErrIndexNotInitialized if the `EventsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound if result cannot be provided by storage due to the absence of data.

func (*EventsIndex) ByBlockIDTransactionIndex

func (e *EventsIndex) ByBlockIDTransactionIndex(blockID flow.Identifier, height uint64, txIndex uint32) ([]flow.Event, error)

ByBlockIDTransactionIndex checks data availability and return events for the transaction at given index in a given block Expected errors:

  • indexer.ErrIndexNotInitialized if the `EventsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound if result cannot be provided by storage due to the absence of data.

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter implements a wrapper around `IndexReporter` ensuring that needed data has been synced and is available to the client. Note: `Reporter` is created with empty reporter due to the next reasoning: When the index is initially bootstrapped, the indexer needs to load an execution state checkpoint from disk and index all the data. This process can take more than 1 hour on some systems. Consequently, the Initialize pattern is implemented to enable the Access API to start up and serve queries before the index is fully ready. During the initialization phase, all calls to retrieve data from this struct should return indexer.ErrIndexNotInitialized. The caller is responsible for handling this error appropriately for the method.

func NewReporter

func NewReporter() *Reporter

func (*Reporter) HighestIndexedHeight

func (s *Reporter) HighestIndexedHeight() (uint64, error)

HighestIndexedHeight returns the highest height indexed by the execution state indexer. Expected errors: - indexer.ErrIndexNotInitialized if the IndexReporter has not been initialized

func (*Reporter) Initialize

func (s *Reporter) Initialize(indexReporter state_synchronization.IndexReporter) error

Initialize replaces a previously non-initialized reporter. Can be called once. No errors are expected during normal operations.

func (*Reporter) LowestIndexedHeight

func (s *Reporter) LowestIndexedHeight() (uint64, error)

LowestIndexedHeight returns the lowest height indexed by the execution state indexer. Expected errors: - indexer.ErrIndexNotInitialized if the IndexReporter has not been initialized

type TransactionResultsIndex

type TransactionResultsIndex struct {
	*Reporter
	// contains filtered or unexported fields
}

TransactionResultsIndex implements a wrapper around `storage.LightTransactionResult` ensuring that needed data has been synced and is available to the client. Note: read detail how `Reporter` is working

func NewTransactionResultsIndex

func NewTransactionResultsIndex(reporter *Reporter, results storage.LightTransactionResults) *TransactionResultsIndex

func (*TransactionResultsIndex) ByBlockID

func (t *TransactionResultsIndex) ByBlockID(blockID flow.Identifier, height uint64) ([]flow.LightTransactionResult, error)

ByBlockID checks data availability and returns all transaction results for a block Expected errors:

  • indexer.ErrIndexNotInitialized if the `TransactionResultsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound if result cannot be provided by storage due to the absence of data.

func (*TransactionResultsIndex) ByBlockIDTransactionID

func (t *TransactionResultsIndex) ByBlockIDTransactionID(blockID flow.Identifier, height uint64, txID flow.Identifier) (*flow.LightTransactionResult, error)

ByBlockIDTransactionID checks data availability and return the transaction result for the given block ID and transaction ID Expected errors:

  • indexer.ErrIndexNotInitialized if the `TransactionResultsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound if result cannot be provided by storage due to the absence of data.

func (*TransactionResultsIndex) ByBlockIDTransactionIndex

func (t *TransactionResultsIndex) ByBlockIDTransactionIndex(blockID flow.Identifier, height uint64, index uint32) (*flow.LightTransactionResult, error)

ByBlockIDTransactionIndex checks data availability and return the transaction result for the given blockID and transaction index Expected errors:

  • indexer.ErrIndexNotInitialized if the `TransactionResultsIndex` has not been initialized
  • storage.ErrHeightNotIndexed when data is unavailable
  • codes.NotFound when result cannot be provided by storage due to the absence of data.

Jump to

Keyboard shortcuts

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