leaderlease

package
v3.7.0-0.136.0+incompa... Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Etcd

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

Etcd takes and holds a leader lease until it can no longer confirm it owns the lease, then returns.

func (*Etcd) AcquireAndHold

func (e *Etcd) AcquireAndHold(notify chan error)

AcquireAndHold implements an acquire and release of a lease.

func (*Etcd) Release

func (e *Etcd) Release()

Release tries to delete the leader lock.

type Leaser

type Leaser interface {
	// AcquireAndHold tries to acquire the lease and hold it until it expires, the lease is lost,
	// or we observe another party take the lease. The provided function will be invoked when the
	// lease is acquired, and the provided channel will be closed when the lease is lost. If the
	// function returns true, the lease will be released on exit. If the function returns false,
	// the lease will be held.
	AcquireAndHold(chan error)
	// Release returns any active leases
	Release()
}

Leaser allows a caller to acquire a lease and be notified when it is lost.

func NewEtcd

func NewEtcd(client etcdclient.Client, key, value string, ttl uint64) Leaser

NewEtcd creates a Lease in etcd, storing value at key with expiration ttl and continues to refresh it until the key is lost, expires, or another client takes it.

Jump to

Keyboard shortcuts

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