Documentation ¶
Index ¶
- Variables
- type BlockerIndexer
- func (idx *BlockerIndexer) GetRetainHeight() (int64, error)
- func (idx *BlockerIndexer) Has(height int64) (bool, error)
- func (idx *BlockerIndexer) Index(bh types.EventDataNewBlockEvents) error
- func (idx *BlockerIndexer) Prune(retainHeight int64) (numPruned int64, newRetainHeight int64, err error)
- func (idx *BlockerIndexer) Search(ctx context.Context, q *query.Query) ([]int64, error)
- func (idx *BlockerIndexer) SetLogger(l log.Logger)
- func (idx *BlockerIndexer) SetRetainHeight(retainHeight int64) error
- type HeightInfo
- type IndexerOption
Constants ¶
This section is empty.
Variables ¶
var ( LastBlockIndexerRetainHeightKey = []byte("LastBlockIndexerRetainHeightKey") BlockIndexerRetainHeightKey = []byte("BlockIndexerRetainHeightKey") ErrInvalidHeightValue = errors.New("invalid height value") )
Functions ¶
This section is empty.
Types ¶
type BlockerIndexer ¶
type BlockerIndexer struct {
// contains filtered or unexported fields
}
BlockerIndexer implements a block indexer, indexing FinalizeBlock events with an underlying KV store. Block events are indexed by their height, such that matching search criteria returns the respective block height(s).
func New ¶
func New(store dbm.DB, options ...IndexerOption) *BlockerIndexer
func (*BlockerIndexer) GetRetainHeight ¶
func (idx *BlockerIndexer) GetRetainHeight() (int64, error)
func (*BlockerIndexer) Has ¶
func (idx *BlockerIndexer) Has(height int64) (bool, error)
Has returns true if the given height has been indexed. An error is returned upon database query failure.
func (*BlockerIndexer) Index ¶
func (idx *BlockerIndexer) Index(bh types.EventDataNewBlockEvents) error
Index indexes FinalizeBlock events for a given block by its height. The following is indexed:
primary key: encode(block.height | height) => encode(height) FinalizeBlock events: encode(eventType.eventAttr|eventValue|height|finalize_block|eventSeq) => encode(height).
func (*BlockerIndexer) Prune ¶
func (idx *BlockerIndexer) Prune(retainHeight int64) (numPruned int64, newRetainHeight int64, err error)
func (*BlockerIndexer) Search ¶
Search performs a query for block heights that match a given FinalizeBlock event search criteria. The given query can match against zero, one or more block heights. In the case of height queries, i.e. block.height=H, if the height is indexed, that height alone will be returned. An error and nil slice is returned. Otherwise, a non-nil slice and nil error is returned.
func (*BlockerIndexer) SetLogger ¶
func (idx *BlockerIndexer) SetLogger(l log.Logger)
func (*BlockerIndexer) SetRetainHeight ¶
func (idx *BlockerIndexer) SetRetainHeight(retainHeight int64) error
type HeightInfo ¶
type HeightInfo struct {
// contains filtered or unexported fields
}
type IndexerOption ¶
type IndexerOption func(*BlockerIndexer)
func WithCompaction ¶
func WithCompaction(compact bool, compactionInterval int64) IndexerOption
WithCompaction sets the compaciton parameters.