blockdao

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 27 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(uint64) (hash.Hash256, error)
	GetBlockHeight(hash.Hash256) (uint64, error)
	GetBlock(hash.Hash256) (*block.Block, error)
	GetBlockByHeight(uint64) (*block.Block, error)
	TipHeight() (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(*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

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

NewBlockDAO instantiates a block DAO

type BlockIndexer added in v0.11.0

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

BlockIndexer defines an interface to accept block to build index

Jump to

Keyboard shortcuts

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