locker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("Task already running")
)

Functions

This section is empty.

Types

type Locker

type Locker interface {
	IsRunning(taskName string) (bool, error)
	GetHostRunning(taskName string) (string, error)
	NotifyRunning(taskName string) error
	NotifyStoppedRunning(taskName string) error
	RunWhenReady(ctx context.Context, taskName string, task func(context.Context)) error
}

type RedisLocker

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

func New

func New(client *redis.Client, retryInterval time.Duration) *RedisLocker

func (*RedisLocker) GetHostRunning

func (m *RedisLocker) GetHostRunning(taskName string) (string, error)

func (*RedisLocker) IsRunning

func (m *RedisLocker) IsRunning(taskName string) (bool, error)

func (*RedisLocker) NotifyRunning

func (m *RedisLocker) NotifyRunning(taskName string) error

func (*RedisLocker) NotifyStoppedRunning

func (m *RedisLocker) NotifyStoppedRunning(taskName string) error

func (*RedisLocker) RunWhenReady

func (m *RedisLocker) RunWhenReady(ctx context.Context, taskName string, task func(context.Context)) error

Jump to

Keyboard shortcuts

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