redsync

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExtendFailed = errors.New("redsync: failed to extend lock")

ErrExtendFailed is the error resulting if Redsync fails to extend the lock.

View Source
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 DelayFunc

type DelayFunc func(tries int) time.Duration

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.

func (ErrTaken) Error

func (err ErrTaken) Error() string

type RedisError

type RedisError struct {
	Node int
	Err  error
}

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) Lock

func (m *RedsyncMutex) Lock(ctx context.Context, key string, expiry time.Duration) error

func (*RedsyncMutex) Unlock

func (m *RedsyncMutex) Unlock(ctx context.Context, key string) (bool, error)

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.

Jump to

Keyboard shortcuts

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