Documentation ¶
Index ¶
- type ResultInfo
- func (b *ResultInfo) GetCountSql() (string, []interface{})
- func (b *ResultInfo) GetCreateTableSql(dbType string) string
- func (b *ResultInfo) GetInsertSql(dbType string) (string, []interface{})
- func (b *ResultInfo) GetSaveSql(_ string) (string, []interface{})
- func (b *ResultInfo) GetTableName() string
- func (b *ResultInfo) GetUpdateSql() (string, []interface{})
- func (b *ResultInfo) ScanObject(scan func(dest ...interface{}) error) error
- type ResultSqlDB
- func (h *ResultSqlDB) Close()
- func (h *ResultSqlDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error
- func (s *ResultSqlDB) GetLastSavepoint() (uint64, error)
- func (h *ResultSqlDB) GetRWSetIndex(txId string) (*storePb.StoreInfo, error)
- func (h *ResultSqlDB) GetTxRWSet(txId string) (*commonPb.TxRWSet, error)
- func (s *ResultSqlDB) ImportSetSavePoint(height uint64) error
- func (h *ResultSqlDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
- func (h *ResultSqlDB) RestoreBlocks(blockInfos []*serialization.BlockWithSerializedInfo) error
- func (h *ResultSqlDB) ShrinkBlocks(txIdsMap map[uint64][]string) error
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 ¶
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 a 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 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 (s *ResultSqlDB) GetLastSavepoint() (uint64, error)
GetLastSavepoint get last save block height @Description: @receiver s @return uint64 @return error
func (*ResultSqlDB) GetRWSetIndex ¶
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) ImportSetSavePoint ¶
func (s *ResultSqlDB) ImportSetSavePoint(height uint64) error
ImportSetSavePoint set up savePoint when import snapshot @Description: @receiver h @param height @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) error
ShrinkBlocks archive old blocks rwsets in an atomic operation @Description: @receiver h @param txIdsMap @return error