Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPollingPeriod time.Duration
View Source
var DefaultTtl time.Duration
Functions ¶
func PollStatusUntil ¶
func PollStatusUntil(lockToPoll DistributedLocker, period time.Duration, eval StatusEvaluator) error
Types ¶
type DistributedLocker ¶
type DistributedLocker interface { GetLockStatus() LockStatusResult WaitUntilUnlock(deadline time.Time) (err error) TryLock() LockStatusResult TryUnlock() LockStatusResult TryForceLock() LockStatusResult KeepAlive() (result LockStatusResult) }
func NewGoRedisLocker ¶
func NewGoRedisLocker(keyPrefix string, lockId string, ttlSeconds time.Duration, redis GoRedisClient) DistributedLocker
type GoRedisClient ¶
type GoRedisClient interface { Get(key string) *goredis.StringCmd EvalSha(sha1 string, keys []string, args ...interface{}) *goredis.Cmd ScriptExists(hashes ...string) *goredis.BoolSliceCmd ScriptLoad(script string) *goredis.StringCmd SetNX(key string, value interface{}, expiration time.Duration) *goredis.BoolCmd TxPipeline() goredis.Pipeliner PSubscribe(channels ...string) *goredis.PubSub }
type LockStatusResult ¶
type StatusEvaluator ¶
type StatusEvaluator func(status LockStatusResult) (shouldContinue bool, err error)
Click to show internal directories.
Click to hide internal directories.