iotex-core: github.com/iotexproject/iotex-core/blockchain/blockdao Index | Files

package blockdao

import "github.com/iotexproject/iotex-core/blockchain/blockdao"

Index

Package Files

blockdao.go

Variables

var (

    // ErrNotOpened indicates db is not opened
    ErrNotOpened = errors.New("DB is not opened")
)

type BlockDAO Uses

type BlockDAO interface {
    Start(ctx context.Context) error
    Stop(ctx context.Context) error
    GetBlockHash(uint64) (hash.Hash256, error)
    GetBlockHeight(hash.Hash256) (uint64, error)
    GetBlock(hash.Hash256) (*block.Block, error)
    GetBlockByHeight(uint64) (*block.Block, error)
    Height() (uint64, error)
    Header(hash.Hash256) (*block.Header, error)
    Body(hash.Hash256) (*block.Body, error)
    Footer(hash.Hash256) (*block.Footer, error)
    GetActionByActionHash(hash.Hash256, uint64) (action.SealedEnvelope, error)
    GetReceiptByActionHash(hash.Hash256, uint64) (*action.Receipt, error)
    GetReceipts(uint64) ([]*action.Receipt, error)
    PutBlock(context.Context, *block.Block) error
    DeleteBlockToTarget(uint64) error
    KVStore() db.KVStore
    HeaderByHeight(uint64) (*block.Header, error)
    FooterByHeight(uint64) (*block.Footer, error)
}

BlockDAO represents the block data access object

func NewBlockDAO Uses

func NewBlockDAO(kvStore db.KVStore, indexers []BlockIndexer, compressBlock bool, cfg config.DB) BlockDAO

NewBlockDAO instantiates a block DAO

type BlockIndexer Uses

type BlockIndexer interface {
    Start(ctx context.Context) error
    Stop(ctx context.Context) error
    Height() (uint64, error)
    PutBlock(context.Context, *block.Block) error
    DeleteTipBlock(blk *block.Block) error
}

BlockIndexer defines an interface to accept block to build index

Package blockdao imports 30 packages (graph) and is imported by 4 packages. Updated 2020-07-07. Refresh now. Tools for package owners.