resultsqldb

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResultInfo

type ResultInfo struct {
	TxId        string `gorm:"size:128;primaryKey"`
	BlockHeight uint64
	TxIndex     uint32
	Rwset       []byte `gorm:"type:longblob"`
	Status      int    `gorm:"default:0"`
	Result      []byte `gorm:"type:blob"`
	Message     string `gorm:"type:longtext"`
}

ResultInfo defines mysql orm model, used to create mysql table 'result_infos' @Description:

func NewResultInfo

func NewResultInfo(txId string, blockHeight uint64, txIndex uint32, result *commonpb.ContractResult,
	rw *commonpb.TxRWSet) *ResultInfo

NewResultInfo construct a new HistoryInfo @Description: @param txId @param blockHeight @param txIndex @param result @param rw @return *ResultInfo

func (*ResultInfo) GetCountSql

func (b *ResultInfo) GetCountSql() (string, []interface{})

GetCountSql return count sql sentence use primary key (tx_id) @Description: @receiver b @return string @return []interface{}

func (*ResultInfo) GetCreateTableSql

func (b *ResultInfo) GetCreateTableSql(dbType string) string

GetCreateTableSql return create table sql (mysql for production,sqlite for test) @Description: @receiver b @param dbType @return string

func (*ResultInfo) GetInsertSql

func (b *ResultInfo) GetInsertSql(dbType string) (string, []interface{})

GetInsertSql insert sql sentence @Description: @receiver b @param dbType @return string @return []interface{}

func (*ResultInfo) GetSaveSql added in v2.2.0

func (b *ResultInfo) GetSaveSql(_ string) (string, []interface{})

GetSaveSql return replace save sql sentence @Description: @receiver b @param _ @return string @return []interface{}

func (*ResultInfo) GetTableName

func (b *ResultInfo) GetTableName() string

GetTableName 获得表的名字 @Description: @receiver b @return string

func (*ResultInfo) GetUpdateSql

func (b *ResultInfo) GetUpdateSql() (string, []interface{})

GetUpdateSql update sql sentence use primary key (tx_id) @Description: @receiver b @return string @return []interface{}

func (*ResultInfo) ScanObject

func (b *ResultInfo) ScanObject(scan func(dest ...interface{}) error) error

ScanObject scan data from db @Description: @receiver b @param scan @return error

type ResultSqlDB

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

ResultSqlDB provider an implementation of `history.HistoryDB` @Description: This implementation provides a mysql based data model

func NewResultSqlDB

func NewResultSqlDB(dbName string, db protocol.SqlDBHandle, logger protocol.Logger) *ResultSqlDB

NewResultSqlDB construct ResultSqlDB @Description: @param dbName @param db @param logger @return *ResultSqlDB

func (*ResultSqlDB) Close

func (h *ResultSqlDB) Close()

Close db connection @Description: @receiver h

func (*ResultSqlDB) CommitBlock

func (h *ResultSqlDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error

CommitBlock save block result info @Description: @receiver h @param blockInfo @param isCache @return error

func (*ResultSqlDB) GetLastSavepoint

func (h *ResultSqlDB) GetLastSavepoint() (uint64, error)

GetLastSavepoint get last save block height @Description: @receiver s @return uint64 @return error

func (*ResultSqlDB) GetRWSetIndex added in v2.2.0

func (h *ResultSqlDB) GetRWSetIndex(txId string) (*storePb.StoreInfo, error)

GetRWSetIndex returns the offset of the block in the file @Description: @receiver h @param txId @return *storePb.StoreInfo @return error

func (*ResultSqlDB) GetTxRWSet

func (h *ResultSqlDB) GetTxRWSet(txId string) (*commonPb.TxRWSet, error)

GetTxRWSet query TxRWSet from result_infos, according to txId @Description: @receiver h @param txId @return *commonPb.TxRWSet @return error

func (*ResultSqlDB) InitGenesis

func (h *ResultSqlDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error

InitGenesis init genesis block @Description: @receiver h @param genesisBlock @return error

func (*ResultSqlDB) RestoreBlocks

func (h *ResultSqlDB) RestoreBlocks(blockInfos []*serialization.BlockWithSerializedInfo) error

RestoreBlocks restore blocks from outside serialized block data @Description: @receiver h @param blockInfos @return error

func (*ResultSqlDB) ShrinkBlocks

func (h *ResultSqlDB) ShrinkBlocks(txIdsMap map[uint64][]string, height uint64, bfdbPath string) error

ShrinkBlocks archive old blocks rwsets in an atomic operation @Description: @receiver h @param txIdsMap @return error

Jump to

Keyboard shortcuts

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