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 KeyPeriodicLock(namespace string) string
- func KeyPeriodicNotification(namespace string) string
- func KeyPeriodicPolicy(namespace string) string
- func KeyPeriodicPolicyScore(namespace string) string
- func MakeIdentifier() string
- func MakePeriodicPolicyUUID() (string, int64)
- func MakeUniquePeriodicID(name, spec string, epoch int64) string
- func NowEpochSeconds() int64
- 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 SetNowEpochSecondsMock(t int64)
- func TranslateRedisAddress(commaFormat string) (string, bool)
- 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 give 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 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 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