Help us shape the future of Go! Take the 2026 Go Developer Survey

distributed

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distributed

type Distributed struct {
	// contains filtered or unexported fields
}

func NewDistributed

func NewDistributed(opts ...Option) *Distributed

func (*Distributed) Mutex

func (d *Distributed) Mutex(ctx context.Context, option LockOption, fn func(ctx context.Context) error) error

type LockOption

type LockOption struct {
	Name string
	TTL  time.Duration
}

type Locker

type Locker interface {
	TryLock(ctx context.Context, option LockOption) (acquired bool, err error)
}

type Option

type Option func(*Distributed)

func WithLocker

func WithLocker(locker Locker) Option

func WithLogger

func WithLogger(logger *zap.SugaredLogger) Option

type RedisLocker

type RedisLocker struct {
	// contains filtered or unexported fields
}

func NewRedisLocker

func NewRedisLocker(client *redis.Client) *RedisLocker

func (*RedisLocker) TryLock

func (l *RedisLocker) TryLock(ctx context.Context, option LockOption) (bool, error)

Jump to

Keyboard shortcuts

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