Documentation ¶
Overview ¶
Package utils provides reusable and sharable utilities for other packages and components.
Index ¶
- func DeSerializeJob(jobBytes []byte) (*work.Job, error)
- func DirExists(path string) bool
- func FileExists(file string) bool
- func IsEmptyStr(str string) bool
- func IsValidPort(port uint) bool
- func IsValidURL(address string) bool
- func KeyJobCtlCommands(namespace string, jobID string) string
- func KeyJobStats(namespace string, jobID string) string
- func KeyNamespacePrefix(namespace string) string
- func KeyPeriod(namespace string) string
- func KeyPeriodicJobTimeSlots(namespace string) string
- func KeyPeriodicLock(namespace string) string
- func KeyPeriodicNotification(namespace string) string
- func KeyPeriodicPolicy(namespace string) string
- func KeyPeriodicPolicyScore(namespace string) string
- func KeyUpstreamJobAndExecutions(namespace, upstreamJobID string) string
- func MakeIdentifier() string
- func MakePeriodicPolicyUUID() (string, int64)
- func MakeUniquePeriodicID(name, spec string, epoch int64) string
- func ReadEnv(key string) string
- func RedisKeyDead(namespace string) string
- func RedisKeyLastPeriodicEnqueue(namespace string) string
- func RedisKeyScheduled(namespace string) string
- func RedisNamespacePrefix(namespace string) string
- func SerializeJob(job *work.Job) ([]byte, error)
- func TranslateRedisAddress(commaFormat string) (string, bool)
- type CtlContextKey
- type JobScore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeSerializeJob ¶
DeSerializeJob decodes bytes to ptr of work.Job.
func IsEmptyStr ¶
IsEmptyStr check if the specified str is empty (len ==0) after triming prefix and suffix spaces.
func IsValidURL ¶
IsValidURL validates if the url is well-formted
func KeyJobCtlCommands ¶
KeyJobCtlCommands returns the key for publishing ctl commands like 'stop' etc.
func KeyJobStats ¶
KeyJobStats returns the key of job stats
func KeyNamespacePrefix ¶
KeyNamespacePrefix returns the based key based on the namespace.
func KeyPeriodicJobTimeSlots ¶
KeyPeriodicJobTimeSlots returns the key of the time slots of scheduled jobs.
func KeyPeriodicLock ¶
KeyPeriodicLock returns the key of locker under period
func KeyPeriodicNotification ¶
KeyPeriodicNotification returns the key of periodic pub/sub channel.
func KeyPeriodicPolicy ¶
KeyPeriodicPolicy returns the key of periodic policies.
func KeyPeriodicPolicyScore ¶
KeyPeriodicPolicyScore returns the key of policy key and score mapping.
func KeyUpstreamJobAndExecutions ¶
KeyUpstreamJobAndExecutions returns the key for persisting executions.
func MakePeriodicPolicyUUID ¶
MakePeriodicPolicyUUID returns an UUID for the periodic policy.
func MakeUniquePeriodicID ¶
MakeUniquePeriodicID creates id for the periodic job.
func RedisKeyDead ¶
RedisKeyDead returns key of the dead jobs.
func RedisKeyLastPeriodicEnqueue ¶
RedisKeyLastPeriodicEnqueue returns key of timestamp if last periodic enqueue.
func RedisKeyScheduled ¶
RedisKeyScheduled returns key of scheduled job.
func RedisNamespacePrefix ¶
RedisNamespacePrefix ... Same with 'KeyNamespacePrefix', only for compatibility.
func SerializeJob ¶
SerializeJob encodes work.Job to json data.
func TranslateRedisAddress ¶
TranslateRedisAddress translates the comma format to redis URL
Types ¶
type CtlContextKey ¶
type CtlContextKey string
CtlContextKey is used to keep controller reference in the system context
const ( // CtlKeyOfLaunchJobFunc is context key to keep the ctl launch job func CtlKeyOfLaunchJobFunc CtlContextKey = "controller_launch_job_func" )