Executor
The Executor API provides an interface for defining your own task executor:
type customExecutor int {}
func (exe *customExecutor) Execute(sources map[int]*task.Task) (map[int]*task.Task, error) {
// do whatever
}
func (exe *customExecutor) Todo(todo func(sources map[int]*task.Task) (map[int]*task.Task, error)) {
// do whatever
}
func (exe *customExecutor) Type(t ...string) string {
return "Custom"
}
To register your own executor, simply go:
collaborate.Set("Executor", customExecutor, "custom_signature")
The function todo
will be called while the store
is processing tasks with your custom executor.