Documentation ¶
Overview ¶
Package redsync provides a Redis-based distributed mutual exclusion lock implementation as described in the post http://redis.io/topics/distlock.
Values containing the types defined in this package should not be copied.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTaken = errors.New(takenMsg)
ErrTaken happens when the lock is already taken in a quorum on nodes.
Functions ¶
This section is empty.
Types ¶
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
A Mutex is a distributed mutual exclusion lock.
func (*Mutex) Extend ¶
Extend resets the mutex's expiry.
If not nil, the error will be either ErrTaken or a NoQuorum, which in turn contains NodeTaken or RedisError.
type NoQuorum ¶
type NoQuorum []error
NoQuorum is a series of errors, either NodeTaken or RedisError, that happened while trying to acquire or extend a lock in a cluster and prevent the lock to be taken in a quorum of nodes.
type NodeTaken ¶
type NodeTaken struct {
Node int
}
A NodeTaken happens when the lock is already taken in one of the cluster's nodes.
type Option ¶
type Option interface {
Apply(*Mutex)
}
An Option configures a mutex.
func SetDriftFactor ¶
SetDriftFactor can be used to set the clock drift factor.
func SetRetryDelay ¶
SetRetryDelay can be used to set the amount of time to wait between retries.
func SetRetryDelayFunc ¶
SetRetryDelayFunc can be used to override default delay behavior.
type RedisError ¶
A RedisError is an error communicating with one of the Redis nodes.
func (RedisError) Error ¶
func (err RedisError) Error() string