Documentation ¶
Index ¶
- Constants
- Variables
- type BlockDB
- func (db *BlockDB) CheckInBlock(blk []byte, hash []byte, h uint32) error
- func (db *BlockDB) CheckOutBlock(hash []byte) (blk []byte, err error)
- func (db *BlockDB) GetBlockHash(height uint32) (hash []byte, err error)
- func (db *BlockDB) GetBlockHeight(hash []byte) (height uint32, err error)
- func (db *BlockDB) Init() (hash []byte, height uint32, err error)
- func (db *BlockDB) StoreBlockToFile(start, end uint32) error
Constants ¶
View Source
const (
BlockData = "../block.dat"
)
Directory of block data
Variables ¶
View Source
var ( // ErrNotExist indicates certain item does not exist in Blockchain database ErrNotExist = errors.New("not exist in DB") // ErrAlreadyExist indicates certain item already exists in Blockchain database ErrAlreadyExist = errors.New("already exist in DB") )
Functions ¶
This section is empty.
Types ¶
type BlockDB ¶
BlockDB defines the DB interface to read/store/persist blocks
func NewBlockDB ¶
NewBlockDB returns a new BlockDB instance
func (*BlockDB) CheckInBlock ¶
CheckInBlock checks a block into DB
func (*BlockDB) CheckOutBlock ¶
CheckOutBlock checks a block out of DB
func (*BlockDB) GetBlockHash ¶
GetBlockHash returns the block hash by height
func (*BlockDB) GetBlockHeight ¶
GetBlockHeight returns the block height by hash
func (*BlockDB) StoreBlockToFile ¶
StoreBlockToFile writes block raw data into file
Click to show internal directories.
Click to hide internal directories.