storage

package
v0.0.0-...-d9e9b57 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoltLastHashKey      = "l"
	BoltFileFormat       = "dotchain_%s.db"
	BoltBlocksBucket     = "blocks"
	BoltUTXOBucket       = "chainstate"
	BoltTXMemPool        = "txmempool"
	BoltBlockIndexBucket = "blockindex"
)

Variables

View Source
var ErrorBlockNotFount = errors.New("Block is not found")

Functions

func CountTransactions

func CountTransactions(db *bolt.DB) int

func CreateBlockBucket

func CreateBlockBucket(db *bolt.DB) error

CreateBlockBucket

func CreateBlockIndexBucket

func CreateBlockIndexBucket(db *bolt.DB) error

func GetBlock

func GetBlock(db *bolt.DB, blockHash []byte) (blockData []byte, err error)

GetBlock query block data with block hash if not exists, return ErrorBlockNotFount

func GetDBFileName

func GetDBFileName(nodeID string) string

getDBFileName get dbfile's name with NodeID like dotchain_XXXXXX.db

func GetLashBlockHash

func GetLashBlockHash(db *bolt.DB) (lastHash []byte, err error)

func GetLastBlock

func GetLastBlock(db *bolt.DB) (lastHash, lastBlockData []byte, err error)

func GetTXMemPool

func GetTXMemPool(db *bolt.DB) ([]byte, error)

func RemoveBlock

func RemoveBlock(db *bolt.DB, blockHash []byte) error

RemoveBlock remove block

func SaveBlock

func SaveBlock(db *bolt.DB, blockHash, blockData []byte) error

func SaveBlockIndex

func SaveBlockIndex(db *bolt.DB, key, blockIndex []byte) error

SaveBlockIndex save block index to db

func SaveTXMemPool

func SaveTXMemPool(db *bolt.DB, txPool []byte) error

SaveTXMemPool save mempool into db

Types

This section is empty.

Jump to

Keyboard shortcuts

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