Documentation ¶
Index ¶
- Constants
- Variables
- func BuildKVBatch(isBFDB bool, batch *types.UpdateBatch, ...)
- func BuildKVBatchForBFDB(batch *types.UpdateBatch, block *commonPb.Block, dbType string, ...) *types.UpdateBatch
- func BuildKVBatchForRawDB(batch *types.UpdateBatch, block *commonPb.Block, dbType string, ...) *types.UpdateBatch
- func ConstructBlockHashKey(dbType string, blockHash []byte) []byte
- func ConstructBlockIndexKey(dbType string, blockNum uint64) []byte
- func ConstructBlockMetaIndexKey(dbType string, blockNum uint64) []byte
- func ConstructBlockNumKey(dbType string, blockNum uint64) []byte
- func ConstructBlockTxIDKey(txID string) []byte
- func ConstructFBTxIDBlockInfo(height uint64, blockHash []byte, txIndex uint32, timestamp int64, ...) []byte
- func ConstructTxIDBlockInfo(height uint64, blockHash []byte, txIndex uint32, timestamp int64) []byte
- func ConstructTxIDKey(txId string) []byte
- func DecodeBlockNum(blockNumBytes []byte) uint64
- func DecodeBlockNumKey(dbType string, blkNumBytes []byte) uint64
- func EncodeBlockNum(blockNum uint64) []byte
- func GetBlockByHeightKey(dbHandle protocol.DBHandle, cacheSC *cache.StoreCacheMgr, heightKey []byte, ...) (*commonPb.Block, error)
- func GetFromCacheFirst(key []byte, dbHandle protocol.DBHandle, cacheSC *cache.StoreCacheMgr, ...) ([]byte, error)
- func HandleFDKVRWSet(vBytes []byte, err error) (*commonPb.TxRWSet, error)
- func HandleFDKVTx(_ string, vBytes []byte, err error) (*commonPb.Transaction, error)
- func ParseFBTxIdBlockInfo(value []byte) (height uint64, blockHash []byte, txIndex uint32, timestamp int64, ...)
- func ParseTxIdBlockInfo(value []byte) (height uint64, blockHash []byte, txIndex uint32, timestamp int64, err error)
- func ParseTxIdBlockInfoOld(value []byte) (height uint64, blockHash []byte, txIndex uint32, err error)
Constants ¶
const ( BlockIndexKeyPrefix = "ib" BlockMetaIndexKeyPrefix = "im" )
nolint
const ( BlockNumIdxKeyPrefix = 'n' BlockHashIdxKeyPrefix = 'h' TxIDIdxKeyPrefix = 't' //TxConfirmedTimeKeyPrefix = 'c' BlockTxIDIdxKeyPrefix = 'b' LastBlockNumKeyStr = "lastBlockNumKey" LastConfigBlockNumKey = "lastConfigBlockNumKey" ArchivedPivotKey = "archivedPivotKey" )
nolint
Variables ¶
var DbType_Mysql = "mysql"
DbType_Mysql nolint
Functions ¶
func BuildKVBatch ¶
func BuildKVBatch(isBFDB bool, batch *types.UpdateBatch, blockInfo *serialization.BlockWithSerializedInfo, dbType string, logger protocol.Logger)
BuildKVBatch add next time @Description: @param batch @param blockInfo @param dbType @param logger @return *types.UpdateBatch
func BuildKVBatchForBFDB ¶
func BuildKVBatchForBFDB(batch *types.UpdateBatch, block *commonPb.Block, dbType string, logger protocol.Logger) *types.UpdateBatch
BuildKVBatchForBFDB add next time @Description: @param batch @param blockInfo @param dbType @param logger @return *types.UpdateBatch
func BuildKVBatchForRawDB ¶
func BuildKVBatchForRawDB(batch *types.UpdateBatch, block *commonPb.Block, dbType string, logger protocol.Logger) *types.UpdateBatch
BuildKVBatchForRawDB add next time @Description: @param batch @param blockInfo @param dbType @param logger @return *types.UpdateBatch
func ConstructBlockHashKey ¶
ConstructBlockHashKey construct block hash key format: h{blockHash}
@Description: @param dbType @param blockHash @return []byte
func ConstructBlockIndexKey ¶
ConstructBlockIndexKey build block index key format: ib{blockNum}
@Description: @param dbType @param blockNum @return []byte
func ConstructBlockMetaIndexKey ¶
ConstructBlockMetaIndexKey build block meta index key
@Description: @param dbType @param blockNum @return []byte
func ConstructBlockNumKey ¶
ConstructBlockNumKey construct blockNum key format : n{blockNum}
@Description: @param dbType @param blockNum @return []byte
func ConstructBlockTxIDKey ¶
ConstructBlockTxIDKey construct block tx id key format : b{txID}
@Description: @param txID @return []byte
func ConstructFBTxIDBlockInfo ¶
func ConstructFBTxIDBlockInfo(height uint64, blockHash []byte, txIndex uint32, timestamp int64, blockFileIndex, txFileIndex *storePb.StoreInfo) []byte
ConstructFBTxIDBlockInfo marshal TransactionStoreInfo
@Description: @param height @param blockHash @param txIndex @param timestamp @param blockFileIndex @param txFileIndex @return []byte
func ConstructTxIDBlockInfo ¶
func ConstructTxIDBlockInfo(height uint64, blockHash []byte, txIndex uint32, timestamp int64) []byte
ConstructTxIDBlockInfo marshal TransactionStoreInfo
@Description: @param height @param blockHash @param txIndex @param timestamp @return []byte
func ConstructTxIDKey ¶
ConstructTxIDKey construct tx id key format : t{txId}
@Description: @param txId @return []byte
func DecodeBlockNum ¶
DecodeBlockNum varint decode
@Description: @param blockNumBytes @return uint64
func DecodeBlockNumKey ¶
DecodeBlockNumKey decode
@Description: @param dbType @param blkNumBytes @return uint64
func EncodeBlockNum ¶
EncodeBlockNum varint encode blockNum
@Description: @param blockNum @return []byte
func GetBlockByHeightKey ¶
func GetBlockByHeightKey(dbHandle protocol.DBHandle, cacheSC *cache.StoreCacheMgr, heightKey []byte, includeTxs bool, logger protocol.Logger, handleTx func(txId string, vBytes []byte, err error) (*commonPb.Transaction, error)) (*commonPb.Block, error)
GetBlockByHeightKey 根据区块高度Key获得区块信息和其中的交易信息
@Description: @receiver b @param heightKey @param includeTxs @return *commonPb.Block @return error
func GetFromCacheFirst ¶
func GetFromCacheFirst(key []byte, dbHandle protocol.DBHandle, cacheSC *cache.StoreCacheMgr, logger protocol.Logger) ([]byte, error)
GetFromCacheFirst first from cache;if not found,from db
@Description: @receiver b @param key @return []byte @return error
func HandleFDKVRWSet ¶
HandleFDKVRWSet retrieves a transaction rwSet by txId in file block archived config block's tx, or returns nil if none exists. this rwSet is moved to kvDB while archive before
@Description: @receiver b @param txId @return *commonPb.Transaction @return error
func HandleFDKVTx ¶
HandleFDKVTx retrieves a transaction by txId in file block archived config block's tx, or returns nil if none exists. this tx is moved to kvDB while archive before
@Description: @receiver b @return *commonPb.Transaction @return error
func ParseFBTxIdBlockInfo ¶
func ParseFBTxIdBlockInfo(value []byte) (height uint64, blockHash []byte, txIndex uint32, timestamp int64, txFileIndex *storePb.StoreInfo, err error)
ParseFBTxIdBlockInfo retrieve TransactionStoreInfo
@Description: @param value @return height @return blockHash @return txIndex @return timestamp @return txFileIndex @return err
func ParseTxIdBlockInfo ¶
func ParseTxIdBlockInfo(value []byte) (height uint64, blockHash []byte, txIndex uint32, timestamp int64, err error)
ParseTxIdBlockInfo return height,blockHash,txIndex,timestamp
@Description: @param value @return height @return blockHash @return txIndex @return timestamp @return err
Types ¶
This section is empty.