Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { NewTaskHandler(timeout time.Duration, retryDelay time.Duration, t Task) TaskHandler WaitForTasks() }
Manager describtes the basic functionality of a task Manager
type ManagerDetails ¶
type ManagerDetails struct {
// contains filtered or unexported fields
}
ManagerDetails contains information required for implmentation of task Manager
func (*ManagerDetails) NewTaskHandler ¶
func (md *ManagerDetails) NewTaskHandler( timeout time.Duration, retryDelay time.Duration, task Task) TaskHandler
NewTaskHandler creates a new task handler, where each phase can take upto 'timeout' duration and there is a delay of 'retryDelay' before a retry.
func (*ManagerDetails) WaitForTasks ¶
func (md *ManagerDetails) WaitForTasks()
WaitForTasks blocks until all tasks associated withis Manager have completed
type SnapshotTask ¶
SnapshotTask pushes a snapshot to Ethereum
func NewSnapshotTask ¶
func NewSnapshotTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account, epoch *big.Int, rawBclaims []byte, rawSigGroup []byte) *SnapshotTask
NewSnapshotTask creates a new task
func (*SnapshotTask) DoDone ¶
func (t *SnapshotTask) DoDone()
DoDone creates a log entry saying task is complete
func (*SnapshotTask) DoRetry ¶
func (t *SnapshotTask) DoRetry(ctx context.Context) bool
DoRetry is subsequent attempts at distributing shares via ethdkg
func (*SnapshotTask) DoWork ¶
func (t *SnapshotTask) DoWork(ctx context.Context) bool
DoWork is the first attempt at distributing shares via ethdkg
func (*SnapshotTask) ShouldRetry ¶
func (t *SnapshotTask) ShouldRetry(ctx context.Context) bool
ShouldRetry checks if it makes sense to try again
type Task ¶
type Task interface { DoDone() DoRetry(context.Context) bool DoWork(context.Context) bool ShouldRetry(context.Context) bool }
Task the interface requirements of a task
type TaskDoFunc ¶
TaskDoFunc is shorthand for func(context.Context) bool, which is what the Do*() task functions are -- Return value indicates if task work has completed succesfully
type TaskDoneFunc ¶
type TaskDoneFunc func()
TaskDoneFunc is shorthand for func() bool, which is the DoDone() type -- This is executed as a cleanup, so can't be canceled
type TaskHandler ¶
TaskHandler required functionality of a task
type TaskHandlerDetails ¶
type TaskHandlerDetails struct { ID int // contains filtered or unexported fields }
TaskHandlerDetails contains all the data required to implment a task
func (*TaskHandlerDetails) Cancel ¶
func (td *TaskHandlerDetails) Cancel()
Cancel stops the task's goroutine
func (*TaskHandlerDetails) Complete ¶
func (td *TaskHandlerDetails) Complete() bool
Complete returns indication of whether has completed
func (*TaskHandlerDetails) Start ¶
func (td *TaskHandlerDetails) Start()
Start begins orchestrating the task in a goroutine
func (*TaskHandlerDetails) Successful ¶
func (td *TaskHandlerDetails) Successful() bool
Successful returns indication of whether the task was eventually successful
type TaskShouldFunc ¶
TaskShouldFunc is shorthand for func(context.Context) bool, which is the ShouldRetry() type