blockkvdb

package
v0.0.0-...-8b03266 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DbType_Mysql = "mysql"

Functions

This section is empty.

Types

type BlockKvDB

type BlockKvDB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BlockKvDB provider a implementation of `blockdb.BlockDB` This implementation provides a key-value based data model

func NewBlockKvDB

func NewBlockKvDB(chainId string, dbHandle protocol.DBHandle, logger protocol.Logger,
	storeConfig *conf.StorageConfig) *BlockKvDB

创建blockKvDB

func (*BlockKvDB) BlockExists

func (b *BlockKvDB) BlockExists(blockHash []byte) (bool, error)

BlockExists returns true if the block hash exist, or returns false if none exists.

func (*BlockKvDB) Close

func (b *BlockKvDB) Close()

Close is used to close database

func (*BlockKvDB) CommitBlock

func (b *BlockKvDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error

CommitBlock commits the block and the corresponding rwsets in an atomic operation

func (*BlockKvDB) CommitCache

func (b *BlockKvDB) CommitCache(blockInfo *serialization.BlockWithSerializedInfo) error

提交数据到cache

func (*BlockKvDB) CommitDB

func (b *BlockKvDB) CommitDB(blockInfo *serialization.BlockWithSerializedInfo) error

提交数据到kvdb

func (*BlockKvDB) GetArchivedPivot

func (b *BlockKvDB) GetArchivedPivot() (uint64, error)

GetArchivedPivot return archived pivot

func (*BlockKvDB) GetBlock

func (b *BlockKvDB) GetBlock(height uint64) (*commonPb.Block, error)

GetBlock returns a block given it's block height, or returns nil if none exists.

func (*BlockKvDB) GetBlockByHash

func (b *BlockKvDB) GetBlockByHash(blockHash []byte) (*commonPb.Block, error)

GetBlockByHash returns a block given it's hash, or returns nil if none exists.

func (*BlockKvDB) GetBlockByTx

func (b *BlockKvDB) GetBlockByTx(txId string) (*commonPb.Block, error)

GetBlockByTx returns a block which contains a tx.

func (*BlockKvDB) GetBlockHeaderByHeight

func (b *BlockKvDB) GetBlockHeaderByHeight(height uint64) (*commonPb.BlockHeader, error)

GetBlockHeaderByHeight returns a block header by given it's height, or returns nil if none exists.

func (*BlockKvDB) GetBlockIndex

func (b *BlockKvDB) GetBlockIndex(height uint64) (*storePb.StoreInfo, error)

func (*BlockKvDB) GetBlockMetaIndex

func (b *BlockKvDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, error)

func (*BlockKvDB) GetFilteredBlock

func (b *BlockKvDB) GetFilteredBlock(height uint64) (*storePb.SerializedBlock, error)

GetFilteredBlock returns a filtered block given it's block height, or return nil if none exists.

func (*BlockKvDB) GetHeightByHash

func (b *BlockKvDB) GetHeightByHash(blockHash []byte) (uint64, error)

GetHeightByHash returns a block height given it's hash, or returns nil if none exists.

func (*BlockKvDB) GetLastBlock

func (b *BlockKvDB) GetLastBlock() (*commonPb.Block, error)

GetLastBlock returns the last block.

func (*BlockKvDB) GetLastConfigBlock

func (b *BlockKvDB) GetLastConfigBlock() (*commonPb.Block, error)

GetLastConfigBlock returns the last config block.

func (*BlockKvDB) GetLastConfigBlockHeight

func (b *BlockKvDB) GetLastConfigBlockHeight() (uint64, error)

GetLastConfigBlockHeight returns the last config block height.

func (*BlockKvDB) GetLastSavepoint

func (b *BlockKvDB) GetLastSavepoint() (uint64, error)

GetLastSavepoint reurns the last block height

func (*BlockKvDB) GetTx

func (b *BlockKvDB) GetTx(txId string) (*commonPb.Transaction, error)

GetTx retrieves a transaction by txid, or returns nil if none exists.

func (*BlockKvDB) GetTxConfirmedTime

func (b *BlockKvDB) GetTxConfirmedTime(txId string) (int64, error)

GetTxConfirmedTime returns the confirmed time of a given tx

func (*BlockKvDB) GetTxHeight

func (b *BlockKvDB) GetTxHeight(txId string) (uint64, error)

GetTxHeight retrieves a transaction height by txid, or returns nil if none exists.

func (*BlockKvDB) GetTxIndex

func (b *BlockKvDB) GetTxIndex(txId string) (*storePb.StoreInfo, error)

func (*BlockKvDB) GetTxInfoOnly

func (b *BlockKvDB) GetTxInfoOnly(txId string) (*storePb.TransactionStoreInfo, error)

GetTxInfoOnly 获得除Tx之外的其他TxInfo信息

func (*BlockKvDB) GetTxWithBlockInfo

func (b *BlockKvDB) GetTxWithBlockInfo(txId string) (*storePb.TransactionStoreInfo, error)

根据txId获得交易

func (*BlockKvDB) InitGenesis

func (b *BlockKvDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error

初始化创世区块

func (*BlockKvDB) RestoreBlocks

func (b *BlockKvDB) RestoreBlocks(blockInfos []*serialization.BlockWithSerializedInfo) error

RestoreBlocks restore block data from outside to kvdb: txid--SerializedTx

func (*BlockKvDB) ShrinkBlocks

func (b *BlockKvDB) ShrinkBlocks(startHeight uint64, endHeight uint64) (map[uint64][]string, error)

ShrinkBlocks remove ranged txid--SerializedTx from kvdb

func (*BlockKvDB) TxArchived

func (b *BlockKvDB) TxArchived(txId string) (bool, error)

TxArchived returns true if the tx archived, or returns false.

func (*BlockKvDB) TxExists

func (b *BlockKvDB) TxExists(txId string) (bool, error)

TxExists returns true if the tx exist, or returns false if none exists.

Jump to

Keyboard shortcuts

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