task

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DayFormat  = "20060102"
	TimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockChainInterface

type BlockChainInterface interface {
	GetLatestBlockNumber() (int64, error)
	CreateNodeTask(nodeId string, blockChain int64, number string) (*NodeTask, error)
}

type BlockNumber

type BlockNumber struct {
	Id           int64     `json:"id" gorm:"column:id"`
	ChainCode    int64     `json:"chain_code" gorm:"column:chain_code"`       // 公链代码
	RecentNumber int64     `json:"recent_number" gorm:"column:recent_number"` // 已处理的高度
	LatestNumber int64     `json:"latest_number" gorm:"column:latest_number"` // 区块链的最新高度
	LogTime      time.Time `json:"log_time" gorm:"column:log_time"`
}

type NodeTask

type NodeTask struct {
	Id          int64     `json:"id"  gorm:"column:id"`
	NodeId      string    `json:"nodeId" gorm:"column:node_id"`
	BlockNumber string    `json:"blockNumber" gorm:"column:block_number"`
	BlockHash   string    `json:"blockHash" gorm:"column:block_hash"`
	TxHash      string    `json:"txHash" gorm:"column:tx_hash"`
	TaskType    int       `json:"taskType" gorm:"column:task_type"` // 0:保留 1:同步Tx. 2:同步Block 3:同步Receipt
	BlockChain  int64     `json:"blockChain" gorm:"column:block_chain"`
	TaskStatus  int       `json:"taskStatus" gorm:"column:task_status"` //0: 初始 1: 成功. 2: 失败.  3: 执行中 其他:重试次数
	CreateTime  time.Time `json:"createTime" gorm:"column:create_time"`
	LogTime     time.Time `json:"logTime" gorm:"column:log_time"`
}

type Process

type Process interface {
	Start(ctx context.Context)
}

type StoreTaskInterface

type StoreTaskInterface interface {
	ToKafkaMessage(list []*NodeTask) ([]*kafka.Message, error)
	UpdateLastNumber(blockChainCode int64, latestNumber int64) error
	UpdateRecentNumber(blockChainCode int64, recentNumber int64) error
	GetRecentNumber(blockCode int64) (int64, int64, error)
	GetNodeId(blockChainCode int64) ([]string, error)
	GetAndDelNodeId(blockChainCode int64) ([]string, error)
}

Jump to

Keyboard shortcuts

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