etcd

package
v0.0.0-...-a355528 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// DefaultKey is the key used to persist the location
	DefaultKey = "infrakit/leader/location"
)

Variables

This section is empty.

Functions

func AmILeader

func AmILeader(ctx context.Context, client *etcd.Client) (isLeader bool, err error)

AmILeader checks if this node is a leader

func NewDetector

func NewDetector(pollInterval time.Duration, client *etcd.Client) *leader.Poller

NewDetector return an implementation of leader detector

func NewStore

func NewStore(c *etcd.Client) leader.Store

NewStore returns a store for registration of leader location

Types

type Store

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

Store uses ectd as the backend for registration of leader location

func (Store) GetLocation

func (s Store) GetLocation() (*url.URL, error)

GetLocation returns the location of the leader

func (Store) UpdateLocation

func (s Store) UpdateLocation(location *url.URL) error

UpdateLocation writes the location to etcd.

Jump to

Keyboard shortcuts

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