blockdao

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

Functions

This section is empty.

Types

type BlockDAO

type BlockDAO interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	GetBlockHash(height uint64) (hash.Hash256, error)
	GetBlockHeight(hash hash.Hash256) (uint64, error)
	GetBlock(hash hash.Hash256) (*block.Block, error)
	GetBlockHashByActionHash(h hash.Hash256) (hash.Hash256, error)
	GetActionsByAddress(addrBytes hash.Hash160, start, count uint64) ([][]byte, error)
	GetActionCountByAddress(addrBytes hash.Hash160) (uint64, error)
	GetActionHashFromIndex(start, count uint64) ([][]byte, error)
	Header(h hash.Hash256) (*block.Header, error)
	Body(h hash.Hash256) (*block.Body, error)
	Footer(h hash.Hash256) (*block.Footer, error)
	GetBlockchainHeight() (uint64, error)
	GetTotalActions() (uint64, error)
	GetNumActions(height uint64) (uint64, error)
	GetTranferAmount(height uint64) (*big.Int, error)
	GetReceiptByActionHash(h hash.Hash256) (*action.Receipt, error)
	GetReceipts(blkHeight uint64) ([]*action.Receipt, error)
	PutBlock(blk *block.Block) error
	PutReceipts(blkHeight uint64, blkReceipts []*action.Receipt) error
	DeleteTipBlock() error
	KVStore() db.KVStore
}

BlockDAO represents the block data access object

func NewBlockDAO

func NewBlockDAO(kvstore db.KVStore, writeIndex bool, compressBlock bool, maxCacheSize int, cfg config.DB) BlockDAO

NewBlockDAO instantiates a block DAO

type IndexBuilder

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

IndexBuilder defines the index builder

func NewIndexBuilder

func NewIndexBuilder(chainID uint32, dao BlockDAO, reindex bool) (*IndexBuilder, error)

NewIndexBuilder instantiates an index builder

func (*IndexBuilder) HandleBlock

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

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

func (*IndexBuilder) Start

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

Start starts the index builder

func (*IndexBuilder) Stop

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

Stop stops the index builder

Jump to

Keyboard shortcuts

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