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 ¶ added in v1.5.0
DeSerializeJob decodes bytes to ptr of work.Job.
func FileExists ¶ added in v1.5.0
FileExists check if the specified exists.
func IsEmptyStr ¶ added in v1.5.0
IsEmptyStr check if the specified str is empty (len ==0) after triming prefix and suffix spaces.
func IsValidPort ¶ added in v1.5.0
IsValidPort check if port is valid.
func IsValidURL ¶ added in v1.5.0
IsValidURL validates if the url is well-formted
func KeyJobCtlCommands ¶ added in v1.5.0
KeyJobCtlCommands give the key for publishing ctl commands like 'stop' etc.
func KeyJobStats ¶ added in v1.5.0
KeyJobStats returns the key of job stats
func KeyNamespacePrefix ¶ added in v1.5.0
KeyNamespacePrefix returns the based key based on the namespace.
func KeyPeriodicLock ¶ added in v1.5.0
KeyPeriodicLock returns the key of locker under period
func KeyPeriodicNotification ¶ added in v1.5.0
KeyPeriodicNotification returns the key of periodic pub/sub channel.
func KeyPeriodicPolicy ¶ added in v1.5.0
KeyPeriodicPolicy returns the key of periodic policies.
func KeyPeriodicPolicyScore ¶ added in v1.5.0
KeyPeriodicPolicyScore returns the key of policy key and score mapping.
func MakeIdentifier ¶ added in v1.5.0
func MakeIdentifier() string
MakeIdentifier creates uuid for job.
func MakePeriodicPolicyUUID ¶ added in v1.5.0
MakePeriodicPolicyUUID returns an UUID for the periodic policy.
func MakeUniquePeriodicID ¶ added in v1.5.0
MakeUniquePeriodicID creates id for the periodic job.
func RedisKeyDead ¶ added in v1.5.0
RedisKeyDead returns key of the dead jobs.
func RedisKeyLastPeriodicEnqueue ¶ added in v1.5.0
RedisKeyLastPeriodicEnqueue returns key of timestamp if last periodic enqueue.
func RedisKeyScheduled ¶ added in v1.5.0
RedisKeyScheduled returns key of scheduled job.
func RedisNamespacePrefix ¶ added in v1.5.0
RedisNamespacePrefix ... Same with 'KeyNamespacePrefix', only for compatiblity.
func SerializeJob ¶ added in v1.5.0
SerializeJob encodes work.Job to json data.
func SetNowEpochSecondsMock ¶ added in v1.5.0
func SetNowEpochSecondsMock(t int64)
SetNowEpochSecondsMock ...
func TranslateRedisAddress ¶ added in v1.5.0
TranslateRedisAddress translates the comma format to redis URL