新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit a9be49f1 authored by 厚发 周's avatar 厚发 周

feat: add get block log

    ----story=1012853
No related merge requests found
......@@ -54,7 +54,7 @@ type BinLogger interface {
// @return err
Write(index uint64, data []byte) (fileName string, offset, blkLen uint64, err error)
// ReadFileSection read data,according to file index
// ReadFileSection read data, according to file index
// @Description:
// @param fiIndex
// @param timeOut
......
......@@ -909,6 +909,7 @@ func (l *BlockFile) doReadFileSection(fiIndex *storePb.StoreInfo) ([]byte, error
path = l.segmentPathWithENDSuffix(fiIndex.FileName)
}
l.logger.Debugf("read file section, path: %s, offset: %d, dataLen: %d", path, fiIndex.Offset, fiIndex.ByteLen)
lfile, err := l.openReadFileWithTimeOut(path, time.Second)
if err != nil {
return nil, err
......
......@@ -680,6 +680,7 @@ func (b *BlockFileDB) GetTxConfirmedTime(txId string) (int64, error) {
// @return *storePb.StoreInfo
// @return error
func (b *BlockFileDB) GetBlockIndex(height uint64) (*storePb.StoreInfo, error) {
b.logger.Debugf("get block[%d] index", height)
blockIndexByte, err := b.get(constructBlockIndexKey(b.dbHandle.GetDbType(), height))
if err != nil {
return nil, err
......@@ -687,7 +688,11 @@ func (b *BlockFileDB) GetBlockIndex(height uint64) (*storePb.StoreInfo, error) {
if blockIndexByte == nil {
return nil, nil
}
return su.DecodeValueToIndex(blockIndexByte)
vIndex, err1 := su.DecodeValueToIndex(blockIndexByte)
if err1 == nil {
b.logger.Debugf("get block[%d] index: %s", height, vIndex.String())
}
return vIndex, err1
}
// GetBlockMeta add next time
......@@ -723,6 +728,7 @@ func (b *BlockFileDB) GetBlockMeta(height uint64) (*storePb.SerializedBlock, err
// @return *storePb.StoreInfo
// @return error
func (b *BlockFileDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, error) {
b.logger.Debugf("get block[%d] meta index", height)
index, err := b.get(constructBlockMetaIndexKey(b.dbHandle.GetDbType(), height))
if err != nil {
return nil, err
......@@ -730,7 +736,11 @@ func (b *BlockFileDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, erro
if index == nil {
return nil, nil
}
return su.DecodeValueToIndex(index)
vIndex, err1 := su.DecodeValueToIndex(index)
if err1 == nil {
b.logger.Debugf("get block[%d] meta index: %s", height, vIndex.String())
}
return vIndex, err1
}
// GetTxIndex returns the offset of the transaction in the rfile
......@@ -740,6 +750,7 @@ func (b *BlockFileDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, erro
// @return *storePb.StoreInfo
// @return error
func (b *BlockFileDB) GetTxIndex(txId string) (*storePb.StoreInfo, error) {
b.logger.Debugf("get rwset txId: %s", txId)
txIDBlockInfoBytes, err := b.get(constructBlockTxIDKey(txId))
if err != nil {
return nil, err
......
......@@ -181,6 +181,7 @@ func getBadgerConfig(path string) *conf.StorageConfig {
conf1.StorePath = filepath.Join(os.TempDir(), fmt.Sprintf("%d_wal", time.Now().Nanosecond()))
return conf1
}
func getlvldbConfig(path string) *conf.StorageConfig {
conf1, _ := conf.NewStorageConfig(nil)
if path == "" {
......
......@@ -184,12 +184,17 @@ func (h *ResultFileDB) GetTxRWSet(txId string) (*commonPb.TxRWSet, error) {
// @return error
func (h *ResultFileDB) GetRWSetIndex(txId string) (*storePb.StoreInfo, error) {
// GetRWSetIndex returns the offset of the block in the file
h.logger.Debugf("get rwset txId: %s", txId)
index, err := h.get(constructTxRWSetIndexKey(txId))
if err != nil {
return nil, err
}
return su.DecodeValueToIndex(index)
vIndex, err1 := su.DecodeValueToIndex(index)
if err1 == nil {
h.logger.Debugf("get rwset txId: %s, index: %s", txId, vIndex.String())
}
return vIndex, err1
}
// GetLastSavepoint returns the last block height
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment