database

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: AGPL-3.0 Imports: 17 Imported by: 8 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const UtxoPreFix = "UT:"

Variables

View Source
var (
	BlockStoreKey     = []byte("blockStore")
	BlockPrefix       = []byte("B:")
	BlockHeaderPrefix = []byte("BH:")
	TxStatusPrefix    = []byte("BTS:")
)

Functions

func CalcBlockHeaderKey added in v1.0.10

func CalcBlockHeaderKey(height uint64, hash *bc.Hash) []byte

func CalcBlockKey added in v1.0.10

func CalcBlockKey(hash *bc.Hash) []byte

func CalcTxStatusKey added in v1.0.10

func CalcTxStatusKey(hash *bc.Hash) []byte

func CalcUtxoKey added in v1.0.10

func CalcUtxoKey(hash *bc.Hash) []byte

func GetBlock added in v1.0.9

func GetBlock(db dbm.DB, hash *bc.Hash) (*types.Block, error)

GetBlock return the block by given hash

func SaveUtxoView added in v1.0.9

func SaveUtxoView(batch dbm.Batch, view *state.UtxoViewpoint) error

Types

type Store

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

A Store encapsulates storage for blockchain validation. It satisfies the interface protocol.Store, and provides additional methods for querying current data.

func NewStore added in v1.0.9

func NewStore(db dbm.DB) *Store

NewStore creates and returns a new Store object.

func (*Store) BlockExist

func (s *Store) BlockExist(hash *bc.Hash) bool

BlockExist check if the block is stored in disk

func (*Store) GetBlock

func (s *Store) GetBlock(hash *bc.Hash) (*types.Block, error)

GetBlock return the block by given hash

func (*Store) GetStoreStatus

func (s *Store) GetStoreStatus() *protocol.BlockStoreState

GetStoreStatus return the BlockStoreStateJSON

func (*Store) GetTransactionStatus

func (s *Store) GetTransactionStatus(hash *bc.Hash) (*bc.TransactionStatus, error)

GetTransactionStatus will return the utxo that related to the block hash

func (*Store) GetTransactionsUtxo

func (s *Store) GetTransactionsUtxo(view *state.UtxoViewpoint, txs []*bc.Tx) error

GetTransactionsUtxo will return all the utxo that related to the input txs

func (*Store) GetUtxo

func (s *Store) GetUtxo(hash *bc.Hash) (*storage.UtxoEntry, error)

GetUtxo will search the utxo in db

func (*Store) LoadBlockIndex added in v1.0.9

func (s *Store) LoadBlockIndex(stateBestHeight uint64) (*state.BlockIndex, error)

func (*Store) SaveBlock

func (s *Store) SaveBlock(block *types.Block, ts *bc.TransactionStatus) error

SaveBlock persists a new block in the protocol.

func (*Store) SaveChainStatus

func (s *Store) SaveChainStatus(node *state.BlockNode, view *state.UtxoViewpoint) error

SaveChainStatus save the core's newest status && delete old status

Directories

Path Synopsis
Package storage is a generated protocol buffer package.
Package storage is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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