-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrage task worker types to new package
- Loading branch information
1 parent
eecc06a
commit 2d1cfe3
Showing
6 changed files
with
55 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package types | ||
|
||
import "github.com/jasonjoo2010/goschedule/definition" | ||
|
||
// TaskBase defines the task used in scheduling. | ||
type TaskBase interface { | ||
// Select returns tasks to be dealed later. | ||
// It will be guaranteed in serial model. | ||
// parameter, items, eachFetchNum are from definition of task | ||
// ownSign is from name of strategy bond in the form of 'name$ownsign' | ||
// It's a kind of relation to strategy but generally task doesn't care about strategy in user's view. | ||
Select(parameter, ownSign string, items []definition.TaskItem, eachFetchNum int) []interface{} | ||
} | ||
|
||
// TaskSingle represents one task one time(routine) model | ||
type TaskSingle interface { | ||
TaskBase | ||
// return true if succ false otherwise, but things will still go on | ||
Execute(task interface{}, ownSign string) bool | ||
} | ||
|
||
// TaskBatch represents multiple tasks one time(routine) model | ||
type TaskBatch interface { | ||
TaskBase | ||
// return true if succ false otherwise, but things will still go on | ||
Execute(tasks []interface{}, ownSign string) bool | ||
} | ||
|
||
type TaskComparable interface { | ||
Less(a, b interface{}) bool | ||
} |