Documentation ¶
Index ¶
Constants ¶
View Source
const Max_Concurrent_Threads = 3
Variables ¶
This section is empty.
Functions ¶
func NewChecker ¶
func NewChecker(name string, logStorage DbLogStorage) *checker
func NewScanner ¶
func NewScanner(name string, addresses []common.Address, storage ScannerStorage, logStorage LogStorage, queryTopics [][]common.Hash) *scanner
Types ¶
type DbLogStorage ¶
type DbLogStorage interface { //保存日志 SaveLogs(ctx context.Context, name string, logs []types.Log) error //批量标记已处理 MarkAsProcessed(ctx context.Context, name string, ids []uint64) error QueryLogs(ctx context.Context, query LogQuery) (logs []Elog, err error) UpdateBlockCheckState(ctx context.Context, log Elog) error GetLogByElogId(ctx context.Context, txHash common.Hash, blockHash common.Hash, index uint) (log Elog, err error) }
type Elog ¶
type Elog struct { types.Log Id *uint64 `json:"id" ` // id ContractName string `json:"contractName" ` // 合约名 CheckState int `json:"checkState" ` // 链上状态: 0:待处理 10:已确认 20:确认异常 CheckedBlock uint64 `json:"checkedBlock" ` // 已确认区块 CreatedAt *gtime.Time `json:"createdAt" ` // 创建时间 UpdatedAt *gtime.Time `json:"updatedAt" ` // 更新时间 }
type LogQuery ¶
type LogQuery struct { IdGt *int64 `json:"idGt" ` // id大于 ContractName string `json:"contractName" ` // 合约名 ContractAddress string `json:"contractAddress" ` // 合约地址 TxHash string `json:"txHash" ` // 交易哈希 EventHash string `json:"eventHash" ` // 事件名 EventId *int64 `json:"eventId" ` // 事件id BlockNumber *int64 `json:"blockNumber" ` // 区块编号 CheckState *int `json:"checkState" ` // 链上状态: 0:待处理 10:已确认 20:确认异常 CheckStateList []int `json:"checkStateList" ` State *int `json:"state" ` // 链上状态: 0:待处理 10:已处理 StateList []int `json:"stateList" ` Limit int Desc bool OrderBy string }
type LogStorage ¶
type LogStorage interface { //保存日志 SaveLogs(ctx context.Context, name string, logs []types.Log) error }
日志存储器
Click to show internal directories.
Click to hide internal directories.