kubernetes-mesos: github.com/vladimirvivien/kubernetes-mesos/pkg/election Index | Files

package election

import "github.com/vladimirvivien/kubernetes-mesos/pkg/election"

Package election provides interfaces used for master election.

Index

Package Files

doc.go etcd_master.go fake.go master.go

func Notify Uses

func Notify(m MasterElector, path, id string, s Service)

Notify runs Elect() on m, and calls Start()/Stop() on s when the elected master starts/stops matching 'id'. Never returns.

type Fake Uses

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

Fake allows for testing of anything consuming a MasterElector.

func NewFake Uses

func NewFake() *Fake

NewFake makes a new fake MasterElector.

func (*Fake) ChangeMaster Uses

func (f *Fake) ChangeMaster(newMaster Master)

func (*Fake) Elect Uses

func (f *Fake) Elect(path, id string) watch.Interface

type Master Uses

type Master string

Master is used to announce the current elected master.

func (Master) IsAnAPIObject Uses

func (Master) IsAnAPIObject()

IsAnAPIObject is used solely so we can work with the watch package. TODO(k8s): Either fix watch so this isn't necessary, or make this a real API Object. TODO(k8s): when it becomes clear how this package will be used, move these declarations to to the proper place.

type MasterElector Uses

type MasterElector interface {
    // Elect makes the caller represented by 'id' enter into a master election for the
    // distributed lock defined by 'path'
    // The returned watch.Interface provides a stream of Master objects which
    // contain the current master.
    // Calling Stop on the returned interface relinquishes ownership (if currently possesed)
    // and removes the caller from the election
    Elect(path, id string) watch.Interface
}

MasterElector is an interface for services that can elect masters. Important Note: MasterElectors are not inter-operable, all participants in the election need to be

using the same underlying implementation of this interface for correct behavior.

func NewEtcdMasterElector Uses

func NewEtcdMasterElector(h tools.EtcdGetSet) MasterElector

NewEtcdMasterElector returns an implementation of election.MasterElector backed by etcd.

type Service Uses

type Service interface {
    Validate(desired, current Master)
    Start()
    Stop()
}

Service represents anything that can start and stop on demand.

Package election imports 8 packages (graph). Updated 2018-04-23. Refresh now. Tools for package owners.