Documentation ¶
Index ¶
- func Abs(n int) int
- func Abs64(n int64) int64
- func AssignWorkers(nodeCount, workerCount, limit int) []int
- func CanSchedule(ipList []string, hostname, ip string) bool
- func ContainsTaskItem(arr []definition.TaskItem, itemId string) bool
- func CronDelay(begin cron.Schedule, end cron.Schedule) time.Duration
- func Delay(target DelaySupport, duration time.Duration)
- func Dereference(v interface{}) interface{}
- func FetchLeader(uuids []string) string
- func GenerateUUID(sequence uint64) string
- func GenerateUUIDPrefix() string
- func GetHostIPv4() string
- func GetHostName() string
- func IsLeader(uuids []string, uuid string) bool
- func Max(i, j int) int
- func Max64(i, j int64) int64
- func Min(i, j int) int
- func Min64(i, j int64) int64
- func OwnSign(strategyId string) string
- func ParseStrategyCron(strategy *definition.Strategy) (cron.Schedule, cron.Schedule)
- func RemoveTaskItem(arr []definition.TaskItem, itemId string) []definition.TaskItem
- func SortRuntimesWithShuffle(runtimes []*definition.StrategyRuntime)
- func SortSchedulers(schedulers []*definition.Scheduler)
- func SortStrategyRuntimes(strategyRuntimes []*definition.StrategyRuntime)
- func SortTaskAssignments(TaskAssignments []*definition.TaskAssignment)
- func SortTaskRuntimes(taskRuntimes []*definition.TaskRuntime)
- func TypeName(obj interface{}) string
- type DelaySupport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignWorkers ¶
AssignWorkers assigns workers between nodes and limit maximum per node.
limit = 0 indicates no limit at all
func CanSchedule ¶
CanSchedule returns whether current scheduler can join into the specified strategy (based on its iplist)
ipList is the range that can be scheduled on including hostnames and ip addresses hostname indicates current node's hostname ip indicates current node's ip address
func ContainsTaskItem ¶
func ContainsTaskItem(arr []definition.TaskItem, itemId string) bool
ContainsTaskItem returns whether specific itemId existed in slice
func CronDelay ¶
CronDelay add suitable delay according to cron settings
when only beginning is set: -----------b-------------b-------------b------------- |------->| when both beginning and ending are set: b=====e------b=====e--------b=====e--------b=====e--- |==| |-->|=====| |=====| |=====|
func Delay ¶
func Delay(target DelaySupport, duration time.Duration)
delay guarantees an imprecision delay function
func Dereference ¶
func Dereference(v interface{}) interface{}
Dereference returns the value relied behind the given pointer
func FetchLeader ¶
FetchLeader returns the uuid of leader in the array
func GenerateUUID ¶
func GenerateUUIDPrefix ¶
func GenerateUUIDPrefix() string
GenerateUUIDPrefix is used to generate the prefix of uuid
func GetHostIPv4 ¶
func GetHostIPv4() string
GetHostIPv4 returns localhost's ip in ipv4. If failed return "127.0.0.1" It's suggested that the hostname is resolved to the correct address.
func GetHostName ¶
func GetHostName() string
GetHostName returns localhost's hostname. Return "localhost" for fallback
func ParseStrategyCron ¶
func ParseStrategyCron(strategy *definition.Strategy) (cron.Schedule, cron.Schedule)
ParseStrategyCron parse cron expressions of begin and end from given strategy
func RemoveTaskItem ¶
func RemoveTaskItem(arr []definition.TaskItem, itemId string) []definition.TaskItem
RemoveTaskItem remove specific task item from slice
func SortRuntimesWithShuffle ¶
func SortRuntimesWithShuffle(runtimes []*definition.StrategyRuntime)
SortRuntimes sort the runtimes based on requestedNum in descending order
A shuffle will be made between same num for better ditribution of workers
func SortSchedulers ¶
func SortSchedulers(schedulers []*definition.Scheduler)
func SortStrategyRuntimes ¶
func SortStrategyRuntimes(strategyRuntimes []*definition.StrategyRuntime)
func SortTaskAssignments ¶
func SortTaskAssignments(TaskAssignments []*definition.TaskAssignment)
func SortTaskRuntimes ¶
func SortTaskRuntimes(taskRuntimes []*definition.TaskRuntime)
Types ¶
type DelaySupport ¶
type DelaySupport interface {
NeedStop() bool
}