leadership

package
v0.0.0-...-171db1f Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package leadership provides leadership election and observation.

To participate in leadership election as a candidate, an application must get a candidate implementation from a LeadershipProvider. To observe the quorum, an application must instantiate get an Observer implementation from a LeadershipProvider.

Index

Constants

This section is empty.

Variables

View Source
var (
	// No leader found.
	ErrNoLeader = errors.New("no leader found")
)

Functions

This section is empty.

Types

type Candidate

type Candidate interface {
	// Stop offering candidacy.
	Stop()
}

Candidate.

Offers and handles leadership.

type LeadershipHandler

type LeadershipHandler func(end <-chan struct{})

Leadership handler.

Invoked when a candidate becomes a leader. When the leadership ends, an empty struct is sent over end. Returning from the handler function results in termination of the leadership.

type LeadershipProvider

type LeadershipProvider interface {
	// Get a candidate.
	GetCandidate(data []byte, leadershipHandler LeadershipHandler) Candidate
}

Leadership provider.

func NewZooKeeperLeadershipProvider

func NewZooKeeperLeadershipProvider(connMan *zkutils.ConnMan, path string, acl []zk.ACL) LeadershipProvider

New ZooKeeper leadership provider.

Jump to

Keyboard shortcuts

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