historysqldb

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package historysqldb package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountTxHistoryInfo

type AccountTxHistoryInfo struct {
	AccountId   []byte `gorm:"size:2048;primaryKey"` //primary key size max=3072
	BlockHeight uint64 `gorm:"primaryKey"`
	TxId        string `gorm:"size:128;primaryKey"`
}

AccountTxHistoryInfo defines mysql orm model, used to create mysql table 'account_tx_history_infos' @Description:

func (*AccountTxHistoryInfo) GetCountSql

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

GetCountSql 获得 总行数 @Description: @receiver b @return string @return []interface{}

func (*AccountTxHistoryInfo) GetCreateTableSql

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

GetCreateTableSql 获得 建表ddl语句 @Description: @receiver b @param dbType @return string

func (*AccountTxHistoryInfo) GetInsertSql

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

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

func (*AccountTxHistoryInfo) GetSaveSql added in v2.2.0

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

GetSaveSql 获得 replace into sql @Description: @receiver b @param _ @return string @return []interface{}

func (*AccountTxHistoryInfo) GetTableName

func (b *AccountTxHistoryInfo) GetTableName() string

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

func (*AccountTxHistoryInfo) GetUpdateSql

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

GetUpdateSql 获得 update sql @Description: @receiver b @return string @return []interface{}

type ContractTxHistoryInfo

type ContractTxHistoryInfo struct {
	ContractName string `gorm:"size:128;primaryKey"`
	BlockHeight  uint64 `gorm:"primaryKey"`
	TxId         string `gorm:"size:128;primaryKey"`
	AccountId    []byte `gorm:"size:2048"`
}

ContractTxHistoryInfo struct @Description:

func (*ContractTxHistoryInfo) GetCountSql

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

GetCountSql 获得 count语句 @Description: @receiver b @return string @return []interface{}

func (*ContractTxHistoryInfo) GetCreateTableSql

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

GetCreateTableSql 获得建表ddl语句 @Description: @receiver b @param dbType @return string

func (*ContractTxHistoryInfo) GetInsertSql

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

GetInsertSql 获得 insert 语句 @Description: @receiver b @param dbType @return string @return []interface{}

func (*ContractTxHistoryInfo) GetSaveSql added in v2.2.0

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

GetSaveSql 返回 replace into 语句 @Description: @receiver b @param _ @return string @return []interface{}

func (*ContractTxHistoryInfo) GetTableName

func (b *ContractTxHistoryInfo) GetTableName() string

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

func (*ContractTxHistoryInfo) GetUpdateSql

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

GetUpdateSql 获得更新sql语句 @Description: @receiver b @return string @return []interface{}

type HistorySqlDB

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

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

func NewHistorySqlDB

func NewHistorySqlDB(dbName string, config *conf.HistoryDbConfig, db protocol.SqlDBHandle,
	logger protocol.Logger) *HistorySqlDB

NewHistorySqlDB construct a new `HistoryDB` for given chainId @Description: @param dbName @param config @param db @param logger @return *HistorySqlDB

func (*HistorySqlDB) Close

func (h *HistorySqlDB) Close()

Close close db @Description: @receiver h

func (*HistorySqlDB) CommitBlock

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

CommitBlock save write key history、account tx history、contract tx history, accourding to config and update save point (block height) @Description: @receiver h @param blockInfo @param isCache @return error

func (*HistorySqlDB) GetAccountTxHistory

func (h *HistorySqlDB) GetAccountTxHistory(account []byte) (historydb.HistoryIterator, error)

GetAccountTxHistory construct an iterator, using data from account_tx_history_infos @Description: @receiver h @param account @return historydb.HistoryIterator @return error

func (*HistorySqlDB) GetContractTxHistory

func (h *HistorySqlDB) GetContractTxHistory(contractName string) (historydb.HistoryIterator, error)

GetContractTxHistory construct an iterator, using data from contract_tx_history_infos @Description: @receiver h @param contractName @return historydb.HistoryIterator @return error

func (*HistorySqlDB) GetHistoryForKey

func (h *HistorySqlDB) GetHistoryForKey(contractName string, key []byte) (historydb.HistoryIterator, error)

GetHistoryForKey construct an iterator, using data from state_history_infos @Description: @receiver h @param contractName @param key @return historydb.HistoryIterator @return error

func (*HistorySqlDB) GetLastSavepoint

func (s *HistorySqlDB) GetLastSavepoint() (uint64, error)

GetLastSavepoint query last save point (block height) @Description: @receiver s @return uint64 @return error

func (*HistorySqlDB) InitGenesis

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

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

type StateHistoryInfo

type StateHistoryInfo struct {
	ContractName string `gorm:"size:128;primaryKey"`
	StateKey     []byte `gorm:"size:128;primaryKey"`
	TxId         string `gorm:"size:128;primaryKey"`
	BlockHeight  uint64 `gorm:"primaryKey"`
}

StateHistoryInfo defines mysql orm model, used to create mysql table 'state_history_infos' @Description:

func NewStateHistoryInfo

func NewStateHistoryInfo(contractName, txid string, stateKey []byte, blockHeight uint64) *StateHistoryInfo

NewStateHistoryInfo construct a new HistoryInfo @Description: @param contractName @param txid @param stateKey @param blockHeight @return *StateHistoryInfo

func (*StateHistoryInfo) GetCountSql

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

GetCountSql 返回 总行数 @Description: @receiver b @return string @return []interface{}

func (*StateHistoryInfo) GetCreateTableSql

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

GetCreateTableSql 构造返回建表sql语句 @Description: @receiver b @param dbType @return string

func (*StateHistoryInfo) GetInsertSql

func (b *StateHistoryInfo) GetInsertSql(_ string) (string, []interface{})

GetInsertSql 返回insert sql @Description: @receiver b @param _ @return string @return []interface{}

func (*StateHistoryInfo) GetSaveSql added in v2.2.0

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

GetSaveSql 返回 replace into 语句 @Description: @receiver b @param _ @return string @return []interface{}

func (*StateHistoryInfo) GetTableName

func (b *StateHistoryInfo) GetTableName() string

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

func (*StateHistoryInfo) GetUpdateSql

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

GetUpdateSql 返回 update sql @Description: @receiver b @return string @return []interface{}

Jump to

Keyboard shortcuts

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