Documentation ¶
Index ¶
- Constants
- func GetScheduleHostApi() (types.ScheduleHostApi, error)
- func NewScheduleHost() types.ScheduleHostApi
- func NewScheduleManager(store types.AspectStore, ...) error
- func NewTaskManager(height int64, nonce uint64, chainId string) error
- func ScheduleIdKey(scheduleId *types.ScheduleId) []byte
- func ScheduleViewKey(status int64) []byte
- type ScheduleManager
- func (manager *ScheduleManager) CheckClose(schedule *types.Schedule) error
- func (manager *ScheduleManager) ClearScheduleTry(id *types.ScheduleId) error
- func (manager *ScheduleManager) Close(scheduleId *types.ScheduleId) error
- func (manager *ScheduleManager) DeleteScheduleView(status uint32, scheduleId *types.ScheduleId) error
- func (manager ScheduleManager) GetActiveSchedule() []*types.Schedule
- func (manager *ScheduleManager) GetSchedule(req *types.ScheduleId) (*types.Schedule, error)
- func (manager *ScheduleManager) GetScheduleExecResult(id *types.ScheduleId) (*types.TaskResult, error)
- func (manager *ScheduleManager) GetScheduleTry(id *types.ScheduleId) (*types.TryTask, error)
- func (manager *ScheduleManager) GetScheduleView(status int32) ([]*types.ScheduleId, error)
- func (manager *ScheduleManager) Query(status types.ScheduleStatus) ([]*types.Schedule, error)
- func (manager *ScheduleManager) StoreSchedule(req *types.Schedule) error
- func (manager *ScheduleManager) StoreScheduleExecResult(id *types.ScheduleId, blockHeight int64, txHash string) error
- func (manager *ScheduleManager) StoreScheduleTry(id *types.ScheduleId, needTry bool, blockHeight int64, txHash string) error
- func (manager *ScheduleManager) StoreScheduleView(req *types.Schedule) error
- func (manager *ScheduleManager) Submit(req *types.Schedule) error
- func (manager *ScheduleManager) WrapTransition(tx *types.EthTransaction) (common.Hash, []byte, error)
- type TaskManager
- func (task *TaskManager) Check() ([][]byte, error)
- func (task *TaskManager) Confirm(txs [][]byte) ([][]byte, error)
- func (task *TaskManager) GetFromAddr(hash common.Hash) string
- func (task *TaskManager) GetTxs() [][]byte
- func (task *TaskManager) IsScheduleTx(hash common.Hash) bool
- func (task *TaskManager) Remove(tx []byte) error
- type TxKey
Constants ¶
View Source
const ( ScheduleViewKeyPrefix = "Schedule/View/" ScheduleKeyPrefix = "Schedule/Data/" ScheduleRetryKeyPrefix = "Schedule/Retry/" ScheduleExecResultKeyPrefix = "Schedule/ExecResult/" )
View Source
const TxKeySize = sha256.Size
TxKeySize TxKey is same with the hash defined in cometbft
Variables ¶
This section is empty.
Functions ¶
func GetScheduleHostApi ¶
func GetScheduleHostApi() (types.ScheduleHostApi, error)
func NewScheduleHost ¶
func NewScheduleHost() types.ScheduleHostApi
func NewScheduleManager ¶
func NewScheduleManager(store types.AspectStore, wrapTx func(tx *types.EthTransaction) (common.Hash, []byte, error)) error
func ScheduleIdKey ¶
func ScheduleIdKey( scheduleId *types.ScheduleId, ) []byte
func ScheduleViewKey ¶
Types ¶
type ScheduleManager ¶
type ScheduleManager struct { Store types.AspectStore // cache schedule Pool []*types.Schedule WrapTx func(tx *types.EthTransaction) (common.Hash, []byte, error) }
func ScheduleManagerInstance ¶
func ScheduleManagerInstance() *ScheduleManager
func (*ScheduleManager) CheckClose ¶
func (manager *ScheduleManager) CheckClose(schedule *types.Schedule) error
func (*ScheduleManager) ClearScheduleTry ¶
func (manager *ScheduleManager) ClearScheduleTry(id *types.ScheduleId) error
func (*ScheduleManager) Close ¶
func (manager *ScheduleManager) Close(scheduleId *types.ScheduleId) error
func (*ScheduleManager) DeleteScheduleView ¶
func (manager *ScheduleManager) DeleteScheduleView(status uint32, scheduleId *types.ScheduleId) error
func (ScheduleManager) GetActiveSchedule ¶
func (manager ScheduleManager) GetActiveSchedule() []*types.Schedule
begin block call
func (*ScheduleManager) GetSchedule ¶
func (manager *ScheduleManager) GetSchedule(req *types.ScheduleId) (*types.Schedule, error)
func (*ScheduleManager) GetScheduleExecResult ¶
func (manager *ScheduleManager) GetScheduleExecResult(id *types.ScheduleId) (*types.TaskResult, error)
func (*ScheduleManager) GetScheduleTry ¶
func (manager *ScheduleManager) GetScheduleTry(id *types.ScheduleId) (*types.TryTask, error)
func (*ScheduleManager) GetScheduleView ¶
func (manager *ScheduleManager) GetScheduleView(status int32) ([]*types.ScheduleId, error)
func (*ScheduleManager) Query ¶
func (manager *ScheduleManager) Query(status types.ScheduleStatus) ([]*types.Schedule, error)
func (*ScheduleManager) StoreSchedule ¶
func (manager *ScheduleManager) StoreSchedule(req *types.Schedule) error
* 1、 key: "Schedule"+ Status , Value: [id,id,id...] 2、 key: id , Value: Schedule bytes 3、 key: id , {ConfimTxs:[{blockheight,txhash},{blockheight,"F"}..], count: 2} // message TaskResult 4、 key: id , needRetry: false ,taskTx:[{blockheight,txhash},{blockheight,txhash}..] // message TryTask
func (*ScheduleManager) StoreScheduleExecResult ¶
func (manager *ScheduleManager) StoreScheduleExecResult(id *types.ScheduleId, blockHeight int64, txHash string) error
func (*ScheduleManager) StoreScheduleTry ¶
func (manager *ScheduleManager) StoreScheduleTry(id *types.ScheduleId, needTry bool, blockHeight int64, txHash string) error
func (*ScheduleManager) StoreScheduleView ¶
func (manager *ScheduleManager) StoreScheduleView(req *types.Schedule) error
func (*ScheduleManager) WrapTransition ¶
func (manager *ScheduleManager) WrapTransition(tx *types.EthTransaction) (common.Hash, []byte, error)
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
func TaskInstance ¶
func TaskInstance() *TaskManager
TODO, need a better way call to schedule in cometbft.
func (*TaskManager) Check ¶
func (task *TaskManager) Check() ([][]byte, error)
func (*TaskManager) Confirm ¶
func (task *TaskManager) Confirm(txs [][]byte) ([][]byte, error)
Confirm return left tx
func (*TaskManager) GetFromAddr ¶
func (task *TaskManager) GetFromAddr(hash common.Hash) string
func (*TaskManager) GetTxs ¶
func (task *TaskManager) GetTxs() [][]byte
GetTxs return the scheduled transactions
func (*TaskManager) IsScheduleTx ¶
func (task *TaskManager) IsScheduleTx(hash common.Hash) bool
GetTxs return the scheduled transactions
func (*TaskManager) Remove ¶
func (task *TaskManager) Remove(tx []byte) error
Click to show internal directories.
Click to hide internal directories.