rds

package
v0.0.0-...-d01dfd4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 189

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoElements = errors.New("no elements got from the backend")

ErrNoElements is a pre defined error to describe the case that no elements got from the backend database.

View Source
var HookAckScript = redis.NewScript(2, hookAckScriptText)

HookAckScript is defined to set the hook event ACK in the job stats map

View Source
var SetStatusScript = redis.NewScript(2, setStatusScriptText)

SetStatusScript is lua script for setting job status atomically

View Source
var StatusResetScript = redis.NewScript(2, statusResetScriptText)

StatusResetScript is lua script to reset the job stats

Functions

func AcquireLock

func AcquireLock(conn redis.Conn, lockerKey string, lockerID string, expireTime int64) error

AcquireLock acquires a redis lock with specified expired time

func HmGet

func HmGet(conn redis.Conn, key string, fields ...interface{}) ([]interface{}, error)

HmGet gets values of multiple fields Values have same order with the provided fields

func HmSet

func HmSet(conn redis.Conn, key string, fieldAndValues ...interface{}) error

HmSet sets the properties of hash map

func KeyInProgressQueue

func KeyInProgressQueue(namespace string, jobType string, workerPoolID string) string

KeyInProgressQueue returns the key of the in progress queue for the specified job type.

func KeyJobLock

func KeyJobLock(namespace string, jobType string) string

KeyJobLock returns the key of lock for the specified job type.

func KeyJobLockInfo

func KeyJobLockInfo(namespace string, jobType string) string

KeyJobLockInfo returns the key of lock_info for the specified job type.

func KeyJobStats

func KeyJobStats(namespace string, jobID string) string

KeyJobStats returns the key of job stats

func KeyJobTrackInProgress

func KeyJobTrackInProgress(namespace string) string

KeyJobTrackInProgress returns the key of in progress jobs tracking queue

func KeyJobs

func KeyJobs(namespace, jobType string) string

KeyJobs returns the key of the specified job queue

func KeyNamespacePrefix

func KeyNamespacePrefix(namespace string) string

KeyNamespacePrefix returns the based key based on the namespace.

func KeyPeriod

func KeyPeriod(namespace string) string

KeyPeriod returns the key of period

func KeyPeriodicLock

func KeyPeriodicLock(namespace string) string

KeyPeriodicLock returns the key of locker under period

func KeyPeriodicPolicy

func KeyPeriodicPolicy(namespace string) string

KeyPeriodicPolicy returns the key of periodic policies.

func KeyStatusUpdateRetryQueue

func KeyStatusUpdateRetryQueue(namespace string) string

KeyStatusUpdateRetryQueue returns the key of status change retrying queue

func KeyUpstreamJobAndExecutions

func KeyUpstreamJobAndExecutions(namespace, upstreamJobID string) string

KeyUpstreamJobAndExecutions returns the key for persisting executions.

func KeyWorkerPools

func KeyWorkerPools(namespace string) string

KeyWorkerPools returns the key of the worker pool

func RedisKeyLastPeriodicEnqueue

func RedisKeyLastPeriodicEnqueue(namespace string) string

RedisKeyLastPeriodicEnqueue returns key of timestamp if last periodic enqueue.

func RedisKeyScheduled

func RedisKeyScheduled(namespace string) string

RedisKeyScheduled returns key of scheduled job.

func RedisLuaReenqueueScript

func RedisLuaReenqueueScript(jobTypesCount int) *redis.Script

RedisLuaReenqueueScript returns redis script of redisLuaReenqueueJob

func RedisNamespacePrefix

func RedisNamespacePrefix(namespace string) string

RedisNamespacePrefix ... Same with 'KeyNamespacePrefix', only for compatibility.

func ReleaseLock

func ReleaseLock(conn redis.Conn, lockerKey string, lockerID string) error

ReleaseLock releases the acquired lock

Types

type JobScore

type JobScore struct {
	JobBytes []byte
	Score    int64
}

JobScore represents the data item with score in the redis db.

func GetZsetByScore

func GetZsetByScore(conn redis.Conn, key string, scores []int64) ([]JobScore, error)

GetZsetByScore get the items from the zset filtered by the specified score scope.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL