consul

package
v0.0.0-...-c8a8185 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderName = "consul"
)

Variables

This section is empty.

Functions

func NewLock

func NewLock(opts *lock.Options) (lock.Lock, error)

NewLock creates a new lock maanger

Types

type Config

type Config struct {
	Key    string         `json:"key" yaml:"key"`
	Consul *consul.Config `json:"consul" yaml:"consul"`
}

type Lock

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

func (*Lock) Connect

func (l *Lock) Connect(ctx context.Context) (err error)

Connect connects to consul

func (*Lock) Disconnect

func (l *Lock) Disconnect(ctx context.Context) (err error)

Disconnect disconnects from consul

func (*Lock) HasLock

func (l *Lock) HasLock() bool

HasLock lock is held by this node

func (*Lock) Lock

func (l *Lock) Lock(ctx context.Context) (err error)

Lock creates a new lock

func (*Lock) Unlock

func (l *Lock) Unlock(ctx context.Context) (err error)

Unlock unlocks a lock by id

Jump to

Keyboard shortcuts

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