Documentation
¶
Index ¶
- Variables
- type DelayFunc
- type ErrNodeTaken
- type ErrTaken
- type RedisError
- type RedsyncMutex
- func (m *RedsyncMutex) Extend() (bool, error)
- func (m *RedsyncMutex) ExtendContext(ctx context.Context) (bool, error)
- func (m *RedsyncMutex) Lock(ctx context.Context, key string, expiry time.Duration) error
- func (m *RedsyncMutex) Unlock(ctx context.Context, key string) (bool, error)
- func (m *RedsyncMutex) Valid() (bool, error)
- func (m *RedsyncMutex) ValidContext(ctx context.Context) (bool, error)deprecated
Constants ¶
This section is empty.
Variables ¶
var ErrExtendFailed = errors.New("redsync: failed to extend lock")
ErrExtendFailed is the error resulting if Redsync fails to extend the lock.
var ErrFailed = errors.New("redsync: failed to acquire lock")
ErrFailed is the error resulting if Redsync fails to acquire the lock after exhausting all retries.
Functions ¶
This section is empty.
Types ¶
type ErrNodeTaken ¶
type ErrNodeTaken struct {
Node int
}
ErrNodeTaken is the error resulting if the lock is already taken in one of the cluster's nodes
func (ErrNodeTaken) Error ¶
func (err ErrNodeTaken) Error() string
type ErrTaken ¶
type ErrTaken struct {
Nodes []int
}
ErrTaken happens when the lock is already taken in a quorum on nodes.
type RedisError ¶
A RedisError is an error communicating with one of the Redis nodes.
func (RedisError) Error ¶
func (err RedisError) Error() string
type RedsyncMutex ¶
type RedsyncMutex struct {
// contains filtered or unexported fields
}
func (*RedsyncMutex) Extend ¶
func (m *RedsyncMutex) Extend() (bool, error)
func (*RedsyncMutex) ExtendContext ¶
func (m *RedsyncMutex) ExtendContext(ctx context.Context) (bool, error)
ExtendContext resets the mutex's expiry and returns the status of expiry extension.
func (*RedsyncMutex) Valid ¶
func (m *RedsyncMutex) Valid() (bool, error)
func (*RedsyncMutex) ValidContext
deprecated
func (m *RedsyncMutex) ValidContext(ctx context.Context) (bool, error)
ValidContext returns true if the lock acquired through m is still valid. It may also return true erroneously if quorum is achieved during the call and at least one node then takes long enough to respond for the lock to expire.
Deprecated: Use Until instead. See https://github.com/go-redsync/redsync/issues/72.