iotex-core: Index | Files | Directories

package blockindex

import ""


Package Files

actionindex.go blockindex.go indexbuilder.go indexer.go


var (

    // ErrActionIndexNA indicates action index is not supported
    ErrActionIndexNA = errors.New("action index not supported")

type IndexBuilder Uses

type IndexBuilder struct {
    // contains filtered or unexported fields

IndexBuilder defines the index builder

func NewIndexBuilder Uses

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

NewIndexBuilder instantiates an index builder

func (*IndexBuilder) Indexer Uses

func (ib *IndexBuilder) Indexer() Indexer

Indexer returns the indexer

func (*IndexBuilder) ReceiveBlock Uses

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 Uses

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

Start starts the index builder

func (*IndexBuilder) Stop Uses

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

Stop stops the index builder

type Indexer Uses

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 Uses

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

NewIndexer creates a new indexer



Package blockindex imports 21 packages (graph) and is imported by 2 packages. Updated 2020-05-19. Refresh now. Tools for package owners.