Documentation ¶
Index ¶
- type BlockKvDB
- func (b *BlockKvDB) BlockExists(blockHash []byte) (bool, error)
- func (b *BlockKvDB) Close()
- func (b *BlockKvDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error
- func (b *BlockKvDB) CommitCache(blockInfo *serialization.BlockWithSerializedInfo) error
- func (b *BlockKvDB) CommitDB(blockInfo *serialization.BlockWithSerializedInfo) error
- func (b *BlockKvDB) CompactRange() error
- func (b *BlockKvDB) GetArchivedPivot() (uint64, error)
- func (b *BlockKvDB) GetBlock(height uint64) (*commonPb.Block, error)
- func (b *BlockKvDB) GetBlockByHash(blockHash []byte) (*commonPb.Block, error)
- func (b *BlockKvDB) GetBlockByTx(txId string) (*commonPb.Block, error)
- func (b *BlockKvDB) GetBlockHeaderByHeight(height uint64) (*commonPb.BlockHeader, error)
- func (b *BlockKvDB) GetBlockIndex(height uint64) (*storePb.StoreInfo, error)
- func (b *BlockKvDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, error)
- func (b *BlockKvDB) GetDbType() string
- func (b *BlockKvDB) GetFilteredBlock(height uint64) (*storePb.SerializedBlock, error)
- func (b *BlockKvDB) GetHeightByHash(blockHash []byte) (uint64, error)
- func (b *BlockKvDB) GetLastBlock() (*commonPb.Block, error)
- func (b *BlockKvDB) GetLastConfigBlock() (*commonPb.Block, error)
- func (b *BlockKvDB) GetLastConfigBlockHeight() (uint64, error)
- func (b *BlockKvDB) GetLastSavepoint() (uint64, error)
- func (b *BlockKvDB) GetTx(txId string) (*commonPb.Transaction, error)
- func (b *BlockKvDB) GetTxConfirmedTime(txId string) (int64, error)
- func (b *BlockKvDB) GetTxHeight(txId string) (uint64, error)
- func (b *BlockKvDB) GetTxIndex(txId string) (*storePb.StoreInfo, error)
- func (b *BlockKvDB) GetTxInfoOnly(txId string) (*storePb.TransactionStoreInfo, error)
- func (b *BlockKvDB) GetTxWithBlockInfo(txId string) (*storePb.TransactionStoreInfo, error)
- func (b *BlockKvDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
- func (b *BlockKvDB) RestoreBlocks(blockInfos []*serialization.BlockWithSerializedInfo) error
- func (b *BlockKvDB) ShrinkBlocks(startHeight uint64, endHeight uint64, _ string) (map[uint64][]string, error)
- func (b *BlockKvDB) TxArchived(txId string) (bool, error)
- func (b *BlockKvDB) TxExists(txId string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockKvDB ¶
BlockKvDB provider an implementation of `blockdb.BlockDB`
@Description:
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
NewBlockKvDB 创建blockKvDB
@Description: @param chainId @param dbHandle @param logger @param storeConfig @return *BlockKvDB
func (*BlockKvDB) BlockExists ¶
BlockExists returns true if the block hash exist, or returns false if none exists.
@Description: @receiver b @param blockHash @return bool @return error
func (*BlockKvDB) Close ¶
func (b *BlockKvDB) Close()
Close is used to close database
@Description: @receiver b
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
@Description: @receiver b @param blockInfo @param isCache @return error
func (*BlockKvDB) CommitCache ¶
func (b *BlockKvDB) CommitCache(blockInfo *serialization.BlockWithSerializedInfo) error
CommitCache 提交数据到cache
@Description: @receiver b @param blockInfo @return error
func (*BlockKvDB) CommitDB ¶
func (b *BlockKvDB) CommitDB(blockInfo *serialization.BlockWithSerializedInfo) error
CommitDB 提交数据到kvdb
@Description: @receiver b @param blockInfo @return error
func (*BlockKvDB) CompactRange ¶ added in v3.0.1
CompactRange fo kvdb compact action @Description: @return error
func (*BlockKvDB) GetArchivedPivot ¶
GetArchivedPivot return archived pivot
@Description: @receiver b @return uint64 @return error
func (*BlockKvDB) GetBlock ¶
GetBlock returns a block given its block height, or returns nil if none exists.
@Description: @receiver b @param height @return *commonPb.Block @return error
func (*BlockKvDB) GetBlockByHash ¶
GetBlockByHash returns a block given its hash, or returns nil if none exists.
@Description: @receiver b @param blockHash @return *commonPb.Block @return error
func (*BlockKvDB) GetBlockByTx ¶
GetBlockByTx returns a block which contains a tx.
@Description: @receiver b @param txId @return *commonPb.Block @return error
func (*BlockKvDB) GetBlockHeaderByHeight ¶
func (b *BlockKvDB) GetBlockHeaderByHeight(height uint64) (*commonPb.BlockHeader, error)
GetBlockHeaderByHeight returns a block header by given its height, or returns nil if none exists.
rawdb archive do not remove block metadata @Description: @receiver b @param height @return *commonPb.BlockHeader @return error
func (*BlockKvDB) GetBlockIndex ¶
GetBlockIndex not implement
@Description: @receiver b @param height @return *storePb.StoreInfo @return error
func (*BlockKvDB) GetBlockMetaIndex ¶
GetBlockMetaIndex not implement
@Description: @receiver b @param height @return *storePb.StoreInfo @return error
func (*BlockKvDB) GetDbType ¶ added in v3.0.1
GetDbType add next time @Description: @receiver b @return string
func (*BlockKvDB) GetFilteredBlock ¶
func (b *BlockKvDB) GetFilteredBlock(height uint64) (*storePb.SerializedBlock, error)
GetFilteredBlock returns a filtered block given its block height, or return nil if none exists.
@Description: @receiver b @param height @return *storePb.SerializedBlock @return error
func (*BlockKvDB) GetHeightByHash ¶
GetHeightByHash returns a block height given its hash, or returns nil if none exists.
@Description: @receiver b @param blockHash @return uint64 @return error
func (*BlockKvDB) GetLastBlock ¶
GetLastBlock returns the last block.
@Description: @receiver b @return *commonPb.Block @return error
func (*BlockKvDB) GetLastConfigBlock ¶
GetLastConfigBlock returns the last config block.
@Description: @receiver b @return *commonPb.Block @return error
func (*BlockKvDB) GetLastConfigBlockHeight ¶
GetLastConfigBlockHeight returns the last config block height.
@Description: @receiver b @return uint64 @return error
func (*BlockKvDB) GetLastSavepoint ¶
GetLastSavepoint returns the last block height
@Description: @receiver b @return uint64 @return error
func (*BlockKvDB) GetTx ¶
func (b *BlockKvDB) GetTx(txId string) (*commonPb.Transaction, error)
GetTx retrieves a transaction by txid, or returns nil if none exists.
@Description: @receiver b @param txId @return *commonPb.Transaction @return error
func (*BlockKvDB) GetTxConfirmedTime ¶
GetTxConfirmedTime returns the confirmed time of a given tx
@Description: @receiver b @param txId @return int64 @return error
func (*BlockKvDB) GetTxHeight ¶
GetTxHeight retrieves a transaction height by txid, or returns nil if none exists.
@Description: @receiver b @param txId @return uint64 @return error
func (*BlockKvDB) GetTxIndex ¶
GetTxIndex not implement
@Description: @receiver b @param txId @return *storePb.StoreInfo @return error
func (*BlockKvDB) GetTxInfoOnly ¶
func (b *BlockKvDB) GetTxInfoOnly(txId string) (*storePb.TransactionStoreInfo, error)
GetTxInfoOnly 获得除Tx之外的其他TxInfo信息
@Description: @receiver b @param txId @return *storePb.TransactionStoreInfo @return error
func (*BlockKvDB) GetTxWithBlockInfo ¶
func (b *BlockKvDB) GetTxWithBlockInfo(txId string) (*storePb.TransactionStoreInfo, error)
GetTxWithBlockInfo 根据txId获得交易
@Description: @receiver b @param txId @return *storePb.TransactionStoreInfo @return error
func (*BlockKvDB) InitGenesis ¶
func (b *BlockKvDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
InitGenesis 初始化创世区块
@Description: @receiver b @param genesisBlock @return error
func (*BlockKvDB) RestoreBlocks ¶
func (b *BlockKvDB) RestoreBlocks(blockInfos []*serialization.BlockWithSerializedInfo) error
RestoreBlocks restore block data from outside to kvdb: txid--SerializedTx
@Description: @receiver b @param blockInfos @return error
func (*BlockKvDB) ShrinkBlocks ¶
func (b *BlockKvDB) ShrinkBlocks(startHeight uint64, endHeight uint64, _ string) (map[uint64][]string, error)
ShrinkBlocks remove ranged txid--SerializedTx from kvdb
@Description: @receiver b @param startHeight @param endHeight @return map[uint64][]string @return error
func (*BlockKvDB) TxArchived ¶
TxArchived returns true if the tx archived, or returns false.
@Description: @receiver b @param txId @return bool @return error