Documentation ¶
Index ¶
- Constants
- type ContractEventSqlDB
- func (c *ContractEventSqlDB) Close()
- func (c *ContractEventSqlDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, _ bool) error
- func (c *ContractEventSqlDB) GetDumpDir() string
- func (c *ContractEventSqlDB) GetLastSavepoint() (uint64, error)
- func (c *ContractEventSqlDB) GetSnapshotFile() (string, error)
- func (c *ContractEventSqlDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
Constants ¶
View Source
const ( CreateBlockHeightWithTopicTableDdl string = `` /* 289-byte string literal not displayed */ BlockHeightWithTopicTableName string = `block_height_topic_table_index` CreateBlockHeightIndexTableDdl string = `` /* 165-byte string literal not displayed */ InitBlockHeightIndexTableDdl string = `INSERT IGNORE INTO block_height_index (id,block_height) VALUES('1','0')` BlockHeightIndexTableName string = `block_height_index` )
nolint
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContractEventSqlDB ¶
type ContractEventSqlDB struct { Logger protocol.Logger // contains filtered or unexported fields }
BlockMysqlDB provider a implementation of `contracteventdb.ContractEventDB` This implementation provides a mysql based data model
func NewContractEventDB ¶
func NewContractEventDB(dbName string, db protocol.SqlDBHandle, logger protocol.Logger, storeConfig *conf.StorageConfig, chainId string) (*ContractEventSqlDB, error)
NewContractEventMysqlDB construct a new `ContractEventDB` for given chainId
func NewContractEventMysqlDB(chainId string, db protocol.SqlDBHandle, logger protocol.Logger) (*ContractEventSqlDB, error) { dbName := getDbName(sqlDbConfig, chainId) db := rawsqlprovider.NewSqlDBHandle(dbName, sqlDbConfig, logger) return newContractEventDB(dbName, db, logger) }
创建一个 ContractDB
func (*ContractEventSqlDB) Close ¶
func (c *ContractEventSqlDB) Close()
Close is used to close database, there is no need for gorm to close db
@Description: @receiver c
func (*ContractEventSqlDB) CommitBlock ¶
func (c *ContractEventSqlDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, _ bool) error
CommitBlock commits the event in an atomic operation
@Description: @receiver c @param blockInfo @param IsCache @return error
func (*ContractEventSqlDB) GetDumpDir ¶
func (c *ContractEventSqlDB) GetDumpDir() string
GetSnapshotFile create a eventdb sql snapshot file
func (*ContractEventSqlDB) GetLastSavepoint ¶
func (c *ContractEventSqlDB) GetLastSavepoint() (uint64, error)
GetLastSavepoint returns the last block height
func (*ContractEventSqlDB) GetSnapshotFile ¶
func (c *ContractEventSqlDB) GetSnapshotFile() (string, error)
GetSnapshotFile create a eventdb sql snapshot file
func (*ContractEventSqlDB) InitGenesis ¶
func (c *ContractEventSqlDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
InitGenesis 完成创世区块的写入
@Description: @receiver c @param genesisBlock @return error
Click to show internal directories.
Click to hide internal directories.