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 ContextDone(ctx context.Context) bool
- func CronDelay(begin cron.Schedule, end cron.Schedule) time.Duration
- func DelayContext(ctx context.Context, duration time.Duration) bool
- 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 LoopContext(ctx context.Context, interval time.Duration, loopFn, cleanupFn func())
- 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 TraceData
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 ContextDone ¶ added in v1.0.0
ContextDone returns true if the given context is done
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 DelayContext ¶ added in v1.0.0
DelayContext try to wait and return true if normally completed.
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 LoopContext ¶ added in v1.0.0
LoopContext is used to execute a func with fixed interval.
The cleanupFn will be invoked when the loop ends
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)