blockindex

package
v1.6.2-rc8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockBloomFilterNamespace indicated the kvstore namespace to store block BloomFilters
	BlockBloomFilterNamespace = "BlockBloomFilters"
	// RangeBloomFilterNamespace indicates the kvstore namespace to store range BloomFilters
	RangeBloomFilterNamespace = "RangeBloomFilters"
	// CurrentHeightKey indicates the key of current bf indexer height in underlying DB
	CurrentHeightKey = "CurrentHeight"
)

Variables

View Source
var (

	// ErrActionIndexNA indicates action index is not supported
	ErrActionIndexNA = errors.New("action index not supported")
)
View Source
var (
	// TotalBloomFilterNamespace indicates the kvstore namespace to store total ranges
	TotalBloomFilterNamespace = []byte("TotalBloomFilters")
)

Functions

This section is empty.

Types

type BloomFilterIndexer added in v1.1.3

type BloomFilterIndexer interface {
	blockdao.BlockIndexer
	// RangeBloomFilterNumElements returns the number of elements that each rangeBloomfilter indexes
	RangeBloomFilterNumElements() uint64
	// BlockFilterByHeight returns the block-level bloomfilter which includes not only topic but also address of logs info by given block height
	BlockFilterByHeight(uint64) (bloom.BloomFilter, error)
	// RangeFilterByHeight returns the range bloomfilter for the height
	RangeFilterByHeight(uint64) (bloom.BloomFilter, error)
	// FilterBlocksInRange returns the block numbers by given logFilter in range from start to end
	FilterBlocksInRange(*filter.LogFilter, uint64, uint64) ([]uint64, error)
}

BloomFilterIndexer is the interface for bloomfilter indexer

func NewBloomfilterIndexer added in v1.1.3

func NewBloomfilterIndexer(kv db.KVStore, cfg config.Indexer) (BloomFilterIndexer, error)

NewBloomfilterIndexer creates a new bloomfilterindexer struct by given kvstore and rangebloomfilter size

type IndexBuilder

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

IndexBuilder defines the index builder

func NewIndexBuilder

func NewIndexBuilder(chainID uint32, dao blockdao.BlockDAO, indexer Indexer) (*IndexBuilder, error)

NewIndexBuilder instantiates an index builder

func (*IndexBuilder) Indexer

func (ib *IndexBuilder) Indexer() Indexer

Indexer returns the indexer

func (*IndexBuilder) ReceiveBlock

func (ib *IndexBuilder) ReceiveBlock(blk *block.Block) error

ReceiveBlock handles the block and create the indices for the actions and receipts in it

func (*IndexBuilder) Start

func (ib *IndexBuilder) Start(ctx context.Context) error

Start starts the index builder

func (*IndexBuilder) Stop

func (ib *IndexBuilder) Stop(ctx context.Context) error

Stop stops the index builder

type Indexer

type Indexer interface {
	Start(context.Context) error
	Stop(context.Context) error
	PutBlock(context.Context, *block.Block) error
	PutBlocks([]*block.Block) error
	DeleteTipBlock(*block.Block) error
	Height() (uint64, error)
	GetBlockHash(height uint64) (hash.Hash256, error)
	GetBlockHeight(hash hash.Hash256) (uint64, error)
	GetBlockIndex(uint64) (*blockIndex, error)
	GetActionIndex([]byte) (*actionIndex, error)
	GetTotalActions() (uint64, error)
	GetActionHashFromIndex(uint64, uint64) ([][]byte, error)
	GetActionCountByAddress(hash.Hash160) (uint64, error)
	GetActionsByAddress(hash.Hash160, uint64, uint64) ([][]byte, error)
}

Indexer is the interface for block indexer

func NewIndexer

func NewIndexer(kv db.KVStore, genesisHash hash.Hash256) (Indexer, error)

NewIndexer creates a new indexer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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