Documentation
¶
Index ¶
- func EtcdDLockBuilder(ctx context.Context, client *clientv3.Client) *etcdDLockOptions
- func RedisDLockBuilder(ctx context.Context, scripter func() redis.Scripter) *redisDLockOptions
- type DLockErr
- type DLocker
- type EtcdDLockOption
- type RedisDLockOption
- type RetryStrategy
- func DefaultExponentialBackoffRetry() RetryStrategy
- func EndlessRetry(backoff time.Duration) RetryStrategy
- func ExponentialBackoffRetry(maxSteps int64, initBackoff, maxBackoff time.Duration, ...) RetryStrategy
- func LimitedRetry(backoff time.Duration, maxCount int64) RetryStrategy
- func NoRetry() RetryStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EtcdDLockBuilder ¶
func RedisDLockBuilder ¶
Types ¶
type DLocker ¶
type DLocker interface { Lock() error Unlock() error Renewal(newTTL time.Duration) error TTL() (time.Duration, error) }
func RedisDLock ¶
func RedisDLock(ctx context.Context, scripter func() redis.Scripter, opts ...RedisDLockOption) (DLocker, error)
type EtcdDLockOption ¶
type EtcdDLockOption func(opt *etcdDLockOptions)
func WithEtcdDLockKeys ¶
func WithEtcdDLockKeys(keys ...string) EtcdDLockOption
func WithEtcdDLockRetry ¶
func WithEtcdDLockRetry(strategy RetryStrategy) EtcdDLockOption
func WithEtcdDLockTTL ¶
func WithEtcdDLockTTL(ttl time.Duration) EtcdDLockOption
type RedisDLockOption ¶
type RedisDLockOption func(opt *redisDLockOptions)
func WithRedisDLockKeys ¶
func WithRedisDLockKeys(keys ...string) RedisDLockOption
func WithRedisDLockRetry ¶
func WithRedisDLockRetry(strategy RetryStrategy) RedisDLockOption
func WithRedisDLockTTL ¶
func WithRedisDLockTTL(ttl time.Duration) RedisDLockOption
func WithRedisDLockToken ¶
func WithRedisDLockToken(token string) RedisDLockOption
type RetryStrategy ¶
func DefaultExponentialBackoffRetry ¶
func DefaultExponentialBackoffRetry() RetryStrategy
func EndlessRetry ¶
func EndlessRetry(backoff time.Duration) RetryStrategy
func ExponentialBackoffRetry ¶
func ExponentialBackoffRetry(maxSteps int64, initBackoff, maxBackoff time.Duration, backoffFactor, jitter float64) RetryStrategy
func LimitedRetry ¶
func LimitedRetry(backoff time.Duration, maxCount int64) RetryStrategy
func NoRetry ¶
func NoRetry() RetryStrategy
Click to show internal directories.
Click to hide internal directories.